Search Unity

ScriptableRenderPass.Execute and "RenderWithShader"

Discussion in 'Universal Render Pipeline' started by JakHussain, Sep 3, 2020.

  1. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    318
    I want to render the scene object UVs using a specific shader and Camera.RenderWithShader to write that result to a render texture but NOT actually change the image on screen. My intention is to use the results in the render texture as a property in a material in a subsequent render pass where I will create the final image.

    I get an error stating that recursive rendering is not supported in URP which makes sense but then how else am I supposed to achieve this?

    Here is a link to what I basically want to achieve using the old school "OnRenderImage" callback: https://github.com/khalladay/Pencil...etch/Assets/Scripts/PencilSketchPostEffect.cs

    I'm trying to do this the "URP" way with just one camera and multiple render features but now I'm just stumped due to lack of documentation and threads about Scriptable Render features.
     
  2. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    SRP api doesn't support "RenderWithShader"
     
  3. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    318
    I gathered as much. Do you have any suggestions on what I should do?
     
  4. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    318
    Anyone have any suggestions?

    Obviously this can be done without render features already, but I want to understand how this can be done purely with URP render features so that I don't have to manage the messiness of two different rendering APIs when making effects.
     
  5. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,383
    Not exactly sure if this is what you want but

    ScriptableRenderContext.DrawRenderers

    combined with

    DrawingSettings.overridematerial

    maybe?

    Code snippet