Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  3. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question Customising the deferred pipeline

Discussion in '2021.2 Beta' started by hickv, Jul 12, 2021.

  1. hickv

    hickv

    Joined:
    Oct 31, 2018
    Posts:
    40
    Basically what I want is to read/write/blit to specific render textures/buffers of the pipeline. From what I know we can create new passes using Render Features, but can we modify or read from a pass ?

    1- Can I sample in a shader a render texture from the pipeline ? (e.g. the gbuffer color RT)
    2- Can I Blit() to a specific render texture of the pipeline ? (e.g. to the gbuffer color RT)
    3- There is no WorldPosition gbuffer RT right ? I am currently depth-reconstructing one but it is frame delayed due to depth-prepass not happening I guess ?
     
  2. hickv

    hickv

    Joined:
    Oct 31, 2018
    Posts:
    40
    Alright to answer one of my own questions - I managed to Blit() to a RT set by another Render Feature (Screen Space Shadows in this case) by just doing this:

    Code (CSharp):
    1.  
    2. public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
    3. {
    4.     int width = (int)(cameraTextureDescriptor.width * _settings.screenSizeFactor);
    5.     int height = (int)(cameraTextureDescriptor.height * _settings.screenSizeFactor);
    6.  
    7.     _tmpRTid = Shader.PropertyToID("_ContactShadowsRT");
    8.  
    9.     RenderTextureDescriptor rtd = new RenderTextureDescriptor(width, height, RenderTextureFormat.R8, 0, 0);
    10.  
    11.     cmd.GetTemporaryRT(_tmpRTid, rtd, FilterMode.Trilinear);
    12.     _contactShadowsRTid = new RenderTargetIdentifier(_tmpRTid);
    13.     _screenSpaceShadowsRTid = new RenderTargetIdentifier(Shader.PropertyToID("_ScreenSpaceShadowmapTexture"));
    14.  
    15.     ConfigureTarget(_contactShadowsRTid);
    16. }
    17.  
    and then in the Execute() I would just:

    Code (CSharp):
    1.  
    2. Blit(cmd, _contactShadowsRTid, _contactShadowsRTid, _settings.contactShadowsMaterial, 0);
    3. Blit(cmd, _contactShadowsRTid, _screenSpaceShadowsRTid);
    4.  
    *Only tested on Editor