I want to mix 2 shaders in a way, that part of a mesh that is more far away from camera are using one of my shaders, and part of the mesh that is closer to my shaders is using another shader, with soft transition between them.

Thank you.


1 Answer 1


enter image description here

Set up the nodes as pictured below. Add Camera Data node (Add [Shift+A]-->Input-->Camera Data), then Math Node (Add-->Converter-->Math). Optionaly you may add the Color Ramp node (Add-->Converter-->Color Ramp). enter image description here

With the Math Node set to Substract try to experiment with its value (the closer to the object camera is the lower value should be). enter image description here enter image description here

Use Color Ramp node to make the transition between colours/ textures soft or sharp. enter image description here

enter image description here

Edit: For smoother transitions you can use other math nodes in combination. For instance put a logarithm node between the Camera Data Node and Subtract node. Change the color ramp to Cardinal and also change the direction of the ramp. Set the bottom value of the Logarithm to 15.0 and the bottom value of the Subtract to .250. Subtract becomes an offset of sorts.

  • $\begingroup$ Thank you, it works. Is there a way to make transition more smooth? I'm using color ramp node, but i want even smoother transition. $\endgroup$ Commented Mar 25, 2015 at 11:19
  • $\begingroup$ Try to connect the Math (Substract) node directly to the Fac of Mix Shader (delete the Color Ramp node). You may also try to change the mode of the Color Ramp node from Ease to Linear or Cardinal. Hope it'll help you. $\endgroup$
    – Paul Gonet
    Commented Mar 25, 2015 at 12:00

You must log in to answer this question.

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