Sunday, March 29, 2009

On the storage of Color in meshes

A very short post to clarify a bit the ways in which people can store color (and other) information on a mesh. AFAIK there are mostly three ways to keep color:
  • Per-vertex: each vertex stores a color. A triangular face can have vertexes of different color and inside a triangle the color is linearly interpolated. Color is smooth across the surface.
  • Per face: each face has a distinct color. You can easily see the discontinuity of colors among the faces (no interpolation is usually done.
  • As texture: the most general way that is reasonably decoupled from the mesh itself. You only need a good parametrization.
In MeshLab most of the algorithms (painting, color processing etc.) manage per-vertex color, but a few conversion tools are provided.
  • per-vert -> per -face
  • per-face -> per-vert
  • texture -> per-vert
A per-vert -> texture is strikingly missing :). To be added in the very near future. Obviously assuming the previous existence of a parametrization...
A fourth technique could be mentioned, keeping stuff per wedge, i.e. for each corner of the face we can store different colors (or other attributes), but this approach is rather unused (it can be simulated by duplicating vertices).
Below a few images showing the difference between the three modes on a small (40k tri) mesh; respectively: no color (to give you an idea of mesh density), color by texture, per vertex color, per face color.