Generation of Prefiltered Environment Maps: Mipmaps

Hi everyone, I am new to JME so I begin with saying “Hello!” to everyone :slight_smile:

Out of interest in how it works, I am currently looking at the IBL code in the PBR branch and I am somewhat confused. In particular I have problems understanding how the Mipmaps are used for the Prefiltered Environment map.

My first question: In the function “generatePrefilteredEnvMap” mipmaps are generated in order to achieve a certain blurriness of the reflections based on the roughness of the material. What I don’t get is why a mipmap is generated for level 0. Couldnt you just use a copy of the original (for roughness 0)?

Furthermore, only a range of mipmaps is generated (int nbMipMap = (int) (Math.log(targetMapSize) / Math.log(2) - 1) ) What is the meaning of nbMipMap? As far as I know the number of mipmap-levels should be Math.log(targetMapSize) / Math.log(2) + 1, in order to get all mipmap levels up to the 1x1 mipmap. What is the reason for not generating all of the mipmaps`?

Thanks very much in advance,
n-i-c-l-a-s

Hey, thanks for your interest.
The prefiltered env map is not the raw env map data, it contains some light information baked into it, and that’s why we still need to generate the level 0.
Mimaps here are abused to actually store different blur level of the reflection. They are not actual mipmaps. Also we don’t need them all the way down to the 1x1 map, so we usually generate 6. The base reflection map is 128x128 and that would generate 8 maps.

2 Likes

Thanks for your reply, nehon! This was very helpful :slight_smile: