Search Unity

How do I write a normal decal shader using a newly added (Unity 5.2) "finalgbuffer" modifier?

Discussion in 'Shaders' started by bac9-flcl, Sep 22, 2015.

  1. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    do you mind to explain it to me what is the different between this shader and the current HDRP decal mesh?
     
  2. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Yeah, I'm curious how to implement something like a two-pass decal shader with per GBuffer target masking in Shader Graph.

    I'd like to know that too, I was not aware HDRP even had a mesh decal feature (its documentation is, uh, fairly lacking atm).
     
    vitamincpp likes this.
  3. vitamincpp

    vitamincpp

    Joined:
    Mar 21, 2018
    Posts:
    14
  4. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    @bac9-flcl
    Hi, I don't know if you are active yet on this forum but if yes, could you check your PM inbox?
    I've sent you a message.

    Thank in advance.
     
  5. Tracecat

    Tracecat

    Joined:
    Mar 20, 2014
    Posts:
    23
    @bac9-flcl
    Same request as marcatore. Please check your inbox ;-)
     
  6. flogelz

    flogelz

    Joined:
    Aug 10, 2018
    Posts:
    142
    Guys, I'm not sure but I think I maybe found the solution for the two pass problem with the smoothness! Not sure and I still have to test if this is working the way I intend it to and I'm kinda new to the whole blendmode syntax, but there are these lines in the blending docu:

    https://docs.unity3d.com/Manual/SL-Blend.html
    Additionally, you can set upper-rendertarget blending modes. When using multiple render target (MRT) rendering
    , the regular syntax above sets up the same blending modes for all render targets. The following syntax can set up different blending modes for individual render targets, where N is the render target index (0..7). This feature works on most modern APIs/GPUs (DX11/12, GLCore, Metal, PS4):

    • Blend N SrcFactor DstFactor
    • Blend N SrcFactor DstFactor, SrcFactorA DstFactorA
    • BlendOp N Op
    • BlendOp N OpColor, OpAlpha
    Which means we can set different blending modes for each gbuffer texture! I inserted a 0 after the Blend and the blending only affected the albedo gbuffer for example! Couldn't this solve the problem?? @bac9-flcl

    edit1: By allowing blending on all gbuffers except the smoothness one, I already have my total smoothness control back, eventhough with hard edges, but still. I have rather hard edged smothness while every thing else blends, than a second pass just for smoothness. I'm using this shader on my terrain to get blending in deferred done and rendering the terrain twice is no option-
     
    Last edited: Oct 27, 2019
  7. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Wow, it might just solve the problem! That's a great find!
     
  8. Teosis

    Teosis

    Joined:
    Jan 24, 2018
    Posts:
    22
    Hey guys, are there any news in regards to the ways of implementing the decal shader solution on the latest Unity versions?
    Could it be achieved via shader graph?
     
  9. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    As far as I know both projected and mesh decals are already supported in HDRP through the decal shader. I recall seeing examples of them in use a while ago, going back to projects like the FPS sample project.
     
    Teosis likes this.