Fix visual artifacts caused by invalid gbuffer2 on OpenGL
This commit is contained in:
parent
3c88ddcb23
commit
b3162d8f6e
|
@ -21,7 +21,9 @@
|
||||||
uniform sampler2D gbufferD;
|
uniform sampler2D gbufferD;
|
||||||
uniform sampler2D gbuffer0;
|
uniform sampler2D gbuffer0;
|
||||||
uniform sampler2D gbuffer1;
|
uniform sampler2D gbuffer1;
|
||||||
|
#ifdef _gbuffer2
|
||||||
uniform sampler2D gbuffer2;
|
uniform sampler2D gbuffer2;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _VoxelAOvar
|
#ifdef _VoxelAOvar
|
||||||
uniform sampler3D voxels;
|
uniform sampler3D voxels;
|
||||||
|
@ -206,7 +208,9 @@ void main() {
|
||||||
vec3 v = normalize(eye - p);
|
vec3 v = normalize(eye - p);
|
||||||
float dotNV = max(dot(n, v), 0.0);
|
float dotNV = max(dot(n, v), 0.0);
|
||||||
|
|
||||||
|
#ifdef _gbuffer2
|
||||||
vec4 g2 = textureLod(gbuffer2, texCoord, 0.0);
|
vec4 g2 = textureLod(gbuffer2, texCoord, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MicroShadowing
|
#ifdef _MicroShadowing
|
||||||
occspec.x = mix(1.0, occspec.x, dotNV); // AO Fresnel
|
occspec.x = mix(1.0, occspec.x, dotNV); // AO Fresnel
|
||||||
|
@ -221,14 +225,16 @@ void main() {
|
||||||
|
|
||||||
vec3 envl = shIrradiance(n, shirr);
|
vec3 envl = shIrradiance(n, shirr);
|
||||||
|
|
||||||
if (g2.b < 0.5) {
|
#ifdef _gbuffer2
|
||||||
envl = envl;
|
if (g2.b < 0.5) {
|
||||||
} else {
|
envl = envl;
|
||||||
envl = vec3(1.0);
|
} else {
|
||||||
}
|
envl = vec3(1.0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _EnvTex
|
#ifdef _EnvTex
|
||||||
envl /= PI;
|
envl /= PI;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
vec3 envl = vec3(1.0);
|
vec3 envl = vec3(1.0);
|
||||||
|
|
Loading…
Reference in a new issue