1
$\begingroup$

I have a vertex group, which was painted using weight paint, called trees. vertex group

I would like to use it in the shader editor to (smoothly) mix between two shaders. As I understand it, it's not possible to directly take the value of the vertex group weight there, so I would like to map the weights to a vertex color in geometry nodes:

geometry nodes setup

I made sure that the Viewer shows the correct colors (R=G=B, smoothly changing from 0 to 1).

I set the output value to a vertex color: geometry nodes output

I then take the vertex color and use it in a diffuse shader, but I see the output being uniformly black: diffuse shader

  1. what went wrong here?
  2. do you have a better workflow for what I'm trying to achieve?
$\endgroup$

2 Answers 2

2
$\begingroup$

You have to replace the Vertex Color node by an Attribute node like this:

Attribute node

$\endgroup$
2
$\begingroup$

I would suspect that you didn't set your GN's output type to "face-corner", which is what kind of data a vertex color layer is.

enter image description here

Notice the geometry nodes sidebar. I've specifically designated the "Color" output as having an attribute domain of face corner. Blender is showing you "face corner" in the properties/modifier tab not because the output is face-corner, but because the type of data to which you're outputting-- a vertex color layer-- is face-corner. Apparently, there is no implicit conversion, which is a shame.

Note that there's a slightly simpler way to do what you want here, which is to just use an attribute node in your shader:

enter image description here

Here, I'm just passing my vertex group through a pass-through, which I'm using to convert from a vertex group to an arbitrary attribute. I've made up a name for my output attribute and typed it in, then referenced that attribute in an attribute node in my shader nodes. This works even as point data, as shown-- it is point data, as vertex groups are not face corner data.

$\endgroup$
3
  • $\begingroup$ Thanks for the answer, in the GN outputs I chose "Face Corner > trees_c" (the highlight in the previous version of the screenshot was not what was selected, just hovered over when making the screenshot). I tried what you proposed (pass trees directly, after returning it in GN), but weirdly, it doesn't work for me (again, everything is blacked out). Weirdly enough though, when I read trees_c attribute (the color one) as a factor, it does work as expected! $\endgroup$
    – sygi
    May 21, 2022 at 16:11
  • $\begingroup$ oki doki, I know what went wrong. For posterity, one needs to output in GN to a different attribute than the one it was reading from (when I renamed it to trees2 in GN outputs, it works fine). Thanks! $\endgroup$
    – sygi
    May 21, 2022 at 16:14
  • 1
    $\begingroup$ "in the GN outputs I chose "Face Corner > trees_c"" Like I said, face-corner in that dropdown does not mean the GN output type, it means the input type of trees_c the vertex color layer. They need to be matched. $\endgroup$
    – Nathan
    May 21, 2022 at 16:30

You must log in to answer this question.

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