gromgull / py-vox-io

Python module for parsing and writing MagicaVoxel vox file
MIT License
102 stars 26 forks source link

Fix off-by-one palette index problem: #3

Closed alexhunsley closed 1 year ago

alexhunsley commented 6 years ago

The code was adding a black (0, 0, 0) palette entry in front of all the quantised colour entries when in fact this shouldn’t be done.

This means that in the resulting Vox model, everything that should have the first (index 0) palette colour actually has the black colour, then everything that should have the 2nd (index 1) palette colour has the 1st palette colour, and so on.

Note: The spec for the Vox format says that the indexes of your palette entries end up getting +1’d, due to the ‘empty’ reserved value, but doesn’t say that you should put any kind of dummy value at index 0.

alexhunsley commented 6 years ago

Btw, if you'd like to keep the original behaviour for backwards compatibility and have this fix activated by an optional parameter to from_dense, let me know, and I'll amend the PR.