three.jsshadows

three.js light leaking from object


I'm having an issue with three.js lighting. Not sure what am i doing wrong. I have a plane that is set to receiveShadow to try and a cube that is set to castShadow. Overall all ok until I move the light into the cube. If the light is within 70% of the center of the cube, all good, no light comes outside but if within 30% of the cube's edged it's leaking light to ouside. Is this preventable? What i mean is:

(this is ok) enter image description here

this is not okenter image description here


Solution

  • Ok so I started reading a bit more about light properties and found out that in my case it was the following issue:

        bulbLight.shadow.camera.near = 0.01;
    

    Had to do with shadow camera frustrum. This fixed the issue. Now if the light is inside the cube (had to do with dimensions of the objects) it doesn't leak the light out. Practically speaking the light was never "fully inside" of my objects.