Does anyone know how to apply a texture in Cycles that only effects the faces of a mesh that are facing upwards (ie in the global Z direction within an angular tolerance)?

This would be very useful for snow, frost, dirt or dust.

I've done some experiments using the Tangent node but the results are not ideal.

I believe Maya has a snow texture that produces this type of result.

  • 2
    $\begingroup$ You should accept this answer if it was helpful, and don't confuse your accounts. $\endgroup$ – stacker Nov 8 '13 at 22:35

Use this node setup for your material:

Material nodes

The dot product of the face normal with vector (0, 0, 1) is 0 when the face normal is orthogonal (= horizontal) and maximal when equal. When pointing downwards the dot product is negative.

With the color ramp you can control the angular tolerance. If you don't want to have a smooth transition between texture and green you can move white handle to the black one.

This is used as the factor of a Mix Shader mixing the texture with a green diffuse material.

Result: Render result


Great answer from Maccesch, helped me a lot, thanks. Alternatively, you can use the greater than operator if you want a hard separation. In the example below, only faces that are facing (i.e. their normal has same direction as) the x-axis:

example using greater than


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.