Wrong texture coordinates with OBJ
ddabrahim opened this issue · 2 comments
ddabrahim commented
Hi.
I'm trying to load an OBJ model using g3d but for some reason it does not apply the textures properly.
I have tested and the model does work fine with other engines.
This is how it supposed to look:
But this is what I get with g3d:
Here is an example project:
g3dtest.zip
Love 11.4
g3d 1.5.1
macOS 12.2.1
Any idea what could be the problem and if there is any work around, solution?
I would appreciate any help.
Thank you.
EngineerSmith commented
It works if you flip the texture vertically, which is weird as g3d doesn't change the pixel shader love uses, so it should just work. Could edit the obj loader to flip the textures vertically
Change line 32 to:
table.insert(uvs, {tonumber(words[2]), 1-tonumber(words[3])})
Or manually flip the texture
ddabrahim commented
Thanks a lot! Flipping the texture indeed worked.