I have a SpotLight sourrounded by a box that has a hole on one side.
The plan is to throw shaped light rays onto the grey wall.
JsFiddle Example here
The blue box shows the desired behaviour: The box is open at the front side and the light rays are cut to a rectangle. (The SpotLights are each inside the blue and green box.)
However if the box dimensions are set to a small value (~ 0.5, like the green box) the light seems to be bigger than the box and some outermost rays reach the wall.
Is there any way to make the SpotLight smaller to remove this effect?
I also think that the SpotLight starts as a single point of source and proceeds with a cone-shaped geometry. So why does it reach out of the cube at the source point?
You can use the angle property of the spotlight, if the light source still protrudes have you concidered using some extra planes to block the light where needed?
I already set the angle to a small value. I cant make it much smaller, otherwise the corners of the rectangle will be cut because of the smaller radius.
Adding extra planes is a good idea. I already have a working example with that.
I’m just curious if there’s a “not-so-hacky” solution because the lights should theoretically be points without a “radius” like this.
I think you can do it with spotlight’s target function
- set spotlight target your box
- change position…?
If your box is smaller, the spotlight should be close to the box.
I tried it, but the target function does not change this effect because it provides only the direction of the light rays, but not the cone size. This is provided by the SpotLight’s angle parameter.