Search Unity

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:
    443
    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:
    642
    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...
     
  3. DerDicke

    DerDicke

    Joined:
    Jun 30, 2015
    Posts:
    292
    Enforcing this heavily. Possible use cases:
    - Dynamic Reflection Probes not searching 50k Meshes every frame for possible layer
    - Rendering Character faces to Render Targets for use in UI not searching 50k Meshes every frame for possible layer
    - any kind of map
    - most Rendertarget related rendering

    Anything dynamic really we can make a rule for making it not dynamic instead of letting renderer setup searching 50k meshes for the right 20 meshes we want to render.

    That is... if GameObjs are not cached somewhere internally sorted my layer... which I couldn't find any info for.
    But reducing layers is a reason in itself.
     
    Last edited: Oct 20, 2023