- Home /
Toony Lighted shader only partially affected by light
The default "toony-lighted" shader in Unity is great, but the problem is that objects are either entirely affected by the light, or not affected at all when they are not in the light's direct area.
Is there any way to make it so the object is gradually affected more and more by the light as it moves toward the source, rather than being an on/off type of thing? I don't know too much about writing shaders, I tried switching some of the light modes but that doesn't help.
EDIT: Apparently the toony lighting shader has been re-written in Unity 3.0, and this is no longer an issue. Kudos to the Unity team!
Answer by sean · May 12, 2010 at 02:29 PM
What a toon light shader does is basically take the normal illuminated brightness/color of an object and set a threshold (plus any fancy edge-detection / outlining). Where you'd normally get a smooth gradient, if the gradient is below a certain level, it's shaded flat-dim, above it's shaded flat-bright. It's possible to write a toon shader that has multiple thresholds/levels, you can possibly google for one in Cg and try to patch it into your own shader, possibly based on the stock toon shader. Likewise, you may be able to set how dim your dims are and how bright your brights are as some function of total illumination rather than fixed values. I know the ShaderLab/Cg/ATI source for all the stock shaders is available somewhere on the Unity site, but I didn't bookmark the location after grabbing them.