Search Unity

Question URP Deferred custom shader option

Discussion in 'Universal Render Pipeline' started by EvansNate, Oct 2, 2022.

  1. EvansNate

    EvansNate

    Joined:
    Sep 2, 2021
    Posts:
    7
    Hello, I started a new project with the URP since it now supports deferred as well and since I have to highly modify the deferred shading I was wondering how can I change from the default deferred shade to a custom one. In Built-in was under "ProjectSettings -> Graphics -> Deferred Custom Shader" but I can't manage to find that anymore.

    I'm using Unity 2021.3.11 URP.
     
  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    Hi, I think you need to modify the URP package.

    Go to "Project Folder\Library\PackageCache", and move "com.unity.render-pipelines.universal@version" to "Project Folder\Packages".​

    Different from Built-In, URP uses a technique called light stencil volume for deferred shading.
    URP-Deferred.png

    To know more about light stencil volume, see SIGGRAPH 2020 Introducing to URP's deferred shading.pdf.

    You can try editing URP's deferred shader to see if this can achieve your goals.

    URP deferred shader path:
    "Packages\com.unity.render-pipelines.universal\Shaders\Utils\StencilDeferred.shader"

    You may also need to modify the UniversalRenderer.cs (and other files) if need to fully customize URP's deferred shading .
     
    Last edited: Oct 2, 2022
  3. EvansNate

    EvansNate

    Joined:
    Sep 2, 2021
    Posts:
    7
    Hi, thanks for the reply :)
    Yeah I thought about moving the project as well but wanted to be sure if there would be a way to change it without having to change source stuff.. Tbh I really don't understand why they didn't put a field like the Built-In one. If you really wanted people to avoid changing stuff just put a warning or something but don't lock them out like this..
    Thanks a lot for the SIGGRAPH btw, I'll will read it asap!
     
  4. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    If possible, you may try using HDRP?

    HDRP actually exposes all these settings somewhere inside the package. (still need to move package, but no need to change code/ shaders)

    I remember that HDRP uses compute shader to generate a light list in deferred.

    It may be easier for you to apply custom deferred shading.
     
  5. EvansNate

    EvansNate

    Joined:
    Sep 2, 2021
    Posts:
    7
    I don't think I'll be using HDRP for this project to be honest.. Too many features that I do not need and I also have some script and shaders that I don't have time to adapt to HDRP (even thought it's still a SRP so some of them should work).

    I started to modify the gbuffer and the stencil deferred shader and right now it works as intended.
    No hate or something but I thought that this could be a cool version of URP however everytime I check a new version I always have the feeling of missing and incomplete features.
     
    OrcDev and wwWwwwW1 like this.