No shadows being cast in scene

Every item in my scene can cast and some can receive. I am trying to recreate sunlight hitting my objects, so I decided to use a directional light. problem is that I don’t have any shadows and I’ve been looking over my code for the past hour trying to find out why… I’ve uploaded my project to github if anyone would be willing to check what I have forgotten to do.

The weirdest part is that it worked before, I had the shadows casting but now they’re gone… I have followed the steps on the docs multiple times but still can’t figure out why it doesn’t work…

1 Like

It actually is casting a shadow, just a very small one! :wink:

you can change the size of the directional light shadow area with this:

var dirLight = new THREE.DirectionalLight(0x404040, 4, 100);
dirLight.position.set(-190, 80, 60);
dirLight.castShadow = true;
dirLight.shadowCameraLeft = -130;
dirLight.shadowCameraRight = 190;
dirLight.shadowCameraTop = 190;
dirLight.shadowCameraBottom = -190;


1 Like

oh lol, nice. That explains it. I didn’t think about this being the issue. I assumed directional lights were global in terms of size. Thanks, now I gotta make that light move to simulate day/night. That’s off topic but idk how I am going to do that xD

Additional question though: IS there a way around the artifacting of the shadow on the blinds on the front side?

I’m not sure exactly what artifacting you mean but this might help.

dirLight.shadowMapHeight = 4096;
dirLight.shadowMapWidth = 4096; 

// default is 512

Shadows can be expensive though so if the artifacting is negligible i’d not really bother.

Figured it wasnt artifacting, it was some weird triangles shadows rendering, caused by using the wrong shadow type. I set it to PCSoftShadowMap fixed it. The size was also worth increasing though.

1 Like