digitani opened this issue on Oct 13, 2013 · 47 posts
bagginsbill posted Sun, 10 November 2013 at 9:31 PM
The key to the toon effect is alteration of the diffuse response using the gain function.
http://www.gmlscripts.com/script/gain
I extend the gain function in my script with the definition of gain2. The traditional Perlin gain function increases or decreases the slope of the curve, while keeping the midpoint (x = .5) unchanged. The curve pivots around y = x = .5.
My gain2 version allows us to move that central pivot value to be anywhere we want, as well as to concentrate the gain effect in a smaller area, producing a tighter transition.
The pivot value is toonMid. The width of the altered transition is in toonSpread.
This is the heart of the shader:
d = Diffuse(1, .8).asNumber()
v = Gain2(d, toonMid, toonSpread)
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)