I'm trying to create masking textures that highlight specific regions of geometry on a mesh. For example, I want a mask that highlights areas near an edge that either has non-zero angle or is non-manifold. I know how to select such edges. Then I can subdivide the geometry many times to get high point density, and use the geometry proximity node get a nearly smooth distance field on each of the faces of the subdivided mesh. But now I need to store that information outside of geometry nodes (and indeed outside Blender itself), and also the final mesh needs to stay low-poly. The only way I can see that meets these critera is some sort of image texture storing the field values from the subdivided geometry, and then exported/attached to the original object similar to a normal or bump map, but I have no idea how to make that happen. Can someone help explain how to do this?
-
$\begingroup$ You can't directly generate images from attributes. Attributes (and geometry) are 3D, images are 2D, which mean you have to unwrap your mesh. So the way to do that would be as answered by Daniel Möller. There is no simple or obvious way to do that. $\endgroup$– LutziCommented Dec 10 at 1:40
-
$\begingroup$ @Lutzi Attributes are 3D? In the special case that you are storing them on points in 3D space their storage location is 3D, but attributes in itself can have many dimensions, 1 up to 4 in Blender if I don't forget anything (4 being RGBA values). To map those 3D locations to 2D, a UV map is helpful. But you could also map them on a single line by just using the index for example. Or spearate the indices to form rows and columns which you could then use as 2D image. Apart from the "attributes are 3D" I agree though, baking with the help of UVs to an image is probably the best way. $\endgroup$– Gordon BrinkmannCommented Dec 10 at 10:12
-
$\begingroup$ @GordonBrinkmann I know, and it can go over 4D I think, for transforms (unsure but technically speaking 9D ?). I'm talking about unwrapping. The geometry containing the attributes is 3D and have to be project on a plane -> no obvious way. $\endgroup$– LutziCommented Dec 10 at 13:29
-
$\begingroup$ @Lutzi No obvious way, true - that's why I agree UV mapping is the best solution. But still, attributes and geometry are not the same, and the attributes are not necessarily 3D (very often when you use them as factor for a shader they are just 1D floats). But let's say you have a mesh with 60,000 verts - you could simply transform them into a 2-dimensional matrix by their index, 300 columns by 200 rows, first row is index 0 to 299, row 2 is 300 to 599 and so on. Then you can easily create a 300 × 200 pixels image with greyscale values representing the attribute floats. $\endgroup$– Gordon BrinkmannCommented Dec 10 at 13:38
-
$\begingroup$ ...the harder thing in the Shader Editor then would be to map the pixels back to a vertex index (I don't think there is a simple way in Blender...?) so therefore UV mapping is the best solution. $\endgroup$– Gordon BrinkmannCommented Dec 10 at 13:42
1 Answer
What you're looking for is called "baking".
It's when you create a procedural texture (color, roughness, normals, etc.) and save it as image.
There is baking that you just save your procedural textures.
And there is baking that you transfer data from high poly meshes to low poly meshes (and saves as textures).
Explaining how to bake in an answer would take a lot of space, and would also require to know exactly what you want. (Your question is vague)
But there are plenty of tutorials about baking available (I liked the Blender Guru's "Anvil Tutorial", there is a chapter about baking a sculpted surface onto a low poly mesh as a normal map)
One last thing, you can in geometry nodes use a "Store Name Attribute" node in the "point" domain to save your information.
Then you can use that information in shader nodes with an "Attribute" node.
And then you bake.