Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Acces to unity final pass shader (deferred)

Discussion in 'Shaders' started by larsbertram1, Jan 7, 2014.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,445
    hi there,

    does anybody know if we have access to the final pass shader (deferred lighting) which combines albedo, lighting and emission?
    and if so, how?

    thanks, lars
     
  2. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    I thought that was all in Internal-PrePassLighting.shader ?
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,445
    just like its name might indicate it only writes lighting and shadows but it does not combine albedo, lighting and emission.
     
  4. Dolkar

    Dolkar

    Joined:
    Jun 8, 2013
    Posts:
    576
    The final pass is a classic per object pass you define in a shader. To get it, simply read the compiled shader and find a pass named.. I think it was LightPass Final?
     
  5. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,356
    Yeah, Unity uses a lighting pre pass technique, which has everything rendered first into a G-buffer and then again reading from the L-buffer to determine final colour.
     
  6. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,520
    I find the shadow pipeline pretty confusing.
    I try to sort it out with AutoLight.cginc

    SHADOWS_NATIVE ???
    SHADOWS_OFF No shadows
    SHADOWS_SCREEN ???
    SHADOWS_DEPTH ???
    SHADOWS_CUBE Point light shadows
    SHADOWS_SOFT Spot light shadows

    Any ideas on what those ??? can be ?
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,445
    hi dolkar,

    thanks for the reply. i guess you are right. and it is called:
    Name "PREPASS"
    Tags { "LightMode" = "PrePassFinal" }
    from what i can see.
    well, i think i will have to get deeper into the actual rendering pipeline.

    lars
     
  8. BahamutGundam

    BahamutGundam

    Joined:
    Nov 4, 2012
    Posts:
    41
    Just want to share what I found. After looking at the compiled code, I found that

    SHADOWS_NATIVE seems to use shadow2DEXT to sample the shadow map, in which the calculation whether the current z is in front of the shadow map is done in the hardware directly.

    Meanwhile, SHADOWS_SCREEN seems to be the usual shadow map technique, using texture2DProj to sample the shadow map, and then compare the current z to the result in the code.

    I am talking from OpenGL point of view, but I think it should be similar for DX as well
     
unityunity