3

How do I use the "Attributes" that I can create in a mesh object?

I'm able to create an attribute that is associated with a mesh, and I can assign it to a domain (i.e. vertex, Face, etc). It shows up in the spreadsheet viewer. But how do I change the values for each vertex? I need to be able to assign the values, otherwise this is useless to me. It's just a bunch of zeroes.

enter image description here

enter image description here

rothloup
  • 403
  • 4
  • 14

3 Answers3

4

The official documentation says: "Vertex groups, UV maps and Color Attributes are available as attributes in geometry nodes."

This means: Currently you can only process custom color attributes in geometry nodes.


Just create a new attribute and select the data type Byte color.

You can then change these attributes in the Vertex Paint mode by coloring the vertices:

enter image description here

The advantage of a color, however, is that it also consists of four float values (RGBA), which can be handy depending on the application:

enter image description here

quellenform
  • 35,177
  • 10
  • 50
  • 133
  • ok, so this gets me half of what I need. I can now influence the values. But two issues: 1) I can't set the values to what I want. If I set my brush to 100%, no falloff, Mix mode, and RGB = [0.5, 1, 0] the target vertex gets a value of [0.212, 1, 0]. I think this has to do with RGB encoding but I don't know. How do I just set the number to what I want? and 2) I really want to use a vector, not RGB, so I can use values >1. – rothloup Oct 29 '22 at 15:52
  • @rothloup Yes, this is actually related to the color processing mode. But unfortunately there is (currently) no other answer, because with individual attributes only color values in combination with Geometry Nodes are possible. The only way I know is to set attributes with Python: https://blender.stackexchange.com/questions/266991 – quellenform Oct 29 '22 at 16:02
3

Enable MeasureIt and vertex indices visibility:

Add a new object, name it attribute setter, and add a new geonodes setup to it. Drag the object of choice from outliner to the node tree:

And apply this geonodes modifier.

If you want to edit attributes of vertices, you can skip the above step and just duplicate my object and rename it to attribute setter

Add shape keys, set the 2nd shape key to have full effect:

Now you can use the base shape key to easily find and select a vertex you want to modify, then move to the other shape key and assign the Vector values as vertex location:

Finally you can go back to your object my object, and add a geonodes setup transferring that data:

You can apply that geonodes modifier, or leave it dynamically linking the data.

Markus von Broady
  • 36,563
  • 3
  • 30
  • 99
  • ...a little unwieldy, but an interesting approach – quellenform Oct 30 '22 at 00:44
  • @quellenform this seems like the most reasonable storage of data - obviously editing is unwieldy for multiple vertices and for that I'd use Python… You could avoid using shape keys and just store as 3 vertex groups, but problem is then it becomes incompatible with the workflow in the video… – Markus von Broady Oct 30 '22 at 00:53
  • @quellenform also, You're from Europe, it's time to sleep – Markus von Broady Oct 30 '22 at 00:56
  • a very hacky approach which I will almost certainly forget by the next time I need this - but very smart. It solved my immediate problem, thank you. In my case, I didn't need to re-generate the mesh using your first set of geo-nodes and the shape-key business, because my mesh was static. But for a mesh that may change, I can see the utility. In my case, I just duplicated the object and started moving vertices. Thank you! – rothloup Nov 02 '22 at 02:17
  • @rothloup I disagree about it being hacky [I'm not getting emotional, just arguing]: as I linked above this is not a new technique, in fact I also mentioned using separate geometry to store data in this thread – it's just a solution that comes naturally. Shape keys are added so you can easily find vertices, especially those very far from origin or those that overlap with other vertices. – Markus von Broady Nov 02 '22 at 09:15
  • @MarkusvonBroady: I get it, and I didn't mean it disrespectfully. I used the term because something that is not meant to do a thing (store attribute data) is being used to do that thing, and it "arises naturally" only because the natural approach (i.e. to use a vector attribute in the vertex domain, as implied by my original question) doesn't work. If it did, I can't imagine why anyone would have had to come up with this method. Nonetheless, I thank you, and I'm using your method now. – rothloup Nov 02 '22 at 22:49
2

New proper solution since Blender 3.5

This is the way now:

Edit Mode > Mesh > Set Attribute

https://docs.blender.org/manual/en/latest/modeling/meshes/editing/mesh/set_attribute.html

ChameleonScales
  • 2,510
  • 13
  • 33