jpaver / opengametools

A set of open c++ game development tools that are lightweight, easy-to-integrate and free to use. Currently hosting a magicavoxel .vox full scene loader.
MIT License
373 stars 35 forks source link

Any writing of voxels object to Wavefront obj? #32

Closed GrapixLeGrand closed 2 years ago

GrapixLeGrand commented 2 years ago

Hello,

Great project! I looked at the source code and did not find a way to write the voxels into a mesh OBJ file. Is that correct? I know Magikavoxel can do it but I want to automate this. Is this hard to implement from the current state of the project? I never really worked with it but if I have time maybe I can have a look at it? Just a bit busy right now.

Best, Quentin

jpaver commented 2 years ago

As it turns out, I do have some code to do this already. Will try clean it up and add it to the repo soon.

GrapixLeGrand commented 2 years ago

Okay, thanks !

jpaver commented 2 years ago

Hi @GrapixLeGrand -- please see commit https://github.com/jpaver/opengametools/commit/71b38f7a2478373fb89970aec0ea2e9822824051 which implements a vox2obj tool. It can open a .vox file and can extract a full frame out to an .obj file (with associated .mtl and .tga for texture). It also supports extracting out a per-animation-frame version of each mesh if you need to reassemble it in another animation/rendering tool.

Closing.