1
$\begingroup$

Title says it all: I'm trying to rotate multiple faces (on Z axis) in a way to make them all face the same XY direction with Geometry Nodes. I tried this. But for some reason it's not working. The 4 faces on the left is the starting geometry and the 3 faces on the right is the result of the geonode tree. enter image description here

Unlike Geometry Nodes - Billboards (similar to track to constraint), this question is not about instances. It's about mesh faces.

The main problem here is that you can't rotate a single face, like you could for example, scale it with the Scale Elements node, so you need to find a common field for each vertex of each face and use that for rotating a face.

I thought the Normal field would do the trick but the behavior is not as expected and I can't figure out why.

--------- EDIT ----------

Robin Betts's answer bellow is definetly a solution if you don't mind about the rotation of the faces along the axis you choose as the axis the faces face. And this solution gives me this result enter image description here

but I was going for something like this

enter image description here

so I wanted to rotate these faces around the z axis in a way so that they all face in the direction of the (1,0,0) vector. The center of rotation in my case is not important.

$\endgroup$
7
  • $\begingroup$ Sorry for voting to close, obviously the hard part is already solved. There are two differences between faces and instances: 1) instances start with the same, known, orientation, so you just need to calculate the euler and rotate them. Here you start with various orientations, so "Align Euler" to normal (and $z$), and pass that rotation to the "Align Euler: Rotation" input; 2) There's "Scale Elements" node, but no "Rotate Elements", so you need to move vertices using "Vector Rotate", specifying face center as the rotation center (and then "Set Position" node). $\endgroup$ Sep 21, 2023 at 8:13
  • $\begingroup$ Also are the faces triangulated? Based on ugly UV triangulation I think not. Can the faces sometimes be connected? What then, just split them or rotated them together? I think @RobinBetts is on this, because he marked his presence, if not I'll give it a go later in the day. $\endgroup$ Sep 21, 2023 at 8:18
  • 1
    $\begingroup$ @MarkusvonBroady .. I didn't mean to pull the ol' reopen-and-answer trick :) .. I've only gone for the simplest case. $\endgroup$
    – Robin Betts
    Sep 21, 2023 at 8:28
  • $\begingroup$ Hi, @VicMarco, if we're going to align your (possibly all different) faces to 'up', they have to carry some definition of what 'up' is, for them, in the first place. So you'll have to include some definition of that, or, some narrowing of the cases covered. $\endgroup$
    – Robin Betts
    Sep 21, 2023 at 9:35
  • $\begingroup$ @RobinBetts, sorry, but I don't understand what you mean. At least 'up' should be easy to define. For all faces it's always the 0,0,1 vector. But for me the real problem is why my original solution doesnt work. Can you look at my simple solution in the first pic of this post, please? This arcsine math node should give the exact angle between the x axis and the normal of each face. It does this when I inspect this field but when I plug it in the vector rotate node, it gives a totally different result $\endgroup$
    – Vic Marco
    Sep 21, 2023 at 10:20

2 Answers 2

2
$\begingroup$

Ok, I think I figured it out. Actually the solution I originally posted in the question (first pic) is working, but only for faces with positive Y component of the normal vector which is totally logical but I missed it somehow. So first you need to flip all faces with negative y normal. And then use the original solution. Here is the full tree with the result in the viewport.

enter image description here

$\endgroup$
1
1
$\begingroup$

Two stages of Align Euler to Vector will do it..

  • Establish the centers of rotation by capturing the position of faces, and capture the Normals on faces, too.
  • Find the rotation that will align Z to the Normals and rotate points about the captured centers by its inverse
  • Now all your faces are facing object-Z.. Rotate Z to the desired direction

enter image description here

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks Robin, this is the right answer for what I asked, but it's not actually what I was going for :) I should have reformulated the question better. I'll post some more pictures in the next post, please taka a look at it. Thanks $\endgroup$
    – Vic Marco
    Sep 21, 2023 at 8:58
  • $\begingroup$ @VicMarco Fine if the next post really is distinct from this one.. otherwise, maybe edit this one. I don't mind deleting my answer, if it's not relevant. $\endgroup$
    – Robin Betts
    Sep 21, 2023 at 9:03
  • 1
    $\begingroup$ No, I'll edit this one, no worries. And you're answer is still relevant, I just need to add one thing :) $\endgroup$
    – Vic Marco
    Sep 21, 2023 at 9:13

You must log in to answer this question.

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