# My voxels are not casting or reflecting shadows

**URL:** <https://discourse.threejs.org/t/my-voxels-are-not-casting-or-reflecting-shadows/66227>\
**Category:** Questions\
**Tags:** shadows\
**Created:** [May 31, 2024, 5:20am UTC](https://discourse.threejs.org/t/my-voxels-are-not-casting-or-reflecting-shadows/66227 "2024-05-31T05:20:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VictorHurtado](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/victorhurtado/32/46941_2.png) [@VictorHurtado](https://discourse.threejs.org/u/VictorHurtado)\
**Post date:** [May 31, 2024, 5:20am UTC](https://discourse.threejs.org/t/my-voxels-are-not-casting-or-reflecting-shadows/66227/1 "2024-05-31T05:20:32Z")

</div>

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](https://discourse.threejs.org/uploads/short-url/l3EMQKwYDZpStXrtFIaCkTMpgxH.js) (20.9 KB)

---

<div class="post-metadata">

**Author:** ![seanwasere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/seanwasere/32/20864_2.png) [@seanwasere](https://discourse.threejs.org/u/seanwasere)\
**Post date:** [May 31, 2024, 7:34am UTC](https://discourse.threejs.org/t/my-voxels-are-not-casting-or-reflecting-shadows/66227/2 "2024-05-31T07:34:18Z")

</div>

your directionalLight shadow camera frustum is quite small.

```javascript
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.

> **[PointerLockControls](https://sbedit.net/3e45a84003ecb1a88c4c2bff94894437e86c44ea)**
>
> Three.js TypeScript Tutorials by Sean Bradley : https://sbcode.net/threejs

---

<div class="post-metadata">

**Author:** ![VictorHurtado](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/victorhurtado/32/46941_2.png) [@VictorHurtado](https://discourse.threejs.org/u/VictorHurtado)\
**Post date:** [May 31, 2024, 11:36am UTC](https://discourse.threejs.org/t/my-voxels-are-not-casting-or-reflecting-shadows/66227/3 "2024-05-31T11:36:53Z")

</div>

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!
