vengi-voxel / vengi

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

VOXCONVERT: when converting .qb to .obj, the uv coordinates are misaligned #403

Open hkunz opened 3 months ago

hkunz commented 3 months ago

When converting the attached .qb file to .obj (and possibly other formats), the color scheme is incorrect due to misplaced sampling points on the UVMap. The sampled points are placed between 2 colors causing the resulting value to mix. Tested by importing the resulting .obj in Blender:

image

The correct placement should probably be the following in order to set the sampling point to be at the center of each color:

u = index * 1/256 + 1/256/2
v = 0.5

or

u = (index + 0.5) / 256
v = 0.5

Here's a sample .qb file https://drive.google.com/file/d/1WoSwlgCiSybYkdqxdm_Ir5nFOVFtTYyk/view?usp=sharing

test.zip

mgerhardy commented 3 months ago

The issue should be fixed now. Feedback welcome.

hkunz commented 3 months ago

Hi martin i checked and it's almost fixed not perfect yet. Because it's not perfectly centered, it will produce a slight mixed shade of the adjacent color. Please see gif below this pic for demo.

image

Notice the shade of blue moving closer to the perfect shade of the blue pixel once it reaches the center c