While analyzing the profiler for something else, I saw today that Shadow.CullingCallbacks are taking up 62% of my CPU Time.
Correct me if I am wrong, but going from the name these are meant to optimize the shadow casting system by culling shadow casters before calculating the shadows. Could it be that in my use case, more time is actually spent on culling than on calculating the shadows? Is there a way to control this culling?
I have a lot of lights that are set in the editor as casting shadows, and then have shadows set to none during runtime to only ever have a few lights with active shadows. Will the system still call these callbacks for lights that had their shadowtype set to none during runtime? Is my high CPU Time wasted on that coming from me switching the shadow type at runtime?
Would it be possible that the culling is actually leading to worse performance because it chokes the CPU when there is plenty of free GPU Time?
Thanks for any suggestions.
Gian-Reto
EDIT:
done some additional testing…
Switching some of the lights to have no shadows does not change the overhead by these callbacks (actually, CPU usage by this specific cullingcallbacks go up to 82%, most probably because other things now use less CPU).
Switching ALL lights to not use shadows makes it go away completly.
Seems like this is run once, not per light. Which makes the large percentage even harder to explain.
Checking on the GPU stats, seems like the GPU (GTX 970) still has plenty of resources left dwidling their thumbs. But I also see 884 shadow casters in a scene with not so many objects in it… looks like a rather large number for what is in the scene currently, might need to check what is causing it…