I’ve been trying to make shadows only appear in a certain radius on the camera but it just does not work, it always gives errors and also does not even do anything when there is no errors to make the shadows appear only near to the camera if there is another way show me heres the problem in a video
yeah thats it.
i fixed it and really cool cool
Hi, would you mind sharing your solution? I’m having a similar difficulty.
oh I haven’t been online here for a bit but I switched to babylon.js because I saw webgpu but I used CSM to fix it, its a bit hard to get at first but yeah its the way to do it on three.js if the problem is still there. sorry for the very late response
THREEJS CascadedShadowMap example:
https://threejs.org/examples/webgl_shadowmap_csm.html
If you need to expand the shadow size on a directionalLIght…
You can modify its shadow.camera.left/right/top/bottom and then update its projection matrix.
from ChatGPT:
// Adjust the shadow camera's size
light.shadow.camera.left = -10;
light.shadow.camera.right = 10;
light.shadow.camera.top = 10;
light.shadow.camera.bottom = -10;
// Optionally, adjust the shadow map resolution (higher values give more detail)
light.shadow.mapSize.width = 1024;
light.shadow.mapSize.height = 1024;
// Optionally, adjust the near and far planes of the shadow camera
light.shadow.camera.near = 0.5;
light.shadow.camera.far = 500;
light.shadow.camera.updateProjectionMatrix(); //Maybe optional...