PBRMaterial - dynamically update texture with same image, but different outcome

Hi Babylon team,

I encountered this issue and I don’t know why it happens. It seems to occur on PBRMaterial only. I wasn’t able to reproduce it with dude model which has StandardMaterial.

I created a PG for this problem https://playground.babylonjs.com/#8IMNBM#267

The imported model has a material with name “Alien”. In the inspector, I can see the albedo texture used for this material is Alien_baseColor.png. This image is loaded from “https://playground.babylonjs.com/scenes/Alien/Alien_baseColor.png”. I update the albedo texture of the Alien PBRMaterial with the same image loaded from this url (line 11 in PG). You can see the mapping is different.

FYI: For the single-colored low-poly style models I used in my project, I rotated the texture image 90 degree clock-wise and the mapping is correct again.

Here is your solution: Available Mesh BoomBox | Babylon.js Playground (babylonjs.com)

More specifically:

mesh.material.albedoTexture = new BABYLON.Texture("https://playground.babylonjs.com/scenes/Alien/Alien_baseColor.png", scene, null, false);

By default, a texture is loaded with the invertY set to true

1 Like