And then I use this texture as reflection texture in my skybox and PBR materials:
// My skybox material
hdrSkyboxMaterial.reflectionTexture = this.scene.envTexture;
// My PBR material
wood.reflectionTexture = this.scene.envTexture;
But whenever I change the env texture the engine freezes until the change ends (1 to 5 seconds). The textures are only 180kb total and the HTTP request for loading them only lasts a few milliseconds.
I have another old application that uses Babylon v2 and it never freezes to load a new CubeTexture (detail: this old app does not use PBR).
Is there a way to avoid this behavior in v4?
Thanks for helping!!
EDIT: This is the code I’m calling to change the skybox material after loading the CubeTexture. This is basically the same on both applications:
You are not using an env texture at all but just a simple cubemap meaning the pbr material (requiring pre processed hdr textures) needs to do way more work at run time.
So either you load all the textures upfront and so, only the first application load will have a hit but it might be a big one depending on the texture size (4k, 1024…) and not directly the file size.
Hi @sebavan, thanks for responding… I removed all meshes and PBR materials keeping only a simple skybox in my scene an it still freezes when I try to create a new CubeTexture.
I have 500x500 jpg textures.
As I was recreating the pbr materials inside onLoad (with a console.log to check when onLoad is called), I think what is freezing is the “new CubeTexture” command. Seems like that recreating the pbr materials was fast than preparing the textures.
Does it make sense for you? Could I be doing something wrong?