Environment map compatibility

Hi everyone,

I frequently use the “Generate .env texture” function within the sandbox to convert .hdr files into .env.
image

Now it seems like the sandboxs BabylonJS version has been updated to 5.0.0-alpha.50.
As a result, the environment map, that gets generated by the mentioned sandbox functionatliy, has also been updated to version 2.

Unfortunately this new environment format is not compatible with versions pre V5 anymore, which is a bit problematic if you don’t want to use pre-release version in your viewer.
The latest stable version of BabylonJS is 4.2.0 at this point.
I get the following error:
image

I am aware that there are other possiblities to use hdr textures, but the sandbox functionality was very handy until now.

So my questions are:

  • Is there a possiblity to create .env files within the sandbox, which are compatible with the latest stable BabylonJS version (4.2.0)?
  • Is it possible to open the sandbox with a different BabylonJS version as a whole?

I am a bit curious about the compatibility of the sandbox functionalities in general.
I understand that the sandbox is “only” a viewer tool and nothing will break when updating the BabylonJS version, even if it’s a pre-release version.
But on the other side there are also “export” functionalities, which need to be compatible with the BabylonJS version of the consuming project.

So what would be the suggested workflow for consuming projects, if they want to use the sandbox “export” functionalities (like “Generate .env texture”), but don’t want to upgrade to each pre-release version that the sandbox uses?

Best regards

1 Like

In your case I d suggest to generate it by code which is the simplest ?

The code is basically this:

scene.environmentTexture = new HDRCubeTexture(path, scene, 256, false, true, false, true);
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);
            });

In the mean time, I agree it is pretty annoying and I ll try to think about a way to generate compatible version.

1 Like