Doubt as inverted texture

i have loaded OBJ with a material like :slight_smile:

    BABYLON.SceneLoader.LoadAssetContainer("models/raptor/", "raptor.obj", scene, function (_container) {
            player_meshes = _container.meshes;
           
            
            let myMaterial = new BABYLON.StandardMaterial("mat_raptor", scene);

            myMaterial.diffuseTexture = new BABYLON.Texture("models/raptor/Raptor_Albedo2.PNG", scene);
            myMaterial.invertNormalMapX = true; 
            //myMaterial.invertNormalMapY = true;
            //myMaterial.bumpTexture = new BABYLON.Texture("models/raptor/Raptor_NormalMap.PNG", scene);

            //meshes[0].material = myMaterial;
            player_meshes[1].material = myMaterial;
            player_meshes[1].setParent(player_meshes[0]);
            player_meshes[2].setParent(player_meshes[0]);
            player_meshes[3].setParent(player_meshes[0]);
            player_meshes[4].setParent(player_meshes[0]);
            player_meshes[5].setParent(player_meshes[0]);
            player_meshes[6].setParent(player_meshes[0]);
            player_meshes[7].setParent(player_meshes[0]);
            player_meshes[8].setParent(player_meshes[0]);
            player_meshes[9].setParent(player_meshes[0]);
            

            // Adds all elements to the scene
            _container.addAllToScene();
            ready_play=true;
        });

but

in blender is correctly

i tried

myMaterial.invertNormalMapX = true;
myMaterial.invertNormalMapY = true;

myMaterial.invertX = true;

Hi @gilberto_barbosa try

scene.useRightHandedSystem = true

as Babylon.s is a left handed system by default.

1 Like

I only ever inverted on Y, when I was creating KTX files. I have no doubt that these are working. Inverting Y has them right side up, & inverting X has them backwards. Think all you should need to do is stop inverting X.

Is your texture a .dds texture?

I had some problems lately with dds texture that was displayed inverted whatever I did and converting them to .png “fixed” the problem.

Think that is because, like a ktx texture, you have to flip it on Y when it is created. He does show that they are PNG’s in the code.

Even by setting the invertY parameter of the Texture constructor did not change anything:
invertY = false:


invertY = true:

If using a .png instead and not setting the invertY parameter (so it is true by default):

Note: if anyone wonders, it’s an asset from the game Skyrim

So, from these tests, it seems the .dds texture loader does not honor the invertY = true value, or there’s something in the .dds file that conflicts with the code…

But it is not the problem of the op, as you said he is using png textures.

[EDIT] Sorry for the OT, but if someone is coming here because of inversion problem with dds pictures: it’s because the inversion does not work for compressed textures (s3tc and such) - the UNPACK_FLIP_Y_WEBGL = 1 gl flag does not work for such textures [/EDIT]

1 Like

My texture is PNG, i will try :

scene.useRightHandedSystem = true

great:

I don’t know what your requirements are, but if you can use glTF, these kinds of problems will be much less likely to occur as glTF is more strict on conventions.

ok, i will think about it

1 Like