2
$\begingroup$

I want to add snow to a mesh, so I need to add the second texture based on the global z of the scene, i .e . it should only cover the top of the object. How can this be done? Is it possible to say "if this normal is along the z axis add this texture?"

$\endgroup$
3
$\begingroup$

The Normal link in a Geometry node is dedicated for this purpose:

In the Node Editor, add the Geometry node, link the Normal to a Separate XYZ node, then use the Z link for a factor in a mix node. In my example I added a Color Ramp node to control This factor, check the image below for the nodes setup, and the Gif to see how you can use the Color Ramp node to control the effect.

enter image description here

enter image description here

$\endgroup$
1
$\begingroup$

You can do that using a cross product with the Z axis.

Add a texture coordinates input node and drive its "Normal" output (1 in the picture) to a vector math set on "cross product", with these parameters : enter image description here

The cross product of (0, 0, 1) and (0, 0, 1) is null. So the output (2) can drive a mix shader between the snow (horizontal part) and the walls (non horizontal parts).

enter image description here

Edit

If the object has smooth shading, the result is different. To handle this, I added this "greater than" comparison.

enter image description here

But you can also take the "true normal" input to restablish the situation : enter image description here

$\endgroup$
0
$\begingroup$

The best way to do this is by using "UV Project" Modifier. It allows you to control the texture orientation based on the camera.

Try this link for details

http://usingudk.blogspot.com/2014/02/uv-projection-modifier-blenders-way-to.html

$\endgroup$
  • 3
    $\begingroup$ Using external link as an answer is not preferable, since the post owner might remove the link, the answer will be obsolete. $\endgroup$ – Georges Jun 23 '16 at 11:36

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.