Maybe useful stuff
BloxxDev :: Bloxx Chat :: General
Page 1 of 1
Maybe useful stuff
https://voxel.codeplex.com/discussions/461060
The .vox format is similar to RIFF format.
The data in the file is organized in a hierarchical chunk structure :
( all the magic number used here is big endian, for example, 'M''A''I''N', M is at 0 bytes, N is at 3 bytes )
The format for each chunk is as following :
there are several children chunks within the MAIN chunk :
For the color information, you can export the palette as .act file, and then read color from it :
The .vox format is similar to RIFF format.
The data in the file is organized in a hierarchical chunk structure :
- Code:
4 bytes : magic number ( 'V' 'O' 'X' 'space' )
4 bytes : version number ( current version is 150 )
{ MAIN chunk }
( all the magic number used here is big endian, for example, 'M''A''I''N', M is at 0 bytes, N is at 3 bytes )
The format for each chunk is as following :
- Code:
// chunk
{
// header
4 bytes : chunk id
4 bytes : size of chunk content ( n )
4 bytes : size of children chunks
// chunk content
n bytes : chunk contents
// children chunks
{ child chunk 0 }
{ child chunk 1 }
...
}
there are several children chunks within the MAIN chunk :
- Code:
MAIN chunk :
id : ( 'M' 'A' 'I' 'N' )
SIZE chunk :
id : ( 'S' 'I' 'Z' 'E' )
content : ( 3 x 4 bytes : x, y, z )
VOXEL chunk :
id : ( 'X' 'Y' 'Z' 'I' )
content :
( numVoxels : 4 bytes : m )
( each voxel : 4 bytes : x, y, z, color index ) x m
For the color information, you can export the palette as .act file, and then read color from it :
- Code:
.act :( 3 bytes : r, g, b ) x 256
Re: Maybe useful stuff
https://voxel.codeplex.com/wikipage?title=XRAW%20Format
XRAW is a simple format designed for raw image or volume data for both RGBA and palette index color mode.
Though it can be used for general volume/image data representation, here we only use one of the many possible combinations.
It includes three sections : header ( 24 bytes ), voxel buffer, palette buffer
- integer is stored as little endian
some calculations :
1. #voxels = sizex * sizey * sizez;
2. voxel offset = x + y * sizex + z * sizex * sizezy;
3. #V = #voxels *
#bitsPerChannel * #channels / 8 ( if #bitsPerIndex == 0 );
#bitsPerIndex / 8 ( otherwise );
4. #P = #bitsPerIndex * #paletteColors;
XRAW is a simple format designed for raw image or volume data for both RGBA and palette index color mode.
Though it can be used for general volume/image data representation, here we only use one of the many possible combinations.
It includes three sections : header ( 24 bytes ), voxel buffer, palette buffer
- integer is stored as little endian
4 | magic number | "XRAW" : X is at 0 byte | |
1 | channel data type | 0 : unsigned integer | 1: signed integer 2 : float |
1 | # channels | 4 : RGBA : R is at 0 byte | 3, 2, 1 : RGB, RG, R |
1 | # bits per channel | 8 : unsigned byte | 1, 16, 32, 64 |
1 | # bits per index | 8 : unsigned byte | 0, 16 |
4 | volume size x | ||
4 | volume size y | ||
4 | volume size z | ||
4 | # palette colors | 256 | |
- | end of header | ||
#V | voxel buffer | voxels | |
#P | palette buffer | colors |
some calculations :
1. #voxels = sizex * sizey * sizez;
2. voxel offset = x + y * sizex + z * sizex * sizezy;
3. #V = #voxels *
#bitsPerChannel * #channels / 8 ( if #bitsPerIndex == 0 );
#bitsPerIndex / 8 ( otherwise );
4. #P = #bitsPerIndex * #paletteColors;
BloxxDev :: Bloxx Chat :: General
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|