Hello,
I am working on creating a custom lighting model for a Surface Shader. I have several questions that are related to the order in which Surface Shaders are “executed”, as in when in the pipeline specific functions are called.
I understand that Unity 3.0 has deferred lighting (and to a lesser extent how it actually works), but is it always used?
For example, say I have a surface shader that has both forward and deferred lighting functions, are they both called for every light? Is only one called for each light (either deferred or forward)? Do they only get called if a light is light is actually lighting a particular pixel? Is this something that is determined or can be set dynamically, or is it more of a compile-time thing?
Next, where in the pipeline is the surf() function called for a surface shader (assuming it is called surf(), of course)? Is it after the forward lighting, but before deferred lighting?
I think what I am really looking for is a visual explanation/flow chart of the surface shader pipeline, so if anyone knows a good one and wouldn’t mind sharing it, I would appreciate it!