1
$\begingroup$

how can I apply 3 shaders by coordinates instead of unwrap UV?

for example, 3 shaders for top, bevel and side faces.

$\endgroup$
5
$\begingroup$

You could test the normal of the surface against (0,0,1) in Object Space.

Assuming 'Top' and 'Bottom' faces are normal to Z in object space..

enter image description here

  • .. take the absolute dot product of the shading point normal (given in World Space, so converted to Object Space,) with (0,0,1).
  • Use ranges of that value as factors in the mixes between your shaders.

enter image description here

EDIT: This tree discriminates by the normal of the underlying geometry. If you want the interpolated (smooth) normal, use 'Normal' instead of 'True Normal' in the Geometry Node.

$\endgroup$
  • $\begingroup$ I've just finished my node setup, but you've been faster. Well done. $\endgroup$ – Robert Gützkow Nov 21 at 23:24
  • $\begingroup$ @RobertGützkow oops, sorry.. hate it when that happens :) $\endgroup$ – Robin Betts Nov 21 at 23:25
  • $\begingroup$ Thanks guys very much. $\endgroup$ – blackgun Nov 21 at 23:36
  • 2
    $\begingroup$ Just as clarification why this work for people unfamiliar with linear algebra. The dot product of two normals (vectors of magnitude one) is equivalent to the cosine of the angle between them. If the angle between the vectors is zero, the cosine is one. The closer the angle gets to 90° (pi/2 in radians) the cosine approaches zero. $\endgroup$ – Robert Gützkow Nov 21 at 23:43
  • 1
    $\begingroup$ I too just finished this one, albeit I took the scenic route by calculating the angle using pythagoras and then arctan-ing it. This is a far more elegant solution which I learned something from. Thanks :) $\endgroup$ – Moog Nov 22 at 0:56

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.