Color ramps and glass material nodes in Blender Cycles

Hi. I want to create a glass material that fades from dark grey at the top to very light grey at the bottom - a bit like a pair of sunglasses.

How would I go about setting up this as a set of material nodes for cycles? My first thoughts were to attempt attaching the ColorRamp node to the Glass BSDF shader node but I think there’s slightly more to it than that!

Any help appreciated.

The ramp is ok but you have to give it the info about the Z coordinate of your object, this could be a method:

Thank you! Just what I was looking for.

You’re welcome, then you can tag this as SOLVED i guess. Cheers

how do you relate the Z coord to the RGB value ?


I was a little confused by that myself. I replaced it with the Vector Mapping node. By changing the Z rotation I managed to achieve what I wanted. Just wasn’t sure how to go about it at first!

Red channel = x coordinates | Green channel = y coordinates | Blue channel = z coordinates. Bob, a mapping node indeed let you change rotation and stuff, probably your glasses didn’t work at first because you didn’t applied/reset their rotation (Ctrl+A)

Anyways, glad you achieved what you were looking for. Regards

Thanks for the clarification. Much appreciated.

i tried with a simple plane and set the Z rot to 120 and did not see much gradient !

and can this also work with Suzanne may be?


It worked for me with a Z rot value of 120 only because I had not remembered to apply the object’s rotation after I’d finished modelling. If you are trying to use it on plane then I imagine you would maybe need to change the y rot value to 90 degrees or something to get it to work.

i had a plane in front view and tried with Z but did not work i treid with Y and ut did began to work

but this angle is it the local angle i guess
we cannot see the difference between local and global angle in n panel for cycles
not certain why!