3
$\begingroup$

I'm loading MD simulation data into Blender and want to set the color of instances to indicate an attribute value that has been calculated separately beforehand.

The current workflow looks like this:

  1. I'm creating a geometry object with vertices at every particle position and using a Geometry Nodes modifier to spawn mesh instances at these points.
  2. A bmesh layer is used to store the specific attribute value that I want to base the color upon at each vertex (shown here and here)
  3. Every frame the vertex positions and bmesh data are updated to mirror the particle movements and attribute value, respectively.

I'm aware of a method to color these instances (answer to this question), but struggling to apply it here, since the custom attribute I defined vor each vertex can't be referenced anymore when the instances are realized and the number of vertices changes. Is there a solution in Geometry Nodes to reference the value of the original vertex? That is, can the Group Input attribute "vert_layer" as shown in the image below, be used as input for ColorRamp somehow?

I guess one could update the dependencies graph and apply Step 2 for the resulting mesh, but it seems too resource intensive to iterate over the whole list of vertices each frame. Just as it seems wasteful to realize all the geometry of the node instances to modify color. This will probably restrict me to small data sets. Any suggestions on how to do this (in a less convoluted way) are appreciated!

blender scene preview

$\endgroup$

2 Answers 2

2
$\begingroup$

I think this setup here might actually answer that part of my question:

enter image description here

$\endgroup$
0
$\begingroup$

I made this for my add-on. The problem is that if you want to color vertices, you should set color attribute for vertices, not face corner data, because face corner data make sense only if you have faces. You can do it in attribute section:

enter image description here

But in this case, you will not be able to edit colors using vertex color mode. Maybe it's not an issue for you, and you can set color using bmesh.

As for your question about realizing instances, your thoughts are correct, and I haven't found a more efficient way to do this. At this moment, you should realize instances to put different data into them, so that you can use it in materials.

$\endgroup$

You must log in to answer this question.

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