I am trying to render D20 created only with geometry nodes. It works but I would like to render every side of the dice pointing directly at the camera. To do this I rotated the geometry so that the normal of the face I want is aligned with the z-axis. Now however I cannot figure out how to rotate the geometry so that one of the edges of the face (tangent) is aligned with either x or y axis. My every attempt with vector math and "align euler" results in rotation by more than just the z axis. Is there an easy way to automatically align an edge (like the one marked in red) to either x or y axis? Here is a simplified node structure of my d20 dice. Starting geometry is just an icosphere with one subdivision:
-
$\begingroup$ just a small hint: providing a blend file will attract more people.. $\endgroup$– ChrisCommented Aug 19, 2023 at 18:05
-
$\begingroup$ fist off all: remove the fist two sample index nodes from the "tangent" frame and just use the corners of face index directly. also test the second two (sample index) to face corner. this will actually give you the vector you wanted $\endgroup$– shmuelCommented Aug 20, 2023 at 3:33
1 Answer
Mark a single face corner for each face, then align not only to a normal of a chosen face, but also to the direction from that face('s center) to the chosen face corner. You could do so using the "corner of face" using the selection as weight, or using a pre-topology-nodes-trick: if you multiply each position by the selection, non-selected corners will have a position of 0. Since the interpolation of face-corner→face is just an average $a+b+c\over 3$, it becomes ${x+0+0\over 3} = {x \over 3}$, so all you need to do is to multiply it by $3$ to get the original position of the selected corner after interpolation to the face domain.
-
$\begingroup$ Exactly what I needed. Thank you so much)!) $\endgroup$– seeebekCommented Aug 20, 2023 at 9:42