LucasDower / ObjToSchematic

A tool to convert 3D models into Minecraft formats such as .schematic, .litematic, .schem and .nbt
https://objtoschematic.com/
BSD 3-Clause "New" or "Revised" License
372 stars 42 forks source link

Incorrect texture mapping in voxelization (branches main and 0.7) #107

Closed 0-zen closed 1 year ago

0-zen commented 1 year ago

0.7-localise doesnt seem impacted. I am not a specialist of that matter so I am making an issue report. I have found a weird bug which might come from a very recent commit since I did not have it before. Here is the model loaded on ObjToSchematic:

image

As you can see the textures are correctly loaded. But when I voxelize it:

image

Some areas seem to not have the right textures... Had the same problem with all other files i tested on main and 0.7 Here is one in example:

https://filetransfer.io/data-package/kpK2XQSI#link

LucasDower commented 1 year ago

Looks like commit 9de906f is to blame, previous commit (08aafe0) works as intended.

LucasDower commented 1 year ago

The reason this occurs by the way is because the texture coordinates are not in the range [0.0, 1.0], some texcoords are negative and need to be wrapped around into the range [0.0, 1.0] and looks like that wrapping process is wrong.

0-zen commented 1 year ago

Just tested your fix and yes it works with the models I have! Thank you very much =)