Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

URP/LWRP multipass rendering simple example needed

Discussion in 'Universal Render Pipeline' started by FrenzooInfo, Oct 24, 2019.

  1. FrenzooInfo

    FrenzooInfo

    Joined:
    May 2, 2014
    Posts:
    44
    Hi,
    Starting on URP/LWRP hence the inordinately beginner questions.
    Are there any simple examples of multipass rendering for URP/LWRP? Can someone point me towards it.?
    1.What I would like to do is something for the following.
    Algo 1:
    foreach pass
    foreach object
    Render object with pass

    Algo 2:
    foreach object
    foreach pass
    Render object with pass

    Is it possible with Scriptable Render pass to do algo 1?

    2. Is it possible for Scriptable Render pass to be camera dependent? or does it need to be tag dependent?

    Thanks

    Kevin
     
  2. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    226
    In regards to your second question:

    You can set up a ScriptableRenderer for a camera that doesn't render anything in the default forward pass, but only uses the assigned ScriptableRendererFeature / Passes. Have a look at these screenshots of my secondary camera that only does some RenderObjects passes.



     
    StaggartCreations likes this.
  3. Pimpace

    Pimpace

    Joined:
    Sep 21, 2017
    Posts:
    41
    And what effect exactly your setting does, @noio ? Can you show a screenshot please, or explanation?
     
  4. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    226
    My example was just to show how you can have a second camera render only specific objects with a specific pass (or material).

    I suggest you try to set it up and see if you can get close to the behaviour you're looking for.

    In my case I'm rendering some objects in a flat colour to a render texture, to get a kind of label mapping (clouds are black, blocks are red) of the scene, that I use for computing the game's victory condition. But that's probably not relevant to you.
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You do not require a separate camera to do this, the forward renderer asset (renderer features) default layer chooses what runs in the first pass and then the passes are set up as you like (stencil etc).

    Is there a reason you used another camera, such as different fov or?
     
  6. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    I'm also trying to setup camera stacking in 2019.3 and am not seeing any way to make this happen. I have another 3d object in my scene, that should be viewed using a different camera FOV (ortho), and I'd like to ensure that this camera render is always positioned in a specific location in the main camera view. I was able to easily achieve this in 2018, using Layers, but it seems that none of that works anymore. I've got 2 cameras in my scene, a main for the big actions, and another for a specific element that a user can control that has an impact on the larger scene. Think of the smaller object as a navigation tool for the larger scene. I've tried setting the URP Opaque Texture to true and then camera 2's renderer to overlay, but the overlay value does not appear, only Base.
     
  7. StarkeyBoy

    StarkeyBoy

    Joined:
    Aug 20, 2015
    Posts:
    1
    Upgrade your URP to 7.2.1 via the package manager. You're probably still on 7.1.8 and it wasn't available in that version. Once you upgrade you will get the option for overlay and camera stacking.