groverburger/g3d

Wrong texture coordinates with OBJ

ddabrahim opened this issue · 2 comments

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:
screenshot of correct rendering

But this is what I get with g3d:
screenshot of wrong textures

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.

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

Thanks a lot! Flipping the texture indeed worked.