The new features post for 2022.2 mentions URP Rendering Layers. Is this a new feature and if so, how do you access it?
I have been using Render Objects (part of Universal Renderer Data, in the Renderer Features section) for a similar effect up till now, but that seems to now be broken as of 2022.2 and still listed as experimental.
What is the correct approach to layer rendering now, then and how to set it up?
Anyone from Unity Technologies have any input on this? @
You can enable it in the Render Pipeline settings or Assets.
It is then Inspector-configurable for Renderers (as in, Components) related to the Lighting Layers, for Lights, and on the Renderers (as in, “Renderer Asset”, the things the Pipeline Assets and Cameras use).
It is basically an additional 32-Layer system on top of Unity’s standard layer system, but it’s not competing with Physics layers and has no predefined layers like “TransparentFX” etc.
PS: Wow I just realized how poor Unity’s naming choice for the new SRP Renderers was.
@Thygrrr Thanks, that helped me find the layers!
Now the question of getting it to work. I can add/delete layers in the settings, but how do you get different GameObjects, layers to render on separate Render Layers?
I looked through Project Settings, Inspector Camera and GameObject Settings, Layer Settings and couldn’t find any way for cameras, layers or GameObjects to be assigned to a Render Layer.
1 Like
I thought these are just lighting layers, so that you can receive/not receive lighting from lights assigned to that layer?
I don’t think so, @michalpiatek , that is not how they are described in the 2022.2 blog post, and if so, the name would be doubly confusing.
Nonetheless, I checked Inspector Light Settings just to make sure and there’s no way to assign lights to these layers either.
Still a mystery how these are supposed to be put to use.
1 Like
@pHghost , did you find it out how to work?
1 Like
There’s a discussion that might be relevant [here]( Separate Physics and Rendering layers page-2#post-8489972), but we’re similarly blocked and waiting for some answers from Unity.
It’s not exposed. Perhaps there’s a reason Unity has not done it? I’m not sure.
The DrawObjectsPass internally uses a FilteringSettings which accepts a renderingLayerMask. Here’s a diff to implement it, you’ll need to copy URP locally to your packages directory modify it and not have it overwritten.
Here’s a patch that adds it to the base renderer filter settings.
https://gist.github.com/rsw0x/621ff39caa9fd002d954e475467b5ea8
Similar changes can be done to expose it in the ‘Render Objects’ rendering feature. Here’s a gist with a patch that adds it to both the base rendering filter options and the ‘Render Objects’ rendering feature.
https://gist.github.com/rsw0x/0fbef12346c7a5e605605fb6c9bd9975
Something I noticed is the editor for the layer seems to have issues with selecting all layers and resets it to ‘None’ instead, so you’ll need to make an extra one and keep it deactivated.
Our use-case for this is for rendering objects with a stacked camera in front of other objects while preserving their layers for physics purposes.
1 Like
There’s new discussion and some comments from Unity in the linked thread above.