Fixing shader; merge was wrong.
This commit is contained in:
parent
5dcabf0290
commit
a8fee3ad84
@ -51,8 +51,8 @@ float sampleDirectionalShadow(sampler2DShadow shadowMap, vec4 shadowCoord) {
|
|||||||
float visibility = 1.0;
|
float visibility = 1.0;
|
||||||
float bias = 0.001*tan(acos(clamp(dot(vNormal, -directionalLightVector), 0.0, 1.0)));
|
float bias = 0.001*tan(acos(clamp(dot(vNormal, -directionalLightVector), 0.0, 1.0)));
|
||||||
bias = clamp(bias, 0.0, 0.01);
|
bias = clamp(bias, 0.0, 0.01);
|
||||||
/*for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
visibility -= directionalIntensity/16*(1.0-texture(shadowMap, vec3(shadowCoord.xy + poissonDisk[i]/700.0, (2.0 * nearPlane)/(farPlane+ nearPlane - shadowCoord.z * (farPlane - nearPlane))- bias)));
|
visibility -= directionalIntensity/16*(1.0-texture(shadowMap, vec3(shadowCoord.xy + poissonDisk[i]/700.0, shadowCoord.z - bias)));
|
||||||
}
|
}
|
||||||
if (visibility == 1.0-(directionalIntensity/16)*4)
|
if (visibility == 1.0-(directionalIntensity/16)*4)
|
||||||
{
|
{
|
||||||
@ -60,11 +60,10 @@ float sampleDirectionalShadow(sampler2DShadow shadowMap, vec4 shadowCoord) {
|
|||||||
}
|
}
|
||||||
else if (visibility != 1.0) {
|
else if (visibility != 1.0) {
|
||||||
for (int i=0; i<12; i++) {
|
for (int i=0; i<12; i++) {
|
||||||
visibility -= directionalIntensity/16*(1.0-texture(shadowMap, vec3(shadowCoord.xy + poissonDisk[i]/700.0, (2.0 * nearPlane)/(farPlane+ nearPlane - shadowCoord.z * (farPlane - nearPlane))- bias)));
|
visibility -= directionalIntensity/16*(1.0-texture(shadowMap, vec3(shadowCoord.xy + poissonDisk[i]/700.0, shadowCoord.z - bias)));
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
visibility = texture(shadowMap, vec3(shadowCoord.xy, (shadowCoord.z - bias)/shadowCoord.w));
|
return visibility;
|
||||||
return (2.0 * nearPlane) / (farPlane + nearPlane - visibility * (farPlane - nearPlane));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float samplePointShadow(samplerCubeShadow shadowMap, vec3 lightDirection) {
|
float samplePointShadow(samplerCubeShadow shadowMap, vec3 lightDirection) {
|
||||||
|
Loading…
Reference in New Issue
Block a user