Fade a mesh out due to animated distance from Empty In Cycles I have a cube with a red diffuse material on it, parented somewhere inside a larger Empty (type 'cube'). The Empty can be re-positioned anywhere, moving the cube with it as you'd expect.

I want to animate the red cube – JUST the red cube, not the Empty – to 0,0,-2 BU relative to the Empty (the Empty's local space). As the cube moves, the red cube should fade to invisible.

The key point is: I need to make cube fade out due to the cube's movement from the Empty, not a deliberate keyframe animation in the node editor or compositor. The cube's transparency value is dependent on the distance from the Empty's origin.

I'm guessing the node to use is Object Info in materials, and somehow configure it so that -2 BU in the Z-axis means the red diffuse shader transitions to a transparent fader via Fac input. But I don't know how to manipulate Object Info's output. Any help?
The point is to be relative to the "empty" parent.

For that, use it as input in the texture coordinate node (left).

Then few calculations (simply the distance sqrt(xx+yy+z*z), modulated by the "2" input value), to drive the mix shader. If only the Z interests you, you can simplify that.



if the cube moves :



If the empty moves :