vengi-voxel / vengi

free and open source voxel art tools - editor, thumbnailer and format converter
http://vengi-voxel.github.io/vengi/
Other
1.08k stars 90 forks source link

VOXFORMAT: layers and objects are not handled properly #68

Closed mgerhardy closed 2 years ago

mgerhardy commented 3 years ago

i created 8 objects and put each 2 of them into 1 layer but the convertor does not count the layers. it counts the objects. and if my objects go pass the 8 layers (or technically 7 because it starts from 0) it wont work.

layers-objects

mgerhardy commented 3 years ago

VoxConvert_-_Layer_Problem.zip

mgerhardy commented 3 years ago

related issues:

mgerhardy commented 2 years ago

To properly fix this I have to refactor the way I handle the volumes. I do the voxel rotation while loading a volume. This doesn't work very well for magicavoxel vox files. As this format supports multiple objects in the scene with different rotation and translation to point to the same volume. There is e.g. a prince of persia scene, that references the same tile again and again to assemble a full scene. This feature is not yet supported.

Looks like I have to fully support the scene graph, or I would otherwise waste a lot of memory.

mgerhardy commented 2 years ago

The id from the LAYR chunk is most likely mapped to the layerId of the nTRN chunk:

mgerhardy commented 2 years ago

Support for the scene graph should get added via VoxelVolume - model matrix and RawVolume pointer (with the information about whether the particular instance is owning the RawVolume data or whether it's just a reference in the graph)

VoxelVolume was renamed to SceneGraphNode edfaeca34d837c9cab8ec7c16c20ee693f11eaa9

mgerhardy commented 2 years ago

c298633a5f322d1017e8493f4d06207cfe9059bb should fix this issue. Feedback welcome

mgerhardy commented 2 years ago

voxconvert got the --dump option to print the scene graph to the console. This should also help to get the filter ids for layers in voxconvert by counting the model nodes.