1
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ Do you have to necessarily use nodes? You may easily achieve it using drivers. $\endgroup$
    – Paul Gonet
    Commented Jun 26, 2016 at 12:48
  • $\begingroup$ @PaulGonet: Thanks for the idea... Now I have to learn about drivers :) $\endgroup$
    – OroNZ
    Commented Jun 26, 2016 at 21:47
  • $\begingroup$ Please check out my answer here: blender.stackexchange.com/questions/26064/… With the exact driver settings shown in my answer add a driver to Alpha slider in Blender Internal or to Fac slider of the Mix Shader (which mixes Diffuse BSDF with Transparent BSDF) value in Cycles. Happy blending man :). $\endgroup$
    – Paul Gonet
    Commented Jun 27, 2016 at 0:37

2 Answers 2

4
$\begingroup$

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.

enter image description here

if the cube moves :

enter image description here

If the empty moves :

enter image description here

$\endgroup$
3
  • $\begingroup$ You can use only 1 Separate XYZ and use the outputs from it. $\endgroup$ Commented Jun 26, 2016 at 13:35
  • $\begingroup$ @Unix. Sure... you are right !! $\endgroup$
    – lemon
    Commented Jun 26, 2016 at 13:38
  • $\begingroup$ Nailed it :) Manipulating Math nodes still fills me with fear. I really appreciate the help - Thanks! $\endgroup$
    – OroNZ
    Commented Jun 26, 2016 at 21:50
1
$\begingroup$

the result can only be seen in rendered view, but this kinda works.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .