#How to pass an arbitrary List of renderers to be rendered by "CommandBuffer.DrawRendererList()"

1 messages · Page 1 of 1 (latest)

magic saffron
#

So I'm in Unity 6 URP using the rendergraph API and i'd like to use CommandBuffer.DrawRendererList() to render a list of renderers injecting the stencil check in the extra properties block.
But I cant figure out how to render an arbitrary list of renderers using it, it only allows me to give it a renderListDesc which always renders all objects.
Is there any way to pass a specific list of renderers?
Or is there any alternative to render renderers using stencil without having to override the material?
Thanks in advance!

This is where I am using it if it helps:

                rasterGraphContext.cmd.ClearRenderTarget(backgroundColor: Color.red, clearColor: true, clearDepth: false);
                for (int i = 0; i < passExecuteData.rendererListHandles.Count; i++)
                    rasterGraphContext.cmd.DrawRendererList(passExecuteData.rendererListHandles[i]);
            });```
peak stream
#

The RendererListDesc has properties for layerMask and/or rendererLayerMask that you can use to filter which renderers CreateRendererList obtains.
(Or use the overload with RendererListParams & FilteringSettings, but same idea)
You also don't need an overrideMaterial. You can override stencil values directly via the stateBlock property. But either works.
https://docs.unity3d.com/ScriptReference/Rendering.RendererUtils.RendererListDesc.html

magic saffron