URP Render Objects support for Rendering Layers

There was some movement on this here

Here is the last pull request I know of with any movement on this before it was shelved:

It seemed to have been shelved because the URP team was trying to figure out how to make it work with shadows and such.

I think it would be useful to have even if it didn’t work with lighting systems.

Using RenderObjects for an Occlusion Effect is a common example:

If we were allowed to specify Render Layer’s in the RenderObject’s pass then we could dedicate certain layers to be for certain effects.

For example, in my project RenderingLayer 25 could be for the Occlusion Effect. RenderingLayer 26 could be for Outline effect. RenderingLayer 27 could be for SomeOtherCoolEffect.

Now any MeshRenderer in the game can ‘opt in’ to be a part of any number of my effects! I just have to include it in the appropriate RenderingLayer. This is easy to control at runtime too. IE when the cursor hovers over an object, add RenderLayer 26 to its RenderingLayerMask and boom - outline effect around the item your cursor is hovering over…!

1 Like

Hey,

For 2022.2 we made improvement regarding RenderingLayers (There is really cool new changes Rendering Layers | Universal RP | 14.0.11).
Additionally, we started working on exposing RenderingLayers for renderer and render objects. We also considering backporting it until 2022.2.

1 Like

I don’t notice renderingLayerMask being exposed on RenderObjects in Unity 2022.3.15f1 LTS. Any updates?

I would love not to need to create my own custom render pass via code just to add a filter that using the renderingLayerMask.

1 Like

Were you able to find a solution to this?

Because I don’t even know how to add that renderingLayerMask filter. Also, RenderObjects ignores renderingLayerMask set on source renderer:(

UPD
So, strange behavior.
I wanted to make decals not render on player’s FirstPersonView objects that are drawn in RenderObjects feature.
What ends up working is to set proper renderingLayerMask on renderers and DecalProjectors. And to enable UseRenderingLayers on UniversalRenderPipelineAsset.

Interestingly, you don’t need to enable UserRenderingLayers on Decal feature.

My solution was just to create my own custom render pass instead of using RenderObject’s functionality. Much more boilerplate unfortunately.