1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Use half float precision buffer for 3D when HDR2D is enabled

This is necessary for Environment effects like Glow to work correctly.
This commit is contained in:
clayjohn
2025-08-25 14:03:31 -07:00
parent c7b1767560
commit f61ee7bdf6
13 changed files with 60 additions and 53 deletions

View File

@@ -1563,7 +1563,7 @@ void main() {
indirect_specular_light = hvec3(textureLod(samplerCube(radiance_cubemap, DEFAULT_SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP), vec3(ref_vec), lod).rgb);
#endif //USE_RADIANCE_CUBEMAP_ARRAY
indirect_specular_light *= sc_luminance_multiplier();
indirect_specular_light *= REFLECTION_MULTIPLIER;
indirect_specular_light *= half(scene_data.IBL_exposure_normalization);
indirect_specular_light *= horizon * horizon;
indirect_specular_light *= half(scene_data.ambient_light_color_energy.a);
@@ -1585,7 +1585,7 @@ void main() {
#else
hvec3 cubemap_ambient = hvec3(textureLod(samplerCube(radiance_cubemap, DEFAULT_SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP), ambient_dir, MAX_ROUGHNESS_LOD).rgb);
#endif //USE_RADIANCE_CUBEMAP_ARRAY
cubemap_ambient *= sc_luminance_multiplier();
cubemap_ambient *= REFLECTION_MULTIPLIER;
cubemap_ambient *= half(scene_data.IBL_exposure_normalization);
ambient_light = mix(ambient_light, cubemap_ambient * half(scene_data.ambient_light_color_energy.a), half(scene_data.ambient_color_sky_mix));
}

View File

@@ -215,6 +215,10 @@ half sc_luminance_multiplier() {
return half(sc_packed_2());
}
// Like the luminance multiplier, but it is only for sky and reflection probes
// since they are always LDR.
#define REFLECTION_MULTIPLIER half(2.0)
/* Set 0: Base Pass (never changes) */
#include "../light_data_inc.glsl"