Closed Overblob closed 6 months ago
I encountered this issue too while exporting a GLTF from Blender. What might be happening is that during the conversion process the value is somehow super scaled down.
Blender: 5.0 Emission strength
- Should be quite emissive, it shines brightly in Blender and other GLTF viewers, in Bevy you cannot see any glow.
Blender: 200_000.0 Emission strength
- The emission radius is several times the size of the object in Blender and other GLTF viewers are broken, in Bevy you can finally see a bit of glow.
No exact causes, but here's some info: Gltf emission map is in candela per square meter. Emission strength is a unit-less quantity which scales the emission map (so that the final output also has units of candela per square meter). This issue means we probably are messing up the units somewhere.
I just bisected between v0.12 and v0.13 to find the responsible commit: fcd7c0fc3d10591ba586880bd2cd24d366bd8d21 and associated PR: #11347
(Despite what I said, it finally may be related to exposure...)
Here we can see that the emissive_light gets multiplied by the exposure.
I tested after having moved out this variable from the parenthesis and boom, bloom worked again!
Still I'm not sure about this solution, as I don't master the exposure semantics.
As a side note, I 'd like to mention that as of #11347 examples for 2d and 3d bloom are not homogeneous when defining color values: not the same function, nor the same value ranges at all:
No exact causes, but here's some info: Gltf emission map is in candela per square meter. Emission strength is a unit-less quantity which scales the emission map (so that the final output also has units of candela per square meter). This issue means we probably are messing up the units somewhere.
Does that mean the tested value corresponds to 5 cd/m^2? Since that's is pretty low considering an LCD computer monitor is 200-300 cd/m^2 and Bevy's default exposure corresponds to a very bright indoor space / a heavily overcast outdoor scene. In those conditions, there's no way something 40x dimmer is going look like it is glowing...
The issue is that, as I understand it, the default exposure is tuned to match blender. So one would expect a gltf exported from blender to have visually similar emission. That's not the case.
The default exposure is tuned so that point lights and directional lights match Blender. Everyone assumes that Blender got the math right, but I'm personally not very convinced.
One possible explanation is that blender is multiplying the values of lights by 683 before exporting, but is leaving the emissive materials with their original scale. Thus when imported into Bevy emissives are 683x dimmer than they appear in Blender.
The default exposure is tuned so that point lights and directional lights match Blender. Everyone assumes that Blender got the math right, but I'm personally not very convinced.
One possible explanation is that blender is multiplying the values of lights by 683 before exporting, but is leaving the emissive materials with their original scale. Thus when imported into Bevy emissives are 683x dimmer than they appear in Blender.
This simple multiplication doesn't really match my observed values, either the problem is more complex, or a different number is used :P
Blender: 5.0 Emission strength - Should be quite emissive, it shines brightly in Blender and other GLTF viewers, in Bevy you cannot see any glow. Blender: 200_000.0 Emission strength - The emission radius is several times the size of the object in Blender and other GLTF viewers are broken, in Bevy you can finally see a bit of glow.
Bevy version
0.13
Relevant system information
What you did
Load a gltf (glb) scene using materials for bloom effect, and using KHR_materials_emissive_strength extension (supported since 0.12: #9553 ) Specifically the glb file used for this test: https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/EmissiveStrengthTest
What went wrong
what were you expecting? Bloom shall be displayed properly, as showed in the previous link
what actually happened? No bloom at all
Additional information
Seems to be a regression since 0.12 as it worked properly initially:
From v0.12.0
From v0.13.0
Edit : if the background seems brighter for v0.13 it's because the code uses the default exposure, which changed for this version, but as far as I can tell, this as no direct relation with the bloom issue (I tested the different const exposure values from the API)
Edit 2: minimal code to reproduce the issue: