Omer Kamran
Omer Kamran

Reputation: 1

Why is the directional light illuminating the box placed behind it?

I've added a DirectionalLightHelper to my code to illuminate a box. The light is placed at coordinates (2,2,1) and two boxes at (0,0,0) and (3,3,3). The box at (3,3,3) shouldn't be illuminated by the directionalLight, yet it is being illuminated the same way the box at (0,0,0) is. Any insight on this would be really helpful.

Scene Image Here

1

Upvotes: 0

Views: 46

Answers (1)

M -
M -

Reputation: 28502

DirectionalLight doesn’t behave like a panel of light.

From the docs:

light will behave as though it is infinitely far away and the rays produced from it are all parallel.

So when you assign it’s position, it’s actually the vector from where the light rays are coming from, and it’ll affect all objects on the scene.

Maybe you’d like to use layers so the light only affects one box but not the other.

Upvotes: 1

Related Questions