Custom Lighting (Diffuse Wrap)

I would like to use the Diffuse Wrap lighting model (as shown as an example in the Docs - because when using 1 light source only it avoids half of every model (in shadow) looking very flat - it fakes subsurface scattering basically).

Anyway what is the easiest way for me to do this? I could modify the Lighting.cginc to add a lighting model as suggested in the docs - but I would still have to rewrite/duplicate all the basic shaders and modify the line in which they set the lighting model, would I not? And I would have to write an editor asset preprocessor to assign these new shaders in place of the standard diffuse shaders… Is it is really this troublesome or am I missing something?

I could simply modify the core LightingLambert function in the cginc file, but that would affect every project.
It would be nice if you could specify a lighting model on a scene or project basis wouldn’t it? Or modify the cginc for a project only.

Duplicating and modifying the basic shaders is probably your best bet. How many shaders do you plan on using?

Ok, well that bit is easy enough - a couple of solid and a couple of transparent shaders will cover most cases.
Making sure every model uses these shaders - harder - I’ll look at editor scripting!

Whatever you end up doing, consider AssetPostprocessor to set the right shaders after material generation on import, or at least turn off automatic material generation.

I have another problem - having tried a diffuse-wrap shader with the realtime shadows I would have to adjust the way the shadow shader works as it seems to just set a fixed value for all the object in shadow, whereas with a diffuse-wrap shader you want the shadow area to continue getting darker away from the light (so the shadow shader just sets a minimum light level, not a fixed value as it seems to be doing).

Anyone got this to work?