Exporting Blender Scene - Lighting Issues

Ok, this comes down to two issues:

  1. Blender’s preview appears to include IBL (image based lighting, also called an environment map), or something like it, and I don’t know how to disable that… as a result, your two lights are not actually the only two light sources in Blender. Surfaces facing away from those two lights look well-lit in Blender, but won’t in other viewers unless you add IBL, or even just an ambient light, to compensate.

  2. The normals don’t appear to be exporting quite right, and the vertices along hard edges at the tops and bottoms of shapes are being smoothed. That might be a bug in the Blender exporter, or a mistake in the model, I’m not sure. Consider filing an issue at https://github.com/KhronosGroup/glTF-Blender-IO. You can see the issue plainly in BabylonJS by enabling the normal debug mode:

This causes the dark areas on the lower halves of each model. You can work around it by putting a loop cut next to each hard edge, in Blender, as shown here:

I did so for just the green shape, and you’ll see that its lighting is fixed in both threejs and babylonjs. Without IBL, the green shape is darker on the unlit side (but not the entire bottom half of the shape). With IBL, the green shape looks entirely correct to me, although normals on the top surface still aren’t quite perfect.

lighting three.js babylonjs
no IBL Screen Shot 2020-01-08 at 10.58.25 AM Screen Shot 2020-01-08 at 10.58.29 AM
IBL Screen Shot 2020-01-08 at 10.58.16 AM Screen Shot 2020-01-08 at 10.58.06 AM
4 Likes