Removing directional lights from MeshPhysicalMaterial while keeping shadows

Hello everyone,

I try to adapt the MeshPhysicalMaterial that it neglects directional lights but it keeps its shadows. I am using a hdr for lighting by since ibl won’t create shadows I added a directional light. Unfortunately the lighting doesn’t look good if both light sources are merged.

Babylonjs offers a disableLight parameter for its pbr material: Babylon.js docs

Can we achieve the same effect with threejs?


Shadows are not distinct from lighting — they are portions of a surface where light is occluded. Disable the light, and it’s the same as if the entire mesh is in shadow. Are you sure that the babylon.js disableLighting option is casting shadows from the disabled light?

To occlude light from an environment map in specific areas, you could bake an ambient occlusion map, e.g. in Blender. Or you could fake the shadow in some other way, e.g. with a decal. Or try to improve the appearance when both light sources are active.


thanks for your reply!

I just tested it. Indeed babylon works the same.

Unfortunately baking is not an option for me. Is it possible to adapt the MeshPhysicalMaterial so it works the other way around - so the occluded parts are darkened instead of not occluded parts are brightened?


I’m not sure I can follow the discussion, so let me try with this demo:

There is blue spot light from the left, red spot light from the right, and there is a strong white light from the top – this light casts a shadow, but does not enlighten any object (i.e. it is shadow-only light). Is this what Babylonjs’s disableLight do?


Just for reference, here is the same scene with the “traditional” directional light, that bleaches out almost everything:


Ohhhh, that’s exactly what I was looking for. This trick is dope.

Thank you very much!

1 Like