Skip to content

Commit

Permalink
Merge pull request #51416 from clayjohn/GLES-horizon-occlusion
Browse files Browse the repository at this point in the history
[3.x] Add horizon specular occlusion
  • Loading branch information
akien-mga authored Aug 10, 2021
2 parents 6518a61 + 1065f8d commit dad5d09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gles2/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,8 @@ FRAGMENT_SHADER_CODE
ref_vec.z *= -1.0;

specular_light = textureCubeLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).xyz * bg_energy;
float horizon = min(1.0 + dot(ref_vec, normal), 1.0);
specular_light *= horizon * horizon;
#ifndef USE_LIGHTMAP
{
vec3 ambient_dir = normalize((radiance_inverse_xform * vec4(normal, 0.0)).xyz);
Expand Down
2 changes: 2 additions & 0 deletions drivers/gles3/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,8 @@ FRAGMENT_SHADER_CODE
ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz);
vec3 radiance = textureDualParaboloid(radiance_map, ref_vec, roughness) * bg_energy;
env_reflection_light = radiance;
float horizon = min(1.0 + dot(ref_vec, normal), 1.0);
env_reflection_light *= horizon * horizon;
}
}
#ifndef USE_LIGHTMAP
Expand Down

0 comments on commit dad5d09

Please sign in to comment.