ForwardAdd Pass equivalent in SRP

Does there exist a way in the ScriptableRenderPipelines API to generate the equivalent of the ForwardAdd Pass? I would like to render only the visible Renderers from the CullingResults that are affected by a specified Visible Light. Is this currently possible?

In doing some further investigation, the closest thing I have found that there may be to achieving this is to have a separate CullResults object where I derive a culling Matrix for the Light in question and do the DrawRenderers call with those instead of the Camera’s. This doesn’t seem right to me as it would possibly generate a FilterResults containing off-screen Renderers, which would be unnecessary overhead.

I can see that there exists in ScriptableCullingParameters a cullingPlanesCount. Perhaps this could be used to combine the 6 culling planes of the rendering Camera and the culling planes of the Light?

Edit: Looks like the cullingPlanesCount must be 6, so that is out. Which raises the question, what is the point of this being publicly modifiable?
Assertion failed: Assertion failed on expression: 'params.cullingPlaneCount == kPlaneFrustumNum'

Does anyone at Unity have any input for this? It seems extremely valuable to have the ability to further filter the CullResults.visibleRenderers in addition to what is available in FilterRendererSettings.

bump as would also like to know

Just in case this helps, here is an image visualizing the issue:

I’m visualizing this in 2D for simplicity.

In Yellow is a Camera’s frustum and in Blue a Light’s frustum. Let’s assume it is a Spot Light for the sake of argument.

Ideally I would like to receive the volume in Red, which is the intersection volume of both the Light and Camera. Understandably, in 3 dimensions there should be the possibility of >6 derived bounding planes to describe the intersection volume.

Currently, I’m working on solving for the volume in Green, which can be derived by adjusting the current frustum to fit as tightly as possible. This is obviously going to generate a lot of false positives which isn’t ideal, but it will garauntee exactly 6 planes to describe a square pyramidal frustum. Hopefully the culling code plays nicely with oblique frusta.

Any assistance would be greatly appreciated.

1 Like