[SOLVED] Incorrect texture placement on loaded glft model

I am trying to open a gltf model on jME(3.4.0-stable) but the texture do not appear correctly.

Here is the model inside blender,

But, when loaded on jME with the following code,

    assetManager.registerLocator("C:/Projects/testJava2/Models", FileLocator.class);
    t = assetManager.loadModel("monkey.gltf");
    Material m = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    m.setTexture("DiffuseMap", assetManager.loadTexture("Untitled.png"));
    t.setMaterial(m);
    rootNode.attachChild(t);

    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(-.1f, -.7f, -1.f));
    rootNode.addLight(sun);

…the texture appears to be rotated,
image

I feel I am missing something simple.

Here are the Blend file, GLTF file and Texture png file.

1 Like

Replace

with

assetManager.loadTexture(new TextureKey("Untitled.png", false));

and see if it makes any changes?

2 Likes

That solved it. Thank you!

2 Likes

It’s odd that the gltf didn’t reference the texture and load it automatically with the right flipping. Maybe that’s on purpose on your part but in the long run you may want to think about your asset pipeline and where that failed.

…much easier the more automatic you can make it.