Stop Light Passing Through Inside Object

How to stop light from passing through an object?

For example, I am inside a large sphere, I want the inside to be pitch black. This is not the case with default Babylonjs spotlights. The spotlights are placed outside the sphere, but the inside of the sphere is still bright.

How can I prevent this?

You might need to explore self shadowing.

But even then, if you’re on the inside of a sphere, the light is outside and assuming you have backface culling off, then the back faces that you’ll see from the inside will display exterior lighting and shadows (I think?).

I’d suggest you have a separate mesh for the inner of the sphere and then limit your light to only illuminate the outer sphere. See light.includedOnlyMeshes

1 Like