Lightings Problem (Metallic Material Rendering Black)

Hi,

I exported a file from Rhinoceros 7. In that file, I used metallic material (shown in red). If I set Polish to 100%, the part with the metallic material becomes totally black.

I am just wondering what should I add in my code to achieve rendering of the online viewer of babylonjs. I am using same file in both renders.

My current code:

const createScene = async (canvas: any) => {

  const engine = new Engine(canvas)
  const scene = new Scene(engine)

  scene.clearColor = new Color3(0.95, 0.95, 0.95)

  const camera = new ArcRotateCamera("camera1", Math.PI/4, Math.PI/2.5, 2000, new Vector3(0, 1000, 0), scene)
  camera.setTarget(Vector3.Zero())
  camera.attachControl(canvas, true)
  camera.wheelPrecision = 0.1

  const light = new HemisphericLight("light", Vector3.Up(), scene)
  light.intensity = 2

  await SceneLoader.ImportMeshAsync("", "./models/", "test.glb", scene)

  engine.runRenderLoop(() => {
    scene.render()
  })
}

Thanks in advance.

try this

scene.createDefaultEnvironment();

https://doc.babylonjs.com/features/featuresDeepDive/materials/using/HDREnvironment#introduction

1 Like

Awesome. Thank you very much.