gromgull/py-vox-io

z coordinates are inverted in the generated vox model

alexhunsley opened this issue · 0 comments

Let the range of z values in my numpy array be 0 ... z_max.

Voxels in my numpy array with z coord = Z actually appear in MagicaVoxel with z coord = z_max - Z.

The reason for this appears to be this line in models.py which inverts the z coords:

    voxels = [ Voxel( nz[2][i], nz[0][i], z-nz[1][i]-1, a[nz[0][i], nz[1][i], nz[2][i]] ) for i in range(nz[0].shape[0]) ]
                                          ^^^^^^^^^^^^

Is there a reason for the inversion of the z coordinate? (It reminds me of OpenGL LHS coordinate system, or similar)

Note: I'm considering the coordinates reported by MagicaPixel when viewing my model in that software as the canonical truth about what coordinate a voxel is at.