Directional sun / global light

I want to make a sun for my game and casts shadows too but one problem the light does not like to render far and i would put it like 99999999 distance away from an object and the object does not cast a single shadow if you have an answer please show me because I’ve been trying to make a directional sun.

Or if you know how to make a sun that follows the camera and can cast shadows from a radius, or like cast shadows from a radius of the camera to prevent lag then please show me how.

three-csm :point_left:

Well, there’s a reason why most games have “shadow / draw distance” in their settings :sweat_smile: Rendering shadows ain’t cheap, so like it or not - you’ll need to make some compromises to keep the performance at a reasonable level.

1 Like

oh yeah i have trouble importing github things to my website, I get many errors on console can you maybe show me an example how to import three csm?

THREE already has an official demo that uses cascading shadow maps… it may be worth looking at the source code :wink:

import { CSM } from 'three/addons/csm/CSM.js';