Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOXELFORMAT: VOX: missing palette color #549

Open
mgerhardy opened this issue Nov 28, 2024 · 4 comments
Open

VOXELFORMAT: VOX: missing palette color #549

mgerhardy opened this issue Nov 28, 2024 · 4 comments
Labels
bug format Voxel or mesh format related format-mv-vox MagicaVoxel palette

Comments

@mgerhardy
Copy link
Collaborator

mgerhardy commented Nov 28, 2024

export the model and load back in magica voxel the pallete color first one is missing

image

The error is most likely in PaletteFormat::save

@mgerhardy mgerhardy added palette format-mv-vox MagicaVoxel format Voxel or mesh format related labels Nov 28, 2024
@AndrejCro
Copy link

Steps to reproduce:
Load pallete in vengi editor
Open vox file, select to map colors to the pallete
Trigger autosave
Open autosaved vox file in magica voxel
Pallete color at index 0 (1) is missing

@mgerhardy mgerhardy added the bug label Nov 28, 2024
@AndrejCro
Copy link

TROPHYPALLETE

@mgerhardy
Copy link
Collaborator Author

The problem here is that the PaletteFormat::save function is not smart enough to search for unused palette color slots - and the provided palette includes 256 colors. Currently we try to find the closest match. This is fine, but we should also check for unused slots before. This functionality is there in SceneManager::nodeRemoveUnusedColors and should be moved out of the voxedit scope into a more global scope to be re-used in the voxelformat, too

mgerhardy added a commit that referenced this issue Dec 4, 2024
mgerhardy added a commit that referenced this issue Dec 4, 2024
this improved the situation where a full 256 color palette should get mapped onto a palette that only supports 255 colors
because one of the colors is representing air (e.g. sandbox vxm or magicavoxel vox) - we are now not just looking for
a suitable replacement to get the good result, but we also try to first search for an unused slot in the palette that we
are then using for the slot that represents air in the target format/palette.

to work around this, make sure to use a properly formed palette file. E.g. for magicavoxel you should use the first slot
for a fully transparent pixel to indicate an empty slot - for sandbox vxm you should use the 256st color to be fully
transparent. If you assemble your palette that way you won't get any reordering or color reduction
@mgerhardy
Copy link
Collaborator Author

mgerhardy commented Dec 4, 2024

this improved the situation where a full 256 color palette should get mapped onto a palette that only supports 255 colors
because one of the colors is representing air (e.g. sandbox vxm or magicavoxel vox) - we are now not just looking for
a suitable replacement to get the good result, but we also try to first search for an unused slot in the palette that we
are then using for the slot that represents air in the target format/palette.

to work around this, make sure to use a properly formed palette file. E.g. for magicavoxel you should use the first slot
for a fully transparent pixel to indicate an empty slot - for sandbox vxm you should use the 256st color to be fully
transparent. If you assemble your palette that way you won't get any reordering or color reduction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug format Voxel or mesh format related format-mv-vox MagicaVoxel palette
Projects
None yet
Development

No branches or pull requests

2 participants