CMAP Colormap File Format


The CMAP file format is a very simple format based on the OFF file format. A CMAP file usually corresponds to a matching OFF file, containing one color component for every polygon in the OFF file. Each colormap holds only a single color component. A full-color use would require three colormaps, one for red, one for green, and one for blue. My use for this format sprang from radiosity computations, where it was time-consuming to compute each component. By computing only a single component into a CMAP file and using that single CMAP for all three components I could render a greyscale preview that let me see if I wanted to spend the time on the other two components.

A CMAP file is an ASCII text file. The first line must be CMAP, declaring the file as a colormap. The second line contains a single integer, specifying the number of colors, n, contained in the colormap. The next n lines each specify a color as an integer between 0 and 255.


Format

CMAP
<n - number of polygon colors>
<Color for polygon 0, int>
.
.
.
<Color for polygon n-1, int>

Example

CMAP
6
255
128
64
64
32
0

Page contents copyright 2002, Ryan Holmes
OFF Tools Home Page
The RoffView Home Page
My Home Page