Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request Ability to limit camera rendering to a single hierarchy

Discussion in 'Universal Render Pipeline' started by Peeling, Mar 17, 2022.

  1. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    354
    Suggestion: add a "Limit Rendering To" field to Camera. If blank, that camera works just as it does now. If populated, it only gathers content for rendering from that object and its children.

    Layers are all well and good, but I'm forever running out of them and end up relying on offsetting bits of content thousands of units away so that only one camera picks them up.
     
  2. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    621
    If you need more layers (or rendering-specific layers), it looks like there's somewhat-hidden-away support for a 'rendering layer mask' in scriptable render pipelines:

    https://docs.unity3d.com/ScriptReference/Renderer-renderingLayerMask.html
    https://docs.unity3d.com/ScriptReference/Rendering.FilteringSettings.html

    Probably requires a custom render feature to make use of it (a slightly modified copy of DrawObjectsPass.cs from URP?), and these layers aren't exposed anywhere in the inspector.

    Haven't tried it out yet though, so can't guarantee it works entirely as expected...