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!

more ▼

asked May 12, 2010 at 05:33 AM

avatar image

2.3k 63 61 89

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 12, 2010 at 02:29 PM

avatar image

326 30 25 32

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: May 12, 2010 at 05:33 AM

Seen: 2373 times

Last Updated: Jun 30, 2010 at 04:56 AM