You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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:
@@ -142,6 +142,8 @@ float sc_luminance_multiplier() {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
#define REFLECTION_MULTIPLIER 1.0
|
||||
|
||||
#define SDFGI_MAX_CASCADES 8
|
||||
|
||||
/* Set 0: Base Pass (never changes) */
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -957,7 +957,7 @@ void reflection_process(uint ref_index, vec3 vertex, hvec3 ref_vec, hvec3 normal
|
||||
hvec4 reflection;
|
||||
half reflection_blend = max(half(0.0), blend - reflection_accum.a);
|
||||
|
||||
reflection.rgb = hvec3(textureLod(samplerCubeArray(reflection_atlas, DEFAULT_SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP), vec4(local_ref_vec, reflections.data[ref_index].index), sqrt(roughness) * MAX_ROUGHNESS_LOD).rgb) * sc_luminance_multiplier();
|
||||
reflection.rgb = hvec3(textureLod(samplerCubeArray(reflection_atlas, DEFAULT_SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP), vec4(local_ref_vec, reflections.data[ref_index].index), sqrt(roughness) * MAX_ROUGHNESS_LOD).rgb) * REFLECTION_MULTIPLIER;
|
||||
reflection.rgb *= half(reflections.data[ref_index].exposure_normalization);
|
||||
reflection.a = reflection_blend;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user