« Anatomy Practice: The Scapula | Main | Anatomy Practice: The Pelvis »
October 25, 2004
Avoiding Ugly Color Falloff in 3D

A standard shader has a boring color falloff. Most painters, when rendering a surface which turns away from light, will identify (or invent) a reason to introduce a shift in the hue of a surface as it darkens. One way you can do this in 3D is to map a color ramp to light falloff.

A standard shader, in this case a cyan-colored Lambert shader, is usually implemented inside the renderer as a multiplication of a base color and a grayscale Lambert falloff.

When color fallos off in this way, it can go through muddy, dull midtones.

If you remap the falloff with a ramp, you can give it a richer look. For details on one way to do this, read on...

Start with a Surface Shader node.

Add a ramp. They default to V-ramps. Connect the output of the V-0ramp to the Out Color of the Surface Shader.

Add a Lambert to the V-Ramp. (Did you know you can do that?)

The Lambert falls off through shades of gray. That means the red, green, and blue channels of the output color of the Lambert are identical. Since they are identical, choose any channel you like (I chose the green channel in this case) and connect it to the V input of the UV coordinate input of the ramp.
(I chose the V input because the ramp defaults to a V-ramp. If I had changed it to a U-ramp, I would have used the U input.)

Here's a default ramp.

Here's a render of the objects using the default ramp.

Adjust a pleasing falloff into the ramp...

...and you'll achieve a pleasing falloff in the lighting of the rendered objects.
This kind of hue falloff is common in Renderman shaders. I don't see it done a lot in Maya shaders.
If you are uncomfortable using a Surface Shader as your final base shader, you can use other shaders that are more to your liking. I haven't done a lot of work chaining one shader into another as I did above; perhaps you have. If not, you might have fun experimenting along those lines.
Here's a related link:
Avoiding Ugly Grads in 2D
UPDATE 8/25/2005
Here's a much better way of doing the same thing:
Instead of using surface shaders, it creates Hue Falloff Directly in the Maya Light where one could argue it really belongs.
Posted by digital artform at October 25, 2004 10:58 PM
Comments
This is one of those things which I'm reluctant to say how long I've struggled with. And to think I've been using samplerInfo node enough to have found this on my own - and didn't. Thank you for posting this very handy bit of information.
Posted by: Chris at November 24, 2004 07:38 PM
I have a much improved version here now:
http://www.digitalartform.com/archives/2005/08/hue_falloff_in.html
Instead of building the color falloff into the surface shader, I build it into the light, where it really belongs.
Posted by: Joseph Francis at August 25, 2005 11:35 PM