Environmental reflection problem of gltf model

Hi, babylon. I found a problem when importing gltf model in: In the https://playground.babylonjs.com/#064AUB#65, the sports car paint will be relatively clear environment of the light reflected the effect of this and I see on the android, But import this model in https://sandbox.babylonjs.com/ (https://oss2-0001.oss-cn-beijing.aliyuncs.com/viewer/oss/data/glb/59_lamborghini_aventador_svj_sdc__free5.glb), car paint does not reflect the more prominent ambient light (this is consistent with my program on pc), I have not found the reason for these differences, anyone?

Car paint material name: “CARROSSERIE.”

In fact, the PG makes the reflection wrongly.

The texture of the environment should be pre-filtered, which is not the case for the skybox used as environment.

You can see what it should look like by turning on “Realtime filtering” for the “CARROSSERIE” material. You will see that the car is much less shiny, but that’s how it should be.

To get bright reflections on the cars, we usually activate the clear coat layer. In the sandbox:

Clear coat disabled:

Clear coat enabled:

I see, so what is the reason why ambient reflections are sometimes correct and sometimes wrong when real-time texture filtering is not turned on, and the order in which they are created? Whether unlimited real-time texture filtering will have a big impact on performance.

Environment textures must be pre-filtered to be used with PBR. It should be done off-line, as they normally don’t change at runtime.

In your case, you don’t really need a reflection probe, you could use a static environment texture. For eg:

I needed to change the skybox and ambient light during the runtime, so I chose the faster cubeTexture, which is also extremely expensive to create, so I used Light Probes to create smaller size ambient lights. CreateFromPrefilteredData has the same problem, it can have noticeable long stutters.

Yes, generating a prefiltered cube from a cube can take a little time, but I don’t see a way around it (I don’t think we can move the computation to a worker thread).

You can’t pre-generate the prefiltered cube off-line for all the possible skyboxes (if you know them in advance) and manage the ambient lighting through the ambient property of the material?

The pre-filter environment uses the same CubeTexture, which is different from the cubeTexture created by the ambient light probe. Is there a way I can convert the cubeTexture created by the ambient light probe into a pre-filtered texture. Ambient light can upload any HDR file in the program.

You can use the HDRFiltering class to convert a cube to a prefiltered cube.

For eg:

1 Like

Thanks a lot, this should be a perfect solution for me!

I found that HDRFiltering works on Android phones, which looks like it doesn’t work. IPhone works.What’s the reason?

This is normally meant to be used on desktop with plenty of resources and weblg2 :slight_smile:

HDRFiltering does not work on Android phones - Bugs - Babylon.js (babylonjs.com)
The mobile browser I tested supported webGL2, and I detailed the problems I encountered on this page. Open PBRMaterial realTimeFiltering, can really solve the problem of HDRFiltering don’t work, but I hope to know the reason why HDRFiltering doesn’t take effect.