Incorrect diffuse irradiance spherical harmonics when using R11G11B10F format

Hello!
Noticed an issue when rendering environment maps in our scene, which is that the diffuse irradiance spherical harmonics generated through CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial are incorrect when using the `R11G11B10F` format. Maybe I’m doing something wrong in my repro, but I think I’m assigning all parameters correctly.

See repro here: Babylon.js Playground

There’s a bool at the top to flip between R11G11B10F and RGBA16F, where the latter case renders the results I expect. I also log in the console a value that is correctly 1 in the latter case, but strangely close to zero in the second case. You can also see it in the 2 spheres, where the left sphere is metallic (and shows correct specular) where the sphere on the right which is mostly diffuse is black when using R11G11B10F.

I haven’t looked deeper into this issue as I haven’t had the time, but thought I’d report it at least :slight_smile:

//Tore

cc @Evgeni_Popov

This PR will fix the problem:

1 Like