i am about to add shadow mapping to my simple game, i have a map level structured in an octree the camera culls out the octree nodes out of the vieweing frusutm and everything runs smooth. Now i want shadows and i have a doubt , the directional light runs is set at an infinite distance so basically it encompasses all the octree destroying the purpose of node culling. How can i add a directional shadow map and cull nodes outside the light frusutm if it is at an infinite distance ? thanks in advance
You only care about shadows that are visible in the camera's frustum. If something casts a shadow on a surface out of the camera's view, you never see it, so you can ignore those receivers.
That lets you start with just the octree nodes that survived the camera's frustum culling pass, encompassing all visible shadow receivers.
Shadow casters that cast shadows on these receivers could be anywhere in this volume or upstream / toward the light from here. So next you extrude the camera's frustum back toward the light until it...
encompasses the maximum bounds of your scene / loaded chunks
reaches a maximum defined shadow-casting distance [for this cascade], if you find that including all arbitrarily-distant casters is impractical for your case.
Either way, you get a finite volume that needs to be drawn to your shadow map(s), letting you select a finite number of octree nodes to include in this pass.
If you need to do directional light shadows over truly immense distances that could have geometry all along the way — like a shadow of a mountain stretching all the way across the neighbouring valley at sunset — then you can swap to an alternate method of handling these, like the "terrain shadows clipmap" used in the Witcher 3, as described around 33 minutes into this GDC Talk, while keeping your conventional shadow map for the more detailed nearby shadow-casters.