Multiple Reflection textures and IBL

I’m trying to understand the relationship between pbrmaterial.reflectionTexture and the scene.environment. It seems like both do the same thing of illuminating the PBR material one is on a material level and the other is on a scene level(for all materials) - am I right?

If I have a scene with 2 rooms and each one of it needs its own reflection texture (generated by reflection probe), then will the reflection probes illuminate the objects in the same way if the scene were to be broken up 2 separate scenes each one with its own scene level .env file that is generated from the probe cubemap.

Yes exactly so some material could use a probe for instance while others use the default hdr.

In this case you would need to transition either at the material level or at the scene level the currently in use probe when switching rooms. This would basically be similar to dealing with 2 scenes except 1 might be easier for smooth camera transition/asset reuse and such

Thanks for that reply @sebavan . I got confused because a pbrmaterial.reflectiontexture can accept a simple cubetexture but scene.environment requires a .env. So I assumed they must do fundamentally different things.

But looks like it is exactly the same. Then why may we have a .env (with all its heaviness with mipmaps, etc.) versus have 6 jpgs representing the cube passed separately? I haven’t actually checked if 6*eachfacefilesize is much less than the .env file for my scene but assuming that .env files are going to be much larger.

To be used in PBR in a fast way without requiring a heavy shader (no real time filtering) you need to prefilter a cube texture. Prefiltering basically saves within the texture mipmaps the “blurriness”required for accurately rendering the roughness. This is why the format is complex.

Ah so it means that although .env file is larger with the mipmaps, it actually may help in lower power devices since we don’t need to do beefy shader calculations. So when scene performance is favored, .env files are better & when small download time is favored then cubemaps are favored.

Did I get that roughly right, @sebavan ?

I would almost always favored env :slight_smile: they are storing the full mip chain in png or webp so they would only be 30% bigger than the main mip alone. The other advantage is that they support hdr values.

1 Like