20.3. How-To

Note that voxelized geometry is only available in DIRSIG4.

The grid itself is specified in two different files: the ``grid file'' and the ODB file. The grid file specifies the voxel data without any physical dimensions. The entry in the ODB indicates the physical dimensions and location of the grid.

The following screen grab shows the contents of a sample grid file:

142     142     64
        43      57      0       206     795.444 1000.2030
        44      57      0       206     795.228 1000.2030
        41      58      0       206     795.228 1000.2030
        ...     ...     ...     ...     ...     ...
        ...     ...     ...     ...     ...     ...
        ...     ...     ...     ...     ...     ...

The first line has three integers, denoting the dimensions of the grid. In the example above, the grid is 142 x 142 x 64 boxes.

The remainder of the file consists of lines with six columns of data. The first three columns indicate the voxel index (counting from 0). The fourth column indicates a DIRSIG material id corresponding to an entry in the Material Database File (.mat). The fifth column indicates temperature in kelvin. The final column indicates concentration in [ppm].

Specifying voxel data for each grid voxel is not required. Unspecified voxels are treated as being empty. Furthermore, empty voxels do not take up memory, though they do slow the raytracing process to some degree.

Here is a screen grab of the ODB file:

DIRSIG_ODB = 1.0
                     
REGULAR_GRID {                                                                                            
    INSERT_POINT = 0,0,0                                                                                  
    DELTA_X = 1.0                                                                                         
    DELTA_Y = 1.0                                                                                         
    DELTA_Z = 0.5                                                                                         
    GRID_FILENAME = regular.grid                                                                          
}     

The insert point indicates the scene coordinates (in meters) at which to place the grid. (Lowest x,y,z coordinate of grid). The parameters DELTA_X, DELTA_Y, and DELTA_Z associate a physical size to the voxels. Finally, the GRID_FILENAME indicates where the dimensionless grid data is stored.

Together, the above grid and ODB files specify a grid with its minimum scene extent at (0,0,0) and its maximum extent at (142,142,32). So there are 142 x 142 x 64 boxes. The dimensions of each individual box (voxel) is 1 x 1x 0.5.

Note: at this time voxelized grids are always axis-aligned.

A complete example of Voxelized Geometry is available for download: http://www.dirsig.org/demos/RegularGrid1.tgz