Unable to Render the textures of the model in Babylon.js

I tried to load my model into the babylon.js scene, but some textures are not rendering correctly like Glass material, I’ve even tried uploading the model into sandbox to check whether my model is having any but everything seems to be fine. I have attached the pictures of the model in sandbox and in the scene.


The first picture is from Sandbox and the second one is from the scene.

My guess is the skybox is not present so you don’t have reflections. Can you please try to add a skybox in your playground?

1 Like

Yes, Skybox is already present.
Here is the code:
var skybox = BABYLON.MeshBuilder.CreateBox(
“skyBox”,
{ size: 5000.0 },
scene
);
var skyboxMaterial = new BABYLON.StandardMaterial(“skyBox”, scene);
skyboxMaterial.backFaceCulling = false;
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture(
“./assets/environment.env”,
scene
);
skyboxMaterial.reflectionTexture.coordinatesMode =
BABYLON.Texture.SKYBOX_MODE;
skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
skybox.material = skyboxMaterial;
skybox.intensity = 10;

Try to add these lines:

hdrTexture = new BABYLON.CubeTexture.CreateFromPrefilteredData("textures/environment.env", scene);
    hdrTexture.onLoadObservable.add(() => {
        scene.environmentTexture = hdrTexture;
    })
1 Like

Thanks.
After adding skybox i added these lines, it worked perfectly. :slight_smile:

2 Likes