Shade Bottom of Object


I would like to apply a texture to an object such that it fades as it gets closer to the top of the mesh and is most opaque at the bottom of the mesh.

I was wondering if there was any way to do this in the node editor, perhaps using some kind of info from UV positions? This would be in Cycles for Blender 2.66


Yes, you can. :wink:

The blend file: Forum Fade.blend (91.2 KB)

What you see is 2 cylinders fading away along the Z axis. If you need me to explain the how, the why, the when, just ask…

Much much much appreciated :slight_smile:

i would like to know the how, the why, and the when please! XD

just by using my eyes im guessing somehow u can get the z coordinate from the object? idk how blue in RGB is the Z, but ok, not sure what the math node is for, maybe to make the number alittle larger since ur adding with 0.5?, maybe increasing this number will make the opacity more? :confused: i never understood the color ramp, and then this is fed into the mix shaders factor which defines where to put the different shaders! this is actually an awesome material!


I’ve been wondering how to do this myself. Thanks much for the nodes and the explanation!

Is it possible to do this in the compositor as well, or does it have to be a material?

Since the 1st node used here provides object’s coordinates and the compositor knows nothing about objects, it’s safe to say that it will work only for a material. :wink: Besides, don’t forget that such a material, especially with transparency, will affect the shadows. I won’t say that it’s 100% impossible to produce a similar effect in the compositor but it would be really really really tricky…

Thanks so much for taking the time for the explanation! :slight_smile: but I’m not too sure I understand fully about the color ramp.

Ill try to explain it how I understand it currently in my head, lemme know how off I am XD

so the factor input is basically 0-1, blender then takes this value and matches this up with a color range (specified by you, say maybe red to yellow, or red to transparent), this is then spat out the other side as a color, so if u have a color ramp going from red to yellow, and u have the number 0, going in, it would be red, 0.5 would be orange, and 1 would be yellow. And because you can control and customize the ramp you can map different parts of 0-1 to it…

i have one question, doe the factor only take in a 0-1 value? What happens then the number exceed this range? And also is this the reason you used the math node to make the coordinate 0-1 instead of -0.5-0.5?

thanks again XD

Values outside of the 0-1 range are clamped. Anything below zero becomes zero and everything above 1 becomes 1… So, yes, that’s why I use the math node to remap the object coordinates.

And you understood well the color ramp. My explanation wasn’t so bogus after all… :wink:

Awesome! Thank you so much!