My voxels are not casting or reflecting shadows

Guys, I’ve been trying to get my voxels to cast and receive shadows, but no matter what I do, I can’t seem to get it to work. I’ve been trying for hours now, and I’m leaving one of the attempts I made to get it to work. It’s late here, and I’ll try to get some sleep. Hopefully, someone can see what I am doing wrong. I know it may be difficult without a live example, but i cant share atm since it connects to a local server.

client.js (20.9 KB)

your directionalLight shadow camera frustum is quite small.

directionalLight.shadow.camera.near = 0.5; // Set near value of the shadow camera
directionalLight.shadow.camera.far = 50; // Set far value of the shadow camera
directionalLight.shadow.camera.left = -10; // Set left value of the shadow camera
directionalLight.shadow.camera.right = 10; // Set right value of the shadow camera
directionalLight.shadow.camera.top = 10; // Set top value of the shadow camera
directionalLight.shadow.camera.bottom = -10; // Set bottom value of the shadow camera

i couldnt figure out if you are moving your directionalLight with your camera so then your small frustum may actually be ok.

here is an exmaple of a larger directionalLight shadow frustum and moving it with the camera.

Thank you so much for replying. No, the directional light is meant to be in placed although there are gui controls to move it if needed. I do see something a tiny black rectangle moving, which now in hindsight might have been what you mentioned.

I also realized I uploaded a broken version of the code. i’ve decided to roll back to a version before i created the directional light and start again. ill use your example to help me. Thanks again for your input!