Qubicle Exchange (QEF) File Specification
QEF is a rather old ASCII exchange format originally developed for the unreleased Qubicle Plugin for Maya. It is recommended to use the newer and more flexible Qubicle Binary exchange format instead.
Data structure
QEF files are divided into 3 parts: the header, the color map and the voxel data.
Header
The first part of the header always looks like this:
Qubicle Exchange Format Version 0.2 www.minddesk.com
It doesn't hold any valuable information. Use it to test whether this file is really a QEF, or simply skip it. The next line shows the size of the matrix stored in this file in X/Y/Z.
20 50 16
Color map
Unlike the Qubicle Binary format, QEF lists the colors used in the matrix in a color map. The first line tells you how many colors are in the color map.
3
The following lines (in this case 3) store the individual colors as rgb, ranging from 0 to 1. So pure white would be 1.0 1.0 1.0 and pure black would be 0.0 0.0 0.0
0.000000 0.000000 0.000000 0.972549 0.972549 0.972549 1.000000 1.000000 1.000000
Voxel data
The rest of the file stores all visible voxels, one voxel per line.
- the first 3 values hold the position in x/y/z.
- the 4th value is the color index of the colormap (starting with 0).
- the last value is the visibility mask telling you which sides of the voxel should be rendered.
1 35 7 0 52 ... 19 36 6 1 74
Visibility mask encoding
To increase render speed Qubicle internally uses a visibility mask telling the engine which of the voxel's sides to render. To test whether a side should be rendered use this pseudo code:
- if (mask && 2 == 2) // left side visible
- if (mask && 4 == 4) // right side visible
- if (mask && 8 == 8) // top side visible
- if (mask && 16 == 16) // bottom side visible
- if (mask && 32 == 32) // front side visible
- if (mask && 64 == 64) // back side visible