Custom Culling using the Scriptable Render Pipeline

Hey! I’m working on a project that needs some unique culling that’s hard to do simply with layers.
Especially useful would be the ability to only render objects from one scene at a time.

I’m excited by the new Scriptable Render Pipeline stuff and am looking into how I could customize what gets rendered using it.
I’ve had a look through the docs and this post:
https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki/SRP-Culling

And as I understand the ScriptableRenderContext uses a FilterResults struct representing what’s going to be rendered.
This is generated by CullResults.Cull() which takes a ScriptableCullingParameters.
However I’m not sure how I can customize this to cull specific game objects or all objects from a scene.

It is or will it be possible to modify FilterResults yourself? Like add / remove Renderers from it?
Or is there any documentation or advice on how ScriptableCullingParameters class works, particularly with its sceneMask?

3 Likes

Hi, may be this could help somehow

I would also like more access to the Culling methods for custom culling. My use case would be to not perform culling as I already know all the objects are in the camera field of view. I would like to reclaim those precious milliseconds lost to the culling step.

6 Likes

I have a similar issue as the original poster. We have separate hierarchies of gameplay areas and need a way to hide them from the camera and listener. Basically we need independent worlds/scenes but we’re still connecting them with OffMesh links. The objects in the separate areas still need updating, so we can’t simply deactivate the root node.

Something similar to the sceneMask sounded promising but there hasn’t been any update on it.

I’m curious if anyone has come up with a solution to this problem? We still haven’t found a decent way to cull out visible or audible objects. Is there some way to set the camera and listener to only cull objects in the scene that it is in?

Bump?

I’d find this useful too.

It would be good if I could cull within another CullingResults, because I’m rendering multiple slices of a frustum and every slice is contained within the full frustum, which I already have CullingResults for.

Also, being able to prevent culling from updating CullingGroups would be very useful, because currently I create a dummy camera that I get the ScriptableCullingParameters from to use when culling the slices, because my CullingGroups should only update based on the full frustum.

And I would like to remove lights from culling since it is buggy in unity.
Any idea how could I do this ?

Hey All,
I’m looking into doing some custom culling in URP as well. Nothing crazy but I would like to be able to manually specify a subset of the total scene before the filtering and culling (locked areas of the scene don’t need to be in the calculation etc.) Umbra culling is already working decently well but sometimes locked meshes still render incorrectly.
Any ideas how to achieve this?

EDIT: It looks like the Rendering Layer Mask in the additional settings of renderers looks promising

It would be extremely powerful to be able to override or “stack on top of” the core culling. This would make custom occlusion culling solutions MUCH easier to implement, and other features as well. Being able to inject before the c++ culler, after the c++ culler, or replace the c++ culler entirely (which yes, would be slower in C# if copied exactly, but it allows us to in theory make it still faster if we have our own use cases!)

8 Likes

Does anyone know if anything ever happened to allow custom culling? It would still be incredibly useful!

1 Like

I believe nothing has changed on that front

If anyone is curious, you can somewhat work around this by temporarily setting the renderingLayerMask on objects you wish to exclude from a render and use filteringSettings.renderingLayerMask

It would be nice to not have to do this, though.

1 Like

Guessing this is still not possible, eh? :confused: