Open Zylann opened 3 years ago
It appears MagicaVoxel uses a coordinate system similar to 3DS Max:
While in Godot coordinates are OpenGL:
So from what you can see in those screenshots, the loader actually has to choose a conversion strategy by swapping axes, which seems to be correct? From MagicaVoxel to Godot: X becomes Z, Y becomes X, Z becomes Y. Which in code translates as: https://github.com/Zylann/godot_voxel/blob/8ba9f0797882c4998ed6b0301dfd89d32188253a/streams/vox_loader.cpp#L86-L88
So models are not really flipped, it's just that Godot uses a different coordinate system and the loader has to remap axes.
Size however does not apply this remap so it sounds like non-cubic models will fail to load properly. This may be fixed in a rewrite I'm planning to do, which will also bring support for more recent MagicaVoxel features such as multiple models, layers and transforms.
Yours aproach to zxy is more accurate to magica model view. +1 As long as I was testing, loading non cubic models are correct. Btw, to save you some time: As mentioned in oryginal extended magica vox file format nTRN saves chunk position but they didnt mention that it's not position of left down corner (voxel (0,0,0)) as everyone can suspect (at last me xD) but its the center of chunk. Position is saved not as three int values but as string of x,y,z values separated by space ^^. Creazy... If ther is no "_t" key in nTRN dictionary (the one that have chunk position) you still need to remember that default position is center of chunk not the corner one. Cheers.
Complete loading code for extended vox format: https://github.com/mchorse/blockbuster/tree/e95fc7c08b662b5f1ca221f73a002ca4720b1826/src/main/java/mchorse/blockbuster/api/formats/vox
OK just saw that you already updated source code to the full loading extended vox format xD will move my work -> trash ;) Btw i cant see that you move chunks position from center to bottom left ( as paste use it) ?
Quick bug note referring to #260