Search Unity

Remove specific objects in ScriptableRenderContext.Cull

Discussion in 'High Definition Render Pipeline' started by rvkennedy, Oct 1, 2020.

  1. rvkennedy

    rvkennedy

    Joined:
    Mar 27, 2014
    Posts:
    127
    I would like to remove specific objects, stored in a list, from the rendering of certain cameras.
    I had expected that CullingResults would contain a list of the GameObjects or Renderers to be drawn in DrawRenderers, but it does not. Nor does CullingGroup seem to allow this.

    Is there any way to modify the list of what DrawRenderers renders without globally making objects invisible?
     
  2. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
  3. rvkennedy

    rvkennedy

    Joined:
    Mar 27, 2014
    Posts:
    127
    Hi Seb, thanks for this, it should do for a workaround as long as I can find enough layers that aren't in use. I hope long term more of the SRP will be opened up to allow non-standard use-cases.
     
  4. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    You can use renderingLayerMask instead of common layers.
     
    rvkennedy likes this.
  5. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    In HDRP you can't as we use rendering layer mask to store decal and light layers and the others will be used for other purpose (but it is true that you can hijack it if you don't used those feature).
     
  6. rvkennedy

    rvkennedy

    Joined:
    Mar 27, 2014
    Posts:
    127
    Last edited: Oct 20, 2020
  7. rvkennedy

    rvkennedy

    Joined:
    Mar 27, 2014
    Posts:
    127
    @SebLagarde CanvasRenderer seems to be missing the value renderingLayerMask that is present in Renderer. The filterer does apply to CanvasRenderers though - its mask seems to be hardcoded to 0x7, is this correct?