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

Question Unity Standard shader custom SSS deferred implementation

Discussion in 'Shaders' started by ChristinaPCatalyst, Apr 30, 2021.

  1. ChristinaPCatalyst

    ChristinaPCatalyst

    Joined:
    Nov 23, 2020
    Posts:
    8
    Hello!

    I am looking to implement a fast SSS shader based on Alan Zucconi's blogpost. It works great in forward rendering. However, I also need to make it work in deferred rendering. At first, I left the deferred function blank, so it would render in forward. The effect works, but the post-processing is not rendered on the shader in deferred.

    I found this thread about someone who made it work in 2016. Unfortunately, my knowledge of the standard shader is much more limited than the people involved in the conversation. So, I am not able to do the same, I will need more information.

    1. What if I wanted to render my forward pas and inject it later before the lighting? What should I use to do that?
    2. Which functions should I edit if I wanted to use the gbuffer normal.a channel in a custom way?
    3. Instead of implementing the effect for deferred, is there a better way to bring back the post-processing on my shader? (We are using deferred to be able to use SSR, screen space reflections).

    Thank you!
     
  2. ChristinaPCatalyst

    ChristinaPCatalyst

    Joined:
    Nov 23, 2020
    Posts:
    8
    So, I found the answer to one of my question: To make a custom deferred lighting, we need to edit Internal-DeferredShading.shader.
    Helpful thread link.

    Thank you Invertex :)
    I also tried to inject my object using a shader containing only my forward pass with a command buffer. I put it at CameraEvent.BeforeLighting. The whole object with SSS would indeed show up, but it still won't interact with post-processing. So it was no good. I guess that was not the correct approach for that.