Prefiltered dds resolution issue

Hi @sooyong_Kim,

I have submitted two PRs to help with this 4172 and 4171. The updates will go out with the next minor engine release.

With those changes in place, given a prefiltered cubemap you can generate a higher resolution env atlas as follows:

const prefilteredCubemap = ...;
const envAtlas = pc.EnvLighting.generatePrefilteredAtlas(prefilteredCubemap, {
    size: 1024    // default is 512
});

Then set the environment atlas on the scene:

this.app.scene.envAtlas = envAtlas;

If you have a normal high-res cubemap (i.e. not prefiltered) make sure it has mipmaps, then generate the env atlas like this:

const cubemap = ...;
const envAtlas = pc.EnvLighting.generateAtlas(cubemap, {
    size: 1024   // default is 512
});

If you have a 2d equirect image (for example an hdr) you can generate the env atlas in two steps:

const env = ...; // 2d hdr equirect
const lightingSource = pc.EnvLighting.generateLightingSource(env, {
    size: 256    // default is 128
});
const envAtlas = pc.EnvLighting.generateAtlas(lightingSource, {
    size: 2048
});
lightingSource.destroy();

For reference, the model-viewer demonstrates how to generate both a high resolution skybox and prefiltered env atlas from a 2d equirect here.

Hope that helps!

2 Likes