Skip to content
/ vox2png Public

Converts a MagicaVoxel .vox file into layered sprites and writes them to a .png file

Notifications You must be signed in to change notification settings

jemisa/vox2png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

vox2png

This program was inspired by this post on /r/gamedev.
The technique described here not only looks nice, but allows you to do voxel graphics in purely 2D engines (as long as you can do matrix transformations).
The big downside is that it is an absolute PITA to create assets for, because you need to draw your voxel object layer-by-layer by hand.

To make this a lot easier I decided to write this program.
It takes a MagicaVoxel .vox file, and creates a .png sprite sheet from it. To show you what I mean by that, here are some screenshots:

Source model: From this Resulting sprite sheet: To this

// TODO Add an in engine screenshot here

Building and running

Vox2png doesn't have any dependencies except the C Standard Library (and math.h). Just compile vox2png.c with your C compiler, like this:

gcc vox2png.c -o vox2png -lm

Then you just run it like this:

./vox2png input.vox output.png

Or, if you want to use a special sprite packing mode use this:

./vox2png input.vox output.png horizontal/vertical/square

There is also a mode that gives each sprite cell its own png file:

./vox2png input.vox output multifile

Which produces numbered files for each Z layer, like this: output0.png, output1.png .. outputN.png

If you want to see a certain feature, just ask me and I'll add it. Or, if you know C, it shouldn't be hard to do it yourself.

About

Converts a MagicaVoxel .vox file into layered sprites and writes them to a .png file

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages