This is something I only noticed because I have 360hz monitor.
Replication of this is pretty easy but I can provide sample if anybody does not observe the same behavior. Babylon version: Babylon.js v5.0.0-beta.9 - WebGL2 - Parallel shader compilation
I’m loading an .hdr file with HDRCubeTexture, and loading a glb file and adding to the scene.
According to the performance monitor my total frame time is 3.50ms. My total frame time climbs to 17.3ms if I set environmentIntensity to anything except 1 (the default).
I go from 240-280FPS to under 60FPS frame rate while environmentIntensity is set. I should note that I tried this on a few other machines without high refresh rate, and it’s not as noticeable. Despite the performance impact the framerate is still around the native refresh. It’s still slower, but far less apparent.
The envmap intensity does appear to change as expected, but surely this massive performance impact isn’t intentional.
I tried to repro without any luck, and the code is so straightforward I can not understand how this would happen Could you create a repro in the playground ? just in case
In case this is relevant: I asked a few people to test this with Nvidia / Intel GPU and seems to impact both. That being said, the initial FPS is lower on Intel integrated GPU so the difference isn’t quite as apparent.
Okay so I noticed one thing in the trace that’s different for sure. After setting envmapIntensity it looks like this markAllMaterialsAsDirty is occuring every frame.
I’m not a babylonjs expert so I may be looking for the wrong things here, but I’m not seeing this happen unless envmapIntensity is being set.
I was surprised to see this behavior too. I’m very glad we were testing performance after adding each line because I would never have expected this to have such a massive impact.
Basically we were flagging as dirty without reason on intensity change and The Gltf transmission is toggling it from its value to 1 between every render causing a ton of unnecessary overhead