Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UV mapping not working on imported obj file

I have exported an .obj file (along with .mtl and a .png) from Blender to import into a libgdx project. The file contains both UV and normal data.

I am pulling the file into the app like this:

ModelLoader loader = new ObjLoader();
model = loader.loadModel(Gdx.files.internal("data/car.obj"));

The object should look like this: (Yes, I'm not an artist)

enter image description here

But it ends up looking like this:

enter image description here

What happened to my UV mapping?

like image 686
andypaxo Avatar asked Jul 11 '13 03:07

andypaxo


People also ask

Why is my UV map not showing?

The UV Map isn't visible in the UV Editor In short, check these things first. The first solution is to make sure our Mode is Set to Edit Mode in the 3D viewport. We can do this by pressing Tab, or by going to the mode menu in the top left corner of the 3D viewport.

Does OBJ have UV map?

No, a . obj file does not contain textures.

How do I add UV to OBJ?

Select your object. Go to UV > Unwrap > Smart UV Project. The following dialog will appear. Click OK to generate your UV mapping.

Why is my UV map not showing in Blender?

Go to object dat properties panel, open the uv maps section and delete the current uv map. Then just create a new one. That fixed it for me .


1 Answers

Use loader.loadModel(Gdx.files.internal("data/car.obj"), true); to flip the vertical texture coordinates. You can also flip vertical textures coordinates while converting to the g3dx file format: fbx-conv -f car.obj (-f is for flip vertical texture coordinates), which will give you a file called car.g3db and is more suitable for rendering. More info on how to load and convert models (and flip texture coordinates) etc. can be found here: http://blog.xoppa.com/.

like image 181
Xoppa Avatar answered Sep 25 '22 22:09

Xoppa