Vertex alpha painting

Authored by Fabio Arnold (donfabio) on Nov 22 2014, 12:51 PM.
"Like" token, awarded by AnadinX."Love" token, awarded by simon.broggi."Love" token, awarded by Tubeliar."Love" token, awarded by Swyter."Love" token, awarded by kitfox.



I created a patch which enables editing the alpha channel of vertex colors in the vertex paint mode. For this I had to extend the MeshColor and MeshLoopColor to four channels to store alpha values. Then I introduced another blend mode (set alpha) to the vertex paint editor. I used Brush.alpha (which is also used for intensity and pen pressure I guess) for setting the alpha values instead of extending Brush.rgb to Brush.rgba which I tried first but noticed it was too much trouble.
I implemented OpenGL rendering for solid and textured shading for immediate and VBO mode. But because of transparency I still need to sort the triangles depending on the view. Does functionality already exists which I could use for that?

Diff Detail

Fabio Arnold (donfabio) retitled this revision from to Vertex alpha painting.Nov 22 2014, 12:51 PM
Fabio Arnold (donfabio) updated this object.
Fabio Arnold (donfabio) set the repository for this revision to rB Blender.

@Fabio Arnold (donfabio): the PNG file seems to be corrupted, and can't be read.


I would use one of the CLAMP macro (e.g. CLAMP(fac, 0, 255)), see BLI_utildefines.h line 329 and below.


Unused variable.


Dead code should be removed, also avoid C++ style comment in the C code.

Campbell Barton (campbellbarton) requested changes to this revision.Jan 21 2015, 4:25 PM

This patch makes vertex colors enable alpha always, not sure this is ideal, maybe it should be an option?

Also, render engines will need to support this eventually, but can be done after.


The only difference between the 2 functions is brush_alpha_pressure, would try to refactor into a single.

This revision now requires changes to proceed.Jan 21 2015, 4:25 PM

it's useful feature,especially for game!

This is indeed a very useful feature for Gamedevs. Is it possible to resurrect this differential?

I would also like to see this in Blender, vertex alpha is very useful for effects and game graphics. I've used hacked export scripts and multiple color sets to get around it but this has viewport support and it would open new workflows right inside Blender and not only for game graphics.

This is specially important for technical artists which otherwise would have to bake complex multi-channel effects using things like 3ds Max.
Being able to preview transparency instead of having to split the alpha channel into a secondary vertex color layer is also a lifesaver.

I also agree that having to modify import and export plugins to support per-vertex shading used since the PSX era is not ideal.

Any development on this? It seems a shame to leave such a useful feature in limbo!

I sure would like to see this feature too! Can this get a review? Poke @Campbell Barton (campbellbarton)

I have also proposed the vertex alpha painting in my GSoC project. Can I get the demonstration of your implementation?

Alpha support has been committed to master from soc-2017-vertex_paint branch rB288b2d0aa6bc8097f92e85f8d16fd2125d6eb2e9