1
$\begingroup$

Previous questions/answers explain how to output vertex color from Geometry Nodes, but they rely on being able to select a vertex color slot in the Geometry Nodes modifier's Output Attributes:

Geometry Nodes output to vertex color

Is it possible to set/manipulate vertex colors from geometry nodes?

That option only seems to be available when you are passing the input geometry along to the output.

If you are ignoring the input geometry, and generating your own geometry within Geometry Nodes, you don't seem to be able to route your output color into a vertex color slot.

In this example (screenshot 1), if I connect the input geometry to the Subdivide Mesh node, I get the 'Face Corner -> Col' option and the vertex colors show up (I'm using Color By Vertex in Viewport Shading). When I connect the Cube node instead (screenshot 2), the colors don't show and the Col option isn't available.

So I guess I am asking, is there a way to generate a vertex color data slot on the generated mesh?

This is in Blender 3.1.0, but I think behavior is the same in 3.0 and 3.2 Alpha.

screenshot showing vertex colors working

screenshot showing vertex colors not working

Blend file: https://pasteall.org/media/3/3/339caf4fa163ae5b0068cfccef17254d.blend

$\endgroup$

1 Answer 1

2
$\begingroup$

You can use an Attribute node in the Shader Editor to establish a link between the vertex color data you've created in Geometry Nodes and your material. Then, you need to use a Set Material node in GN to assign that material to the geometry—simply adding it in the material properties panel like you do normally is not enough:

enter image description here

Note that this doesn't work with the Workbench engine (the Solid view), you need to switch to either Eevee or Cycles to see the result. I'm not sure if this is just a bug, or a technical limitation.


Curious about the Workbench situation, I did some more fiddling around, and here are some findings from that:

  • Workbench seems to only work if the attribute output is named same as the Vertex Color Index in the Mesh Data Properties panel. By default first index is createad as "Col" and since you can't change that from the GN modifier window, if you wanna use another name, you need to rename the index or the attribute (names are case-sensitive). Workbench also requires that the Attribute Domain is set to Face Corner. It does not work with geometry generated inside GN no matter which domain you use, and it is indifferent towards a material being set or not: enter image description here
  • Eevee and Cycles don't care about those defaults, and require a material with the Attribute node assigned (via Set Material) in GN. In addition to Face Corner, Cycles also supports Face and Point domains. Eevee supports all those, plus Edge domain: enter image description here
  • You can convert your attributes to other domains and modes from the dropdown in the Attributes panel: enter image description here
$\endgroup$
4
  • $\begingroup$ Thank you! That makes sense. So the data is available as an Attribute, but in some way it's not 'tagged' as a Vertex Color - so it doesn't show up in the Vertex Color node in the Shader Editor, and the Workbench engine doesn't see it as a Vertex Color for Solid viewport shading. I can work with that. $\endgroup$
    – David Wood
    Mar 17 at 10:03
  • $\begingroup$ At first I thought maybe it wasn't writing the vertex colors because unlike the object you put the GN modifier on, the Cube inside is not yet a real mesh, so I tried using a Realize Instances node, but it didn't work, even if I applied the modifier. So I don't know, everything I say would be a wild guess. At least it somewhat works this way. $\endgroup$
    – Kuboå
    Mar 17 at 10:48
  • $\begingroup$ @DavidWood Did some more digging and edited the answer with the findings, you might wanna take a look. $\endgroup$
    – Kuboå
    Mar 17 at 12:03
  • $\begingroup$ Brilliant, thank you so much! I think I was most of the way there with #1, but #2 (Face, Point and Edge) and #3 Convert Attribute - Wow, lots to explore! $\endgroup$
    – David Wood
    Mar 17 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.