Deferred rendering and non-standard lighting

To quote from Unity - Manual: Deferred Shading rendering path
“The only lighting model available is Standard. If a different model is wanted you can modify the lighting pass shader…”

What does this mean when using legacy shaders in your deferred scene materials (using Lambert or blinn-Phong shading only)?
Will there be visual problems (not seen any obvious ones) or it will just do some unnecessary calculations to handle the extra data that might have come from a standard-shader material?

The standard shading model is applied instead of the older ones, but as far as I know, other than an odd halo around the object sometimes, it makes no real difference. (I would have to test this though)

And the older legacy deferred lighting will still work if you need it. :slight_smile:

If you use a shader that isn’t using the standard lighting model they get rendered as a forward pass after any standard shaders get rendered as deferred. Basically if you don’t plan on using the standard shader or using it very infrequently there is no reason to use deferred rendering as everything will be forward rendered anyway but you’ll be paying the extra cost of storing and lighting the mostly empty gbuffers.

If you want to use deferred rendering with another lighting model you can, you just need replace the various shaders used in the deferred pipeline.

Oh really? - that’s important info. It seems to work with legacy shaders with a lot of lights but on more basic hardware the shadows degrade or disappear. Is there any docs or shader code to look at that shows how legacy shaders are rendered in deferred?

The frame debugger is your friend here. You can use it to get an idea of what does, and doesn’t get rendered as deferred or forward when using the new standard deferred rendering path or the legacy deferred path. The other way is you can check is by downloading the shader source and looking at which shaders only have forward passes, which have deferred passes (hint: just standard), and which have “Prepass” passes. This page has a list of the various light mode pass types and what uses them:

1 Like

thanks

Ah this is key - legacy surface surf Lambert/BlinnPhong shaders work with the new deferred (and do not get rendered as forward) however the lighting does look bad - near side-on surfaces are much brighter than they should be.

Well a warning when mixing legacy and new deferred would be nice but it kinda makes sense - I guess what should be made more clear is:
Use old deferred if no standard shaders
New one with just standard shaders for lighting ideally (not old surface lighting models)

The legacy surface shaders get naively turned into standard shaders when using deferred, which is why they look different. Lambert is just a standard shader with smoothness 0, specular 0, 0, 0, and BlinnPhong just copies the specular color and “shininess” straight even though they are not analogous.

Yes, but then there’s the odd brightness issue @andyz got when switching… :smile: I got it as well, but the low light of the scene I tested it in reduced it somewhat.