After cloning the repo run npm install
, followed by npm run serve
to start the development server on localhost:8080
.
Currently, only .vxm
(VoxEdit) files are supported. .vox
(MagicaVoxel) support is planned.
.vxm
files to the public directory.ArrayBuffer
, via a fetch request or similarconst response = await fetch('path/to/file.vxm');
const voxelsArrayBuffer = await response.arrayBuffer();
ArrayBuffer
to an object of TVoxels
type via convertVxm
const voxels = convertVxm(voxelsArrayBuffer);
createTextureFromVoxels
const voxelTexture = createTextureFromVoxels(device, voxels);
VolumeAtlas
volumeAtlas.addVolume(voxelTexture);
The VolumeAtlas
class is a container for multiple 3D textures. It is used to store all the voxel models in the scene.
This means that only one texture binding is required for all the voxel models in the scene, which is useful especially for scenarios requires ray tracing of the scene. This also reduces the memory footprint for repeated instances of objects
Currently, textures are packed along the x-axis of the atlas. This means that the maximum number of textures that can be stored in the atlas is limited by the maximum texture size supported by the GPU. In future, the atlas will be able to store textures in a 3D grid, allowing for more textures to be stored.
TODO
Soulflame uses a deferred WebGPU renderer to render voxel models. Ray tracing is used to render the scene.
TODO
TODO