forked from teamnwah/openmw-tes3coop
fixes shadows on glsles
This commit is contained in:
parent
a87092d11b
commit
c9750dc7c6
2 changed files with 9 additions and 9 deletions
|
@ -499,7 +499,7 @@
|
|||
|
||||
#if SHADOWS || SHADOWS_PSSM
|
||||
float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y;
|
||||
float fade = 1-((depthPassthrough - shadowFar_fadeStart.y) / fadeRange);
|
||||
float fade = 1.0-((depthPassthrough - shadowFar_fadeStart.y) / fadeRange);
|
||||
shadow = (depthPassthrough > shadowFar_fadeStart.x) ? 1.0 : ((depthPassthrough > shadowFar_fadeStart.y) ? 1.0-((1.0-shadow)*fade) : shadow);
|
||||
#endif
|
||||
|
||||
|
@ -514,11 +514,11 @@
|
|||
#endif
|
||||
|
||||
#if UNDERWATER
|
||||
float3 waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,0,1), waterLevel);
|
||||
float3 waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0.0,0.0,1.0), waterLevel);
|
||||
#endif
|
||||
|
||||
#if SHADOWS || SHADOWS_PSSM
|
||||
shOutputColour(0) *= (lightResult - float4(directionalResult * (1.0-shadow),0));
|
||||
shOutputColour(0) *= (lightResult - float4(directionalResult * (1.0-shadow),0.0));
|
||||
#else
|
||||
shOutputColour(0) *= lightResult;
|
||||
#endif
|
||||
|
@ -574,7 +574,7 @@
|
|||
#endif
|
||||
|
||||
// prevent negative colour output (for example with negative lights)
|
||||
shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0,0,0));
|
||||
shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0.0,0.0,0.0));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,11 +6,11 @@ float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
|
|||
shadowMapPos /= shadowMapPos.w;
|
||||
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
||||
//float3 o = float3(0,0,0);
|
||||
float c = (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1 : 0; // top left
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.xy).r) ? 1 : 0; // bottom right
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.zy).r) ? 1 : 0; // bottom left
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1 : 0; // top right
|
||||
return c / 4;
|
||||
float c = (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1.0 : 0.0; // top left
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1.0 : 0.0; // top right
|
||||
return c / 4.0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue