Model texturing error with libgdx

I am having an issue with libgdx where when I load a model in any format the texture is not appearing correctly. I’m not sure what is causing this issue.

Example: In 3ds max or blender it looks like this

but when I put it into a libgdx project it looks like this

My code is based on

And I have tried it with and without the lights with no luck


//Loading the model
    assetManager = new AssetManager();
    assetManager.load("data/models/M4A1 SOPMOD/M4A1 SOPMOD.g3db", Model.class);
//Calling to an object and drawing it
public void create()
modelBatch = new ModelBatch();
    box = Assets.assetManager.get("data/models/M4A1 SOPMOD/M4A1 SOPMOD.g3db", Model.class);
    //box = Assets.getModelByName("M4");
    //box = modelBuilder.createBox(1f, 1f, 1f, new Material(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE), FloatAttribute.createShininess(64f)), Usage.Position | Usage.Normal);
    boxInstance = new ModelInstance(box);
    lights = new Lights();
    lights.ambientLight.set(1f, 1f, 1f, 1f);
    lights.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -0.8f, -0.2f));

public void Update(float deltaTime)
{, new Vector3(0, 1, 0), deltaTime* 50.0f);;

public void Render()
    modelBatch.render(boxInstance, lights);


My first guess would be that the texture coordinates need to be flipped, try adding (or removing) the -f command line option of fbx-conv (.e.g fbx-conv -f model.fbx).

You also might want to check your normals. Add the following line to your create method: DefaultShader.defaultCullFace = 0; and don’t apply lights. If this renders your model better, you probably need to recalculate the normals in 3ds max or blender. Don’t forget to remove the defaultCullFace line afterwards.

Finally, obviously, make sure the correct texture is loaded and don’t use high poly models.

Leave a Reply

Your email address will not be published. Required fields are marked *