Prefiltered dds resolution issue

While we are testing cubemap, we found that the prefiltered cubmap has lower resolution than the original. ( I mean the reflerction quality isn’t as same as before…)


As you can see, the left sphere has cubemap without prefiltered dds while the right has prefiltered one.

I’ve downloaded the project and opened the prefiltered dds file and found its size is 128 x 128 even though the original cubemap has 1024x1024.

Is there anyway to have prefiltered cubemap with higher resolution?

Thanks.

Hi @sooyong_Kim,

The prefiltered cubemap actually stores more than just the shiny refections. The mipmaps of the image store blurry versions of the environment, which are used at runtime to render image based lighting. The IBL runtime is hard-coded to support 128x128 sharp reflections and that can’t easily be changed.

If your object doesn’t have any blurry reflections though, you can use the ‘Cube Map’ slot on the material to specify shiny reflections instead. Set this to your cubemap and the object will reflect the original cubemap, not the prefiltered IBL (so rough reflections won’t work).

Screenshot 2022-04-01 at 09.00.35

Thanks!

Yes, it’s what I did…

What I want to do is to apply the blurry version of environment with higher resolution instead of 128 x 128.

Is there any way to create it externally and apply it?

No it’s not currently possible to generate a larger cubemap. This isn’t difficult to do, but not currently possible.

Should I have to work with the engine source? Is it possible to generate the same DDS prefiltered cube map with higher size from the external program or engine code?
What I want to do is use it after I publish the project and host it on my own server.

We have created several cubemap (dds) via cmftStudio and photoshop plugin, but none of them was working fine.

The test scenario is quite simple.

  1. we have created very simple project.
  2. publish it.
  3. find the location of dds file.
  4. Replace it with dds file have created via cmftStudio or photoshop plugin.

Can you kindly share how to generate the prefiltered dds file with any external tool.

This example generaetes prefilter cubemap at runtime:
https://playcanvas.github.io/#/graphics/box-reflection

You could inspect what it does. This is the code it calls into:

It’s possibly you could make this to generate higher resolution envmaps, but it’s likely you will need to do some modifications to the engine.

1 Like

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

Thanks~!! I will have a look at it…~!!!

1 Like

It’s strange that we cannot increase the Prefiltered Cubemap resolution without having to resort to code.
Why there isn’t an option to set the resolution, or at least use the original maps sizes?

Isn’t Playcanvas a PBR based engine?
We cannot use PBR (the glossiness factor) with an Environment cubemap unless we Prefilter the cubemap, which lowers it to 128.
Which means that if we are using an Environment cubemap instead of an HDRI we are limited to low resolution (barely usable) reflections?
Shoudn’t this limitation be explicit on the documentation? (The fact we cannot use environment cubemaps with decent resolution in PBR materials, otherwise not have pbr working at all)

I’m using Playcanvas for architectural rendering, which means every room in an apartment has it’s own cubemap (not a scene hdr, but individual room box probes, the entire thing is baked including the probes)
If one wants mirror reflections in each room, with a little bit of roughness, this means one has to prefilter the cubemaps and lower it to ugly levels.

On top: Mirror without prefilter: good resolution reflections (1024x), but too clean (the glosssiness slider doesn’t work, so no pbr here):
Below: Mirror with prefilter: low resolution reflection, barely usable, glossiness slider works, but in this image the glossiness is set to 100% for demonstration:

This is not a rough reflection this is the 128 prefiltered cubemap showing

If only we had an option to increase the prefiltered resolution :sob:
I’ll have to use the low resolution in the project because blurry kind of looks like rough, but this is definitely a sad limitation of this otherwise very nice engine.

Hi @Evandro_Costa ,

Yes this is a really important issue and a high priority for us. We have an open github issue here.

Hopefully we can have this implemented for the next minor engine release.

Thanks!

2 Likes

Hi Slimbuck
It would be really good indeed, I’ll have my fingers crossed

Thanks for your attention on the forums, and for the devs hard work on such issues.
My regards!