1
$\begingroup$

I know that one can use a Gradient texture and Texture Coordinates node to fade an object out the farther it is away it is along an axis. They can even use a Mapping or Separate XYZ node to change the direction of the fade.

However

Using a Mapping node can be tedious, especially in an animation. I was wondering if it was possible to fade an object out away from the camera direction via a straight up Vector/Input node output or a combination of Vector/Input nodes.

$\endgroup$
2
$\begingroup$

You could use camera distance instead, that way it dynamically adjusts transparency relative to camera position dynamically.

Just use the Input > Camera Data node instead. Some math nodes to adjst the factor may be needed.

Camera Data Node

$\endgroup$
  • $\begingroup$ I had seen the Camera Data node, but I couldn't get it to work. Thanks! Also, how does that Divide node affect things? What is it dividing? Lastly, I tried replacing the Ambient Occlusion node with a Diffuse BSDF, but the results weren't as good. Why would Ambient Occlusion work better? $\endgroup$ – Shady Puck May 28 '16 at 22:51
  • $\begingroup$ The math node is dividing the actual distance from the camera to the object in Blender Scene units. You'll have to adjust it according to your scene's size and desired threshold distance. Replacing the ambient occlusion with any other shader should have no effect on the setup whatsoever, I just used the ambient occlusion because it is fast to render and requires no lighting, making it simpler to post here $\endgroup$ – Duarte Farrajota Ramos May 28 '16 at 23:11
  • 1
    $\begingroup$ related: Using the Camera Data Node $\endgroup$ – cegaton May 29 '16 at 1:35
0
$\begingroup$

The aforementioned one way that I figured out produced a result like this. By default, it aligned the vector with the center of the camera's view.

View 1:

enter image description here

View 2:

enter image description here

View 3, with later-mentioned Mapping node modifications:

enter image description here

Node setup:

enter image description here

The Fac: vector setup works by utilizing the Texture Coordinate node's Object output. I obviously selected the camera as the object. I then used a Mapping node because the Z-rotation was off. The divide can be moved up and down by adjusting the Mapping node's Location: values. I found X: to be particularly effective.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.