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

SH light information in the ForwardAdd pass?

Discussion in 'Shaders' started by tswalk, Apr 18, 2014.

  1. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    [edit]

    need to clarify this a bit... "with" lights disabled.

    I can access SH in ForwardBase, but not in ForwardAdd it seems unless I turn on a light, then all hell breaks loose.

    I'm thinking not after trying, looking at my compiled shaders and reading what I could find, but I just am going to ask this anyway.

    Is it possible to setup access to SH lighting information in the Forward Add pass? I have a clip operation (or discard) on a pixel in that pass that I do not want calculated while being able to retain the pixel information calculated in the Forward Base pass.

    This small discard could save me a lot of unnecessary processing that otherwise has to be done in the Forward Base pass and just leads to crappy frame rates (50% drop from one extra statement that looks like diffuse += specular; )
     
    Last edited: Apr 18, 2014
  2. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    I seem to do this a lot... comment to myself lol.

    I've scrapped this whole idea (especially the idea of using clips and/or discard)in a forwardadd pass, as from what I've read it is just bad mojo and doesn't help performance (?).

    I'm going back to incorporating the techniques presented by madfingers a while ago along with a pseudo RNM but instead of using texture LUTs, i'm using lightprobe data as a LUT... same kind of concept, but might be able to make some interesting LUTs that can be swapped on the fly (pre-built 3D probe cloud), changed programmatically, and controlled by an anchor override.

    I've learned a lot in the course of the past two weeks... before that I couldn't even tell you the difference between the vertex and fragment parts of a shader. The quirky optimizations though... wow what a f'd up mess that is to figure out. I really wish I had a single document with those, but instead I find tid-bits here and there...