[tool] vox2love

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
illd
Prole
Posts: 4
Joined: Fri Aug 14, 2020 11:12 pm

[tool] vox2love

Post by illd »

Hi all,

I recently played around with converting MagicaVoxel .vox (0.98, format v150) files into PNGs that can be loaded in LOVE and stacked on top of each other to create a '3d-looking' effect. If there are multiple frames in the vox file, it will create a PNG for each one.

This isn't LOVE-specific and can be used in other places (like GMS), but I don't have experience with that - there are videos that explain this on YT.

The source (Go) is here, and prebuilt binaries for *nix and Windows can be downloaded on the release page.

You'll need to run these in a terminal (cmd.exe on Windows).

Arguments:

Code: Select all

-p: path to either a single .vox file or directory of .vox files. If multiple .vox are found, it will generate a png for each one and each animation within it (multiple models, basically).

-o: path to where the .png files will be written
As an example, you can run:

Code: Select all

vox2love_x64.exe -o assets\ -p ..\models
It currently supports a third flag (-e) that should extrude the images - eg for a 32x32x8 model, it will generate a 264x33 PNG with each 'layer' of the model expanded by 1px on both sides per layer. Requires changing the quads you use when loading the PNG.


Notes:
- There's a vox2png program written in C here. I didn't notice this until I was watching some videos on YT, but hopefully not having to build or cross-compile this yourself is easier.
- No flag currently for drawing vertically instead of horizontally but it could be implemented easily
- Doesn't preserve the name of the original vox file, so it might be annoying to convert a lot of models at once and have to rename or organize them, I'll likely update this in the future
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [tool] vox2love

Post by Davidobot »

Voxels are a really neat way of doing fake 3D. Windmill Games made a few cool games utilising the method.

Not sure if you've seen it, but there is a similar project here: https://love2d.org/forums/viewtopic.php?t=83158
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
illd
Prole
Posts: 4
Joined: Fri Aug 14, 2020 11:12 pm

Re: [tool] vox2love

Post by illd »

Davidobot wrote: Sun Aug 16, 2020 7:24 am Voxels are a really neat way of doing fake 3D. Windmill Games made a few cool games utilising the method.

Not sure if you've seen it, but there is a similar project here: https://love2d.org/forums/viewtopic.php?t=83158
Neat! Pure-lua way of doing it (the vox_model and vox_texture files). I think that's great for working on things rapidly! Thanks for the link.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 221 guests