14
$\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$
  • $\begingroup$ Do you absolutely need to use Weight Groups? Vertex Paint works for Cycles Nodes. $\endgroup$ – MarcClintDion Aug 21 '14 at 11:37
  • $\begingroup$ As far as I know, VertexWeightProximity doesn't work with vertex colors, so I couldn't use it. $\endgroup$ – DavidGasku Aug 21 '14 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$ – MarcClintDion Aug 21 '14 at 11:52
  • $\begingroup$ I've been requesting this feature for so long.. $\endgroup$ – gandalf3 Aug 21 '14 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 Aug 22 '14 at 0:04
6
$\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
    $\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 Aug 21 '14 at 17:56
4
$\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$
  • 1
    $\begingroup$ This workaround blown my mind. People, if you seek the dynamic solution here it is $\endgroup$ – Monkok May 23 '18 at 16:38
3
$\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$
  • $\begingroup$ I don't think this will work when the weight is generated dynamically by a modifier. $\endgroup$ – gandalf3 Aug 22 '14 at 0:54
  • $\begingroup$ @gandalf3 Fixed! $\endgroup$ – GiantCowFilms Aug 22 '14 at 0:55

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.