From BlenderWiki

Jump to: navigation, search

If you're looking for user/code documentation for this project, click either of these links!


Nathan Vollmer

Email / IRC / Social / Web

N8V on #blendercoders



Project Synopsis

Vertex painting is an essential part of 3D animation, especially in Blender. Often used in skin weighting, vertex painting provides an intuitive way for 3D artists to define how bones deform the vertices of a polygonal mesh.

Currently, Blender uses OpenGL selection when painting vertices. Although convenient for painting visible vertices, this technique has several problems.

OpenGL selection:

  1. is unable to paint occluded vertices efficiently. Only vertices directly underneath the brush region can be selected.
  2. tests multiple selection rays against all vertices of a mesh. This is not only inefficient, it also fails at selecting vertices not caught by the ray.
  3. is unorganized. It is difficult to take advantage of vertex locality without searching through a large list of vertices.
Vertex painting before zooming in.
Vertex painting after zooming in.

We need to rethink the way we handle vertex painting if we’re going to overcome these obstacles. Luckily, Blender already has a solution which just needs implementing. The shortcomings of OpenGL selection can be resolved by using Paint Bounding Volume Hierarchies for all vertex painting.


Using Paint Bounding Volume Hierarchies to paint vertices has tons of very practical benefits.

Paint Bounding Volume Hierarchies:

  • Allow selection of vertices smaller than a pixel.
  • Allow more flexible selection of occluded vertices.
  • Improve performance of vertex lookup time, and OpenGL draw calls.
  • Give more context to vertex selection, enabling tools like
    • Splash prevention, which helps avoid painting surfaces behind the artist’s focus.
    • Mirrored vertex painting, with behavior similar to sculpt mode.
A PBVH tree on a very dense sphere.

Multiple artists from the Blender community have requested tools for making vertex painting (particularly vertex weight painting) an easier process. If we implement these requested tools before switching over to a PBVH based selection, we become more dependent on OpenGL selection, making the conversion to PBVH selection a more difficult process. However, if we implement PBVH based selection sooner rather than later, we can become more committed to ideas like:

  • Selection fill, which would paint every vertex within either a lasso selection or a rectangular selection.
  • A Dynamic brush region, where the active brush region would change depending on the normal of the corresponding object’s surface at the current point. (If no surface is under the center of the brush, the brush would simply be a circle.)
  • 3D cursor painting, which would use the 3D cursor as the origin of the selection and a radius of effect determined by how far an artist drags their cursor away from the origin of selection.

PBVH based vertex painting is a faster, more flexible technique that will allow blender developers to commit to new ideas for vertex painting, ultimately making vertex painting a more convenient and efficient tool for Blender artists.