1
$\begingroup$

The issue I am working on is how to assign different materials to different faces of a mesh using UV Unwrap in geometry nodes. Being a greenhorn in this area I have struggled and still struggling but made some significant progress.

Big thanks to Johny Matthews for his YT tutorial on some aspects of UV Unwraping (link to his video below.

https://www.youtube.com/watch?v=wVhThuzRDIk&t=3s

Using his tutorial I have created a setup to UV Unwrap (using Geometry Nodes) a mesh and even to display visual representation of UV Map next to mesh which is a collosal help in alining material to UV map.

The picture below shows the mesh with material assigned and the UV map next to material which as I said is very helpful.

enter image description here

The node setup (in its work-in-progress stage) is shown below.

enter image description here

enter image description here

First screenshot shows the setup to create procedural UV Map and manipulate it. Second screenshot shows the setup to display the UV Map. The setup allows to show UM Map with material and as wireframe. And the UW Map as wireframe looks like this

enter image description here

The node setup in shader editor is quite typical

enter image description here

My question is related to UV Unwrap node itself. Right now the UV Map of the mesh is defined using seams selected on the basis of face area of two largest faces. The UV Map still contains all the faces, which is logical but UV Unwrap node has socket called "Selection" that according to Blender manual can be used to select "Faces to participate in the unwrap operation. UVs that are part of any other face will not be affected."

And here is my problem. What should I do in order to select only one face (or some faces). In other words what should I plug into that socket so my UV Map is restricted to only selected faces?

$\endgroup$
2
  • $\begingroup$ if you want the selection to be dynamic and based on the edit mode selection, that's not possible (example, selecting 1 face in edit mode and only have this one to automatically show up). However, you can use attributes: if you assign the selected faces to an attribute and use it as a selection on the set position node, only these faces will show up $\endgroup$
    – Alex
    Commented Oct 28 at 21:07
  • $\begingroup$ Let me clarify. As I said I am quite new in world of Blender so maybe my understanding of things is not perfect. However as I understand each face, edge and vertex can be selected programatically as all they have index and some attributes like position. What I want to achieve is to be able to select faces using index and plug such selection into UV Unwrap node. $\endgroup$
    – Jan Pips
    Commented Oct 28 at 21:48

2 Answers 2

5
$\begingroup$

The "selection" is an array of "booleans". (Which is falses and trues; or zeros and ones)

If you want face 0, then index 0 of the array is true. If you want face 1, then index 1 of the array is true.

So, basically the array has the size of the domain (number of faces), and all faces you want will be true in their respective positions in the array.

That said, there is an easy way to get selection by index which is using a Compare node set to Integer.

Example 1:

Select face of index 2:

Example 2:

Select the first 3 faces:

Example 3:

Select faces whose areas are below a certain limit:


You can also use Boolean Math nodes to make logical operations such as And, Or, etc.

And use Attribute Statistics nodes to make comparisons like "faces whose areas are above mean".

$\endgroup$
0
$\begingroup$

The point Daniel Moller made is indeed valid. Initially I thought he is suggesting to Separate Geometry, to apply material to separated geometry and then join with what remained as Inverted but then a thought struck my head his answer was not directly answer to my issue but presentation how to select faces within UV Unwrap. And it is working.

Hence for anyone interested please find below the corrected geomety nodes setup that allows to select faces to be included into the UV Map. It is not optimized as it can be easily grouped and some variables can be provided via Group Input node. Nevertheless it is working and that is the most important thing.

So the first screenshot is aboutsetin the UV Map and selecting faces that are to be used. The part of selecting seams to faces grater than certain face area are not relevant in this example but in other cases might be.

enter image description here

And the second screenshot is showing second part which displays the UV Map dynamically.

enter image description here

And finally the result

enter image description here

$\endgroup$

You must log in to answer this question.

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