I currently create a PMREM environment map from a cubemap at runtime with the following code but it crashes on iPhone:
const pmremGenerator = new THREE.PMREMGenerator(renderer);
pmremGenerator.compileCubemapShader();
const cubeTextureLoader = new THREE.CubeTextureLoader();
cubeTextureLoader.load([
'/assets/env-sky-cube-posx.jpg',
'/assets/env-sky-cube-negx.jpg',
'/assets/env-sky-cube-posy.jpg',
'/assets/env-sky-cube-negy.jpg',
'/assets/env-sky-cube-posz.jpg',
'/assets/env-sky-cube-negz.jpg',
], texture => {
const environmentMap = pmremGenerator.fromCubemap(texture).texture;
texture.dispose();
pmremGenerator.dispose();
scene.environment = environmentMap;
scene.background = environmentMap;
});
In Babylon.js I can create a .env file offline using CubeMapGen and .DDS to .ENV utility and load it with:
const environmentTexture = BABYLON.CubeTexture.CreateFromPrefilteredData('/assets/env-sky-cube.env', scene);
scene.createDefaultSkybox(environmentTexture);
Is there a way to do something similar in Three.js? Can PMREMGenerator save to a .env or .dds file?