Box Color Changes When Flat on Orthographic Top View? How?

You can see the exact problem here Recording #504

Why is the color white when the box is flat? My guess is that it has to do with the lighting I use?

var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,1,0), scene);

var box = BABYLON.MeshBuilder.CreateBox("box", {width: 2, height: 2, depth: 2}, scene);

let blackMaterial = new BABYLON.StandardMaterial("blackMaterial", scene);
blackMaterial.diffuseColor = new BABYLON.Color3.FromHexString('#000000');
box.material = blackMaterial;

Hi. Actually the color is not changing, you are seeing specular effect of the hemispheric light on the material of the box.

Use this

light.specular = new BABYLON.Color3.Black():

that should fix that issue

1 Like

Also, if you don’t want to completely remove specular of the light, you can set specularColor of the material itself to black, it will have same effect.

So

blackMaterial.specularColor = new BABYLON.Color3.Black();

1 Like