.env conversion from .hdr throws an error

Hi,
I have used sandbox.babylonjs.com for converting the .hdr file to .env file and used it in many projects. It had been working earlier. But recently, I am getting an error while using recently created .env files from .hdr in sandbox.babylonjs.com and I attached the error below what I am getting in console. But, If I use the .env file which was created earlier, It is working properly.
How to solve this.
////

ERROR Error: Unsupported babylon environment map version β€œ2”
at Function.e.UploadEnvLevelsAsync (babylon.js:16)
at e.loadCubeData (babylon.js:16)
at A (babylon.js:16)
at babylon.js:16
at babylon.js:16
at XMLHttpRequest.g (babylon.js:16)
at ZoneDelegate.invokeTask (zone-evergreen.js:406)
at Object.onInvokeTask (core.js:28578)
at ZoneDelegate.invokeTask (zone-evergreen.js:405)
at Zone.runTask (zone-evergreen.js:178)

I think the reason is you’re still using 4.2.0. Sandbox uses preview version 5.0

2 Likes

Then How to switch. Because in npm, the 4.2.0 only available.

Use npm install babylonjs@preview or if you use vue. you can edit version number in package.json


to npm install preview version.
NOTE: Please ensure that the version is consistent .

2 Likes

Oh. Is there any way to use 4.2.0 sandbox instead of changing the npm versions. Because, these versions you have shared are not stable. These are alpha version.

Alpha versions are stable :slight_smile: Some of the features are just not fully finished.

You could otherwise use this code locally:

scene.environmentTexture = new BABYLON.CubeTexture(url, scene);
BABYLON.EnvironmentTextureTools.CreateEnvTextureAsync(
            scene.environmentTexture as CubeTexture})
            .then((buffer: ArrayBuffer) => {
                var blob = new Blob([buffer], { type: "octet/stream" });
                Tools.Download(blob, "environment.env");
            })
            .catch((error: any) => {
                console.error(error);
                alert(error);
            });

Wow @sebavan . It is working. Great Thanks

1 Like