sandrofigo / VoxReader

A C# library to read .vox files created with MagicaVoxel
MIT License
62 stars 3 forks source link
magica-voxel magicavoxel openupm parser parser-library reader unity unity-3d unity-scripts unity3d unity3d-plugin vox vox-files voxel

VoxReader VoxReader Icon

latest openupm downloads build

A C# library to read .vox files created with MagicaVoxel


Currently supported features

At the moment it is possible to read:

Usage

// Read .vox file
IVoxFile voxFile = VoxReader.Read("my_awesome_model.vox");

// Access models of .vox file
IModel[] models = voxFile.Models;

// Access voxels of first model in the file
Voxel[] voxels = models[0].Voxels;

// Access properties of a voxel
Vector3 position = voxels[0].Position;
Color color = voxels[0].Color;

// Access palette of .vox file
IPalette palette = voxFile.Palette;

// Access raw data of a chunk
byte[] rawData = voxFile.Chunks[0].Content;

Unity

The package is also available on OpenUPM for the Unity game engine. Follow the manual installation or the CLI installation instructions on the OpenUPM page to install the package in your project.

Extending the library

The file format specification made by ephtracy is available at .vox file format

Support this project with a ⭐️, report an issue or if you feel adventurous and would like to extend the functionality open a pull request.