2
$\begingroup$

In my specific scenario I need to align the roof texture to the individual roofes. I cannot align the roofes in the UV map because there are too many and its real word data.

Scenario

My thinking is that I can use the Geometry node and its Normal output to get information about the face orientation, I then just need to calculate the angle of each face, which I can plug into the Mapping node, resulting in the correct texture rotation for each roof face.

The formula for calculating the angle between two vectors (normals) is θ = cos-1 [ (a · b) / (|a| |b|) ] I tried to create this formula as a node with the Node Quick Maths extension and with Vector Math nodes. I also figured that I was only interested in the Z rotation, so I only needed X, Y (2D coordinates) in the calculation.

Node Setup (bottom: Node Quick Maths extension)

result not working

The outcome is not what I expected, there is rotation but the wrong rotation, which leads me to believe that either my math is wrong (which could very well be that I am not that well versed in math or Blender math nodes) or I need to approach this in a whole new direction.

What I would like to happen.

enter image description here

let me know if there are Qustions. Thanks a lot ...

$\endgroup$
0

1 Answer 1

6
$\begingroup$

You need to use Z to make this calculation (it's the only axis that does not change with the roof positions)

  • A cross from Z to Normal makes local X (fails for horizontal roofs, where normal = z)
  • A cross from Normal to local X makes local Y
  • A dot between Position and the local axis gives the local position

Important: The texture's "Projection" must be "Flat". This method is similar to UV unwrapping every single face. Any non-flat projection will create distortion.

enter image description here

enter image description here

$\endgroup$
4

You must log in to answer this question.

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