Skip to content

Commit ca5aaf4

Browse files
committed
glsl/forwardLighting: do not compute specularity with physical map
1 parent 53fa3d1 commit ca5aaf4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/engine/renderer/glsl_source/forwardLighting_fp.glsl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,12 +975,13 @@ void main()
975975
}
976976
diffuse.rgb *= u_LightColor * NL;
977977

978+
#if !defined(USE_PHYSICAL_SHADING)
978979
#if defined(r_specularMapping)
979-
// FIXME: ignore if PBR
980980
// compute the specular term
981981
vec4 spec = texture2D(u_MaterialMap, texCoords).rgba;
982982
vec3 specular = spec.rgb * u_LightColor * pow(clamp(dot(normal, H), 0.0, 1.0), u_SpecularExponent.x * spec.a + u_SpecularExponent.y) * r_SpecularScale;
983983
#endif // r_specularMapping
984+
#endif // !USE_PHYSICAL_SHADING
984985

985986
// compute light attenuation
986987
#if defined(LIGHT_PROJ)
@@ -999,9 +1000,11 @@ void main()
9991000
// compute final color
10001001
vec4 color = diffuse;
10011002

1003+
#if !defined(USE_PHYSICAL_SHADING)
10021004
#if defined(r_specularMapping)
10031005
color.rgb += specular;
10041006
#endif // r_specularMapping
1007+
#endif // !USE_PHYSICAL_SHADING
10051008

10061009
#if !defined(LIGHT_DIRECTIONAL)
10071010
color.rgb *= attenuationXY;

0 commit comments

Comments
 (0)