.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

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 .

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

HI @sebavan, i’ve a similar problem but in my application i use .env file embedded in base64. How can i solve using a solution similar to those you’ve posted? This is my PG: https://playground.babylonjs.com/#H09AM2#2
Thank’s in advance!

not sure why would you want to create an env file from an already existing env file ?

Ok maybe i don’t understand how to load an environment from base64 encoded file. How am i supposed to do?

EDIT: got it. https://playground.babylonjs.com/#H09AM2#5 Is there a way to use it also in v4.2?

nope, but 5.0 is only days from being released :slight_smile: