How to make material fade-out

(RayVelcoro) #1

Hi all,

I’ve got a camera moving thru a tube, I would like the material of the guiding wireframe to fade-out just before it reaches the camera. I come close with the help of the Camera Data node but it cuts the material to transparant very abrupt. I would like to see a nice fade there, can anyone help me with a proper node setup to accomplish this?

Please have a look at the file;

material.blend (2.09 MB)

thx a lot!

(JA12) #2

Greater than gives a binary output. Using a color ramp should work better

(RayVelcoro) #3

Thx, I had a color ramp after the greater than node, obv that didn’t work. Now I got it right, ty JA.

(Secrop) #4

I would put the ‘divide’ node before the ‘ColorRamp’… The ZDepth value can be bigger than 1, but the colorramp only uses input values from 0 to 1, so some scaling (multiplying/dividing) might be needed.

Putting the ‘divide’ node in front of the ramp, just makes the ramp colors to be 20 times smaller, and the white color from the ramp (a value of 1) will end up in the ‘tubecontrol’ as a value of 0,05. (unless you really want to make the second shader dimmer, but you could also set the second colorstop to something darker than white)

(RayVelcoro) #5

Thx for the additional info, Secrop! Learned something here.