diff options
author | clayjohn <claynjohn@gmail.com> | 2021-08-08 19:43:48 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2021-08-08 19:43:48 -0700 |
commit | 7bdea93497836388facc97d70e6d8e959ef38737 (patch) | |
tree | 36ae4854e7177fbc1ec049a05aba6a6efc7a65af /servers/rendering | |
parent | e010e05b3dd842ba86a68dee60e0d7be6f9aae50 (diff) |
Add horizon specular occlusion
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl | 2 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index b3a349c948..41977a38df 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -907,6 +907,8 @@ void main() { specular_light = textureLod(samplerCube(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), ref_vec, roughness * MAX_ROUGHNESS_LOD).rgb; #endif //USE_RADIANCE_CUBEMAP_ARRAY + float horizon = min(1.0 + dot(ref_vec, normal), 1.0); + specular_light *= horizon * horizon; specular_light *= scene_data.ambient_light_color_energy.a; } diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl index 70900a847c..18204680fa 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl @@ -843,6 +843,8 @@ void main() { specular_light = textureLod(samplerCube(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), ref_vec, roughness * MAX_ROUGHNESS_LOD).rgb; #endif //USE_RADIANCE_CUBEMAP_ARRAY + float horizon = min(1.0 + dot(ref_vec, normal), 1.0); + specular_light *= horizon * horizon; specular_light *= scene_data.ambient_light_color_energy.a; } |