18
$\begingroup$

I'm trying to use weights from a vertex group in cycles nodes to change the transparency of the mesh. But as far as I know this is still not supported.

Is there any workaround that I could use?

This is what I want to achieve:

weight-painted array modifiers stack

As you can see, I use a VertexWeightProximity modifier, to paint the vertex group, and I would like to use it in the node tree to affect the transparency of the mesh. The attribute node doesn't seem to read vertex groups yet.

node tree

$\endgroup$
5
  • $\begingroup$ Do you absolutely need to use Weight Groups? Vertex Paint works for Cycles Nodes. $\endgroup$ Commented Aug 21, 2014 at 11:37
  • $\begingroup$ As far as I know, VertexWeightProximity doesn't work with vertex colors, so I couldn't use it. $\endgroup$
    – DavidGasku
    Commented Aug 21, 2014 at 11:45
  • $\begingroup$ I did overlook that little detail. There is a really old page here about something different but the suggestion that Ideasman42 gives at the end would work for you here I think. Write a script that transfers the vertex weights to vertex colors. blenderartists.org/forum/… You could reword your question to ask how this can be done. There are some very good scripters around here. $\endgroup$ Commented Aug 21, 2014 at 11:52
  • $\begingroup$ I've been requesting this feature for so long.. $\endgroup$
    – gandalf3
    Commented Aug 21, 2014 at 21:12
  • $\begingroup$ Sadly, that addon doesn't seem to work with the modifier, as it doesn't read the modified values. But is good to have. $\endgroup$
    – DavidGasku
    Commented Aug 22, 2014 at 0:04

4 Answers 4

8
$\begingroup$

This method doesn't use weights, but it seems that your real goal is to get the proximity into Cycles. If this is the case then you can get the proximity using a different method called Dynamic Paint. This will output an image sequence that can be used in Cycles.

Below is a rough example of what dynamic paint can do:

enter image description here

This will output a vertex colour layer which can be used in cycles like this to produce to the image on the right:

enter image description here

Miikah, the creator of dynamic paint has a full tutorial here:

http://www.miikahweb.com/en/articles/blender-dynamicpaint-basics

The basic steps on the physics tab is to set the circle segment to be the brush like this:

enter image description here

The circle that will become transparent is set up in the same way as the brush but is set to be the canvas with vertex colours set in the output panel:

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Thanks, I knew about the dynamic paint, but I didn't realize it could be useful in this case. I'll use it! $\endgroup$
    – DavidGasku
    Commented Aug 21, 2014 at 17:56
16
$\begingroup$

You need to translate vertex weight into some proxy that nodes can read. Consider using UV as a proxy. It can be read by nodes and it can easily be mapped to vertex group weight.

Create a new UV mapping for your mesh and set all vertices to 0,0 on that new map. Add a UV warp modifier editing this new mapping, modulated by the vertex group you want to reference, and set it to use two empties, one located at 1,1 and one at 0,0. Now, by accessing these new UV coordinates, you're accessing the vertex group modulating the modifier.

$\endgroup$
6
  • 4
    $\begingroup$ This workaround blown my mind. People, if you seek the dynamic solution here it is $\endgroup$
    – Branskugel
    Commented May 23, 2018 at 16:38
  • $\begingroup$ I can confirm that this hack is insane and saved my life - until the next issue :) $\endgroup$
    – Derek Eden
    Commented Dec 10, 2020 at 3:39
  • $\begingroup$ I'm just guessing that you're another programmer @Nathan. That is a mad-sexy hack. $\endgroup$ Commented May 31, 2021 at 13:13
  • 1
    $\begingroup$ Hi Nathan, I really would like to be capable doing this. Unfortunately my knowledge is too low so that i cannot follow your explanation. Could you please explain it with a step by step instruction for noobs? $\endgroup$
    – Chris
    Commented Jun 25, 2021 at 18:51
  • $\begingroup$ @Chris Do your research first-- search, read about using a UV warp modifier-- then, when you have trouble, ask a new, specific question about the part you're getting stuck on. $\endgroup$
    – Nathan
    Commented Jun 25, 2021 at 19:12
5
$\begingroup$

Since Blender 3.0 using weight paint in shaders is pretty easy, you ony need to convert the weight paint with geometry nodes and push the result to the desired/empty vertex paint. After this the vertex color will store the weights and will automatically update. By this method it is even possible to store multiple weights in one vertex color by using the rgb channels

enter image description here

$\endgroup$
1
  • $\begingroup$ What a great solution! And it's so simple. Thank you! $\endgroup$
    – Gary G.
    Commented Jul 4, 2022 at 2:09
4
$\begingroup$

An alternative to weight paint is Vertex Paint. Vertex paint can be, unlike weight paint, accessed in cycles. After applying your modifier, you can use the information in this answer to convert your weight paint data to Vertex Colors. Once this is complete, simply use an attribute node:

enter image description here

$\endgroup$
2
  • $\begingroup$ I don't think this will work when the weight is generated dynamically by a modifier. $\endgroup$
    – gandalf3
    Commented Aug 22, 2014 at 0:54
  • $\begingroup$ @gandalf3 Fixed! $\endgroup$ Commented Aug 22, 2014 at 0:55

You must log in to answer this question.

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