Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IBL specular persisting when specular disabled #33694

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/gles2/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -1560,12 +1560,14 @@ FRAGMENT_SHADER_CODE

#ifdef USE_RADIANCE_MAP

#if !defined(SPECULAR_DISABLED)
vec3 ref_vec = reflect(-eye_position, N);
ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz);

ref_vec.z *= -1.0;

specular_light = textureCubeLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).xyz * bg_energy;
#endif
#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 @@ -1798,6 +1798,7 @@ FRAGMENT_SHADER_CODE
#ifdef AMBIENT_LIGHT_DISABLED
ambient_light = vec3(0.0, 0.0, 0.0);
#else
#if !defined(SPECULAR_DISABLED)
{

{ //read radiance from dual paraboloid
Expand All @@ -1808,6 +1809,7 @@ FRAGMENT_SHADER_CODE
env_reflection_light = radiance;
}
}
#endif
#ifndef USE_LIGHTMAP
{

Expand Down