Giter Club home page Giter Club logo

vox2png's Introduction

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.

vox2png's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.