Search Unity

Question Replace main render pass in URP pipeline

Discussion in 'Universal Render Pipeline' started by iron_attorney, Nov 24, 2022.

  1. iron_attorney

    iron_attorney

    Joined:
    May 12, 2015
    Posts:
    5
    Is it possible to replace the main render pass in URP? By which I mean the pass that first draws objects in a scene to the view/screen texture before post effects passes.

    To clarify, I have a specific way I want objects to be rendered with custom spacial geometry that looks like it bends light. I could achieve the same effect by drawing the results of such an algorithm to a texture and having that texture rendered as the view/screen texture using the ScriptableRenderPass/ScriptableRendererFeature components, but I'm wondering if I can cut out the middle man and just straight rewrite the actual main render pass that draws the objects in the scene.

    I have so far written post effects using the ScriptableRenderPass/ScriptableRendererFeature components, and I have accessed things like the depth buffer as part of that... But this doesn't give me access to the actual objects in the scene to calculate where the bent light rays land in the scene, which is what I really need. While I could do what I have suggested above, I wonder if that would mean the scene still get's rendered normally before I totally rewrite the texture with my custom algorithm.
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,058
    You can customize URP to whatever you like or create your own SRP.
    I'm not sure how but definitely should be possible
     
    iron_attorney likes this.
  3. iron_attorney

    iron_attorney

    Joined:
    May 12, 2015
    Posts:
    5
    Sounds promising. To try to clarify further though, just incase, I'm looking to customise the stage that calls all the shaders on the objects in the scene. I don't just want to add a post effect to the texture that results from the render, I want to override that render stage altogether. Is that stage also customisable? Or is that stage hard wired into the GPU reasons?
     
  4. iron_attorney

    iron_attorney

    Joined:
    May 12, 2015
    Posts:
    5
    If I set a ScriptableRenderPass to "Before rendering", will that stop that override the usual rendering of the scene?
     
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,058
    I think it's just an extra pass inserted at that moment