I would like to know if there's a way to generate UV coordinates, perhaps by transforming them into the X,Y plane, using geometry nodes without relying on the "UV Unwrap" node. I'm facing an issue where the "UV Unwrap" node alters the projection whenever the geometry changes, and I'm struggling to manage individual UVs to prevent them from moving and rotating.
-
1$\begingroup$ Of course you can - simply disconnect the link to "Store Named Attribute: Value", and connect something else there. What is "something else"? Vector Math nodes, calculating the UV positions based on indices, or 3D positions, or whatever arbitrary method you decide to use. $\endgroup$– Markus von BroadyCommented Nov 18, 2023 at 19:55
-
$\begingroup$ Yes exactly I am looking for that "something else". I cannot figured some generic method to calculate UV position. Something like "box mapping" in GN. $\endgroup$– DestrosvetCommented Nov 20, 2023 at 9:27
-
$\begingroup$ Maybe what you're really asking is: how to align all UV unwrappings in a particular way - the particular way here being that a specific (top in the example) face should remain visually constant. You would achieve that by reading how far away is the center of the face in UV space from some base geometry, then offset entire UV to realign, and do similar stuff for rotation and scale. $\endgroup$– Markus von BroadyCommented Nov 20, 2023 at 12:55
2 Answers
I think you want to get "simple solution" that doesn't exist.
In order to get UV map, you have to use vertex coordinates, normals and some logic to convert 3D coordinates into 2D. This logic is not presented in default set of nodes, so you have to make it by your own.
This is an example how you can implement "box mapping" in Geometry Nodes:
-
$\begingroup$ Thank you! This is kind of generic solution I was looking for. $\endgroup$ Commented Nov 24, 2023 at 17:22
A workaround to prevent the UV Unwrap result to change when deforming is to sample the UV from the static version of the mesh, which you have at some point in your node tree if you are deforming it:
-
$\begingroup$ Thank you, this solution works for this particular case, but I did it just for example. Some shapes are more complex so I am looking for some generic solution. $\endgroup$ Commented Nov 20, 2023 at 9:25
-
$\begingroup$ @Destrosvet It should work if you sample the uv from the original mesh to the deformed, can you give details about the mesh and the deformation process? $\endgroup$– HulifierCommented Nov 20, 2023 at 13:12
-
$\begingroup$ @Destrosvet this of course only works if what you're doing is really only a deformation (only moving the vertices, without changing the number of faces, edges, vertices or corners or their indices) $\endgroup$– HulifierCommented Nov 20, 2023 at 13:15
-
$\begingroup$ Thank you for your solution, but my objects are made of different parts (few primitives) with boolean.. etc. If you changing parameters number of vertices and indices are changing as well. $\endgroup$ Commented Nov 20, 2023 at 14:42