fix lighting bug introduced in clear color changes
This commit is contained in:
parent
bdf79f4c6e
commit
55d11330b0
1 changed files with 19 additions and 19 deletions
|
@ -1814,25 +1814,6 @@ FRAGMENT_SHADER_CODE
|
||||||
specular_blob_intensity *= specular * 2.0;
|
specular_blob_intensity *= specular * 2.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_FORWARD_LIGHTING
|
|
||||||
|
|
||||||
highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
for (int i = 0; i < reflection_count; i++) {
|
|
||||||
reflection_process(reflection_indices[i], vertex, normal, binormal, tangent, roughness, anisotropy, ambient_light, env_reflection_light, reflection_accum, ambient_accum);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reflection_accum.a > 0.0) {
|
|
||||||
specular_light += reflection_accum.rgb / reflection_accum.a;
|
|
||||||
} else {
|
|
||||||
specular_light += env_reflection_light;
|
|
||||||
}
|
|
||||||
#if !defined(USE_LIGHTMAP) && !defined(USE_LIGHTMAP_CAPTURE)
|
|
||||||
if (ambient_accum.a > 0.0) {
|
|
||||||
ambient_light = ambient_accum.rgb / ambient_accum.a;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// scales the specular reflections, needs to be be computed before lighting happens,
|
// scales the specular reflections, needs to be be computed before lighting happens,
|
||||||
// but after environment and reflection probes are added
|
// but after environment and reflection probes are added
|
||||||
// Environment brdf approximation (Lazarov 2013)
|
// Environment brdf approximation (Lazarov 2013)
|
||||||
|
@ -2038,6 +2019,25 @@ FRAGMENT_SHADER_CODE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FORWARD_LIGHTING
|
||||||
|
|
||||||
|
highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
for (int i = 0; i < reflection_count; i++) {
|
||||||
|
reflection_process(reflection_indices[i], vertex, normal, binormal, tangent, roughness, anisotropy, ambient_light, env_reflection_light, reflection_accum, ambient_accum);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reflection_accum.a > 0.0) {
|
||||||
|
specular_light += reflection_accum.rgb / reflection_accum.a;
|
||||||
|
} else {
|
||||||
|
specular_light += env_reflection_light;
|
||||||
|
}
|
||||||
|
#if !defined(USE_LIGHTMAP) && !defined(USE_LIGHTMAP_CAPTURE)
|
||||||
|
if (ambient_accum.a > 0.0) {
|
||||||
|
ambient_light = ambient_accum.rgb / ambient_accum.a;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_VERTEX_LIGHTING
|
#ifdef USE_VERTEX_LIGHTING
|
||||||
|
|
||||||
diffuse_light *= albedo;
|
diffuse_light *= albedo;
|
||||||
|
|
Loading…
Reference in a new issue