Glb display issue

Hi there,
I have glb models, when i upload them into sandbox then it looks fine but i import into react application they look in different size. What could be the issue?

Here is how it looks like in both scenario.

Babylon sandbox

In React App.

Playground link

You will get better results with PBR materials by using an environment texture:

4 Likes

I have created a function and binded it in componentDidMount. still not able to have environment as in playground. Am i missing something?

Capture5

Does your environment file exists? Also, you can check the createDefaultEnvironment function to quickly build one: Scene | Babylon.js Documentation (babylonjs.com)

3 Likes

Thanks for your valuable time and concern @carolhmj. Actually issue was i didnt have proper url to import texture into react app so i tried this and it worked for me.

addEnv = () => {
var hdrTexture = new BABYLON.CubeTexture(“https://assets.babylonjs.com/environments/environmentSpecular.env”, scene);
hdrTexture.gammaSpace = false;
scene.environmentTexture = hdrTexture;
};

1 Like

Hmm, it looks like you are now loading the .env as a CubeTexture, where I believe to get the best out of it you should load it as prefiltered (just like you did before).

2 Likes

@mawa, his will do the same :slight_smile: load it from the envloader

2 Likes

@mawa I tried CreateFromPrefilteredData as well, got the same output as with CubeTexture.

2 Likes

Thanks for the info. Just another automagic :magic_wand: behavior of BJS I wasn’t aware of. One day this framework will do everything without me doing anything :grin:. Good for my small brain :dizzy_face: :wink: Have a great day then :sunglasses:

2 Likes

can you tell me how you converted a scene into glb file in react js?? I am having issues in converting it to glb

This can help Babylon.js docs