Iris should support occlusion culling in the shadow pass somehow
coderbot16 opened this issue · 1 comments
Advanced Shadow Frustum Culling in Iris 1.1.2 is pretty much the best we can do with normal frustum culling techniques. Occlusion culling is needed to improve culling. Obviously, it doesn't work with voxelization. Though, it does work with the sun-bounce GI in SEUS.
Some info about how Canvas does this was explained by grondag in the caffeine server:
“Canvas uses two additional occlusion rasters for shadow pass - the first (lets call it A) is visible world geometry in ortho projection. Occluders that are drawn to the perspective-projection rasterizer are also drawn to A. The second raster (B) contains shadowing occluders, also drawn in ortho projection. Occluders in B are sorted starting from the light source. (Ortho sorting can be less expensive than perspective - it is essentially step-wise iteration in three dimensions.)
Each potential shadow occluder is first compared against A. (You could still use your nice extruded frustum test as a pre-filter, though I haven't tried that yet.) If the occluder doesn't intersect with any part of A, then it cannot occlude anything in view and is discarded. If it does intersect with A, then we try to draw it on B. If all covered pixels were already filled in B, then the occluder was already fully in shadow and can be discarded. If any pixel was filled, then the occluder should be part of the shadow pass.
This is efficient but not perfect. If you are standing in a fully-enclosed cave looking towards the sun (which you cannot see), the process will still iterate from the sun all the way down to the exterior surface of the cave. It does give the correct result - that your view is entirely in shadow - but it seems relatively expensive in the nominal case. “