forked from mirror/openmw-tes3mp
depth bias
This commit is contained in:
parent
d5384403f3
commit
9f9183ff73
1 changed files with 6 additions and 4 deletions
|
@ -1,13 +1,15 @@
|
||||||
|
|
||||||
|
#define FIXED_BIAS 0.005
|
||||||
|
|
||||||
float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
|
float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
|
||||||
{
|
{
|
||||||
shadowMapPos /= shadowMapPos.w;
|
shadowMapPos /= shadowMapPos.w;
|
||||||
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
||||||
//float3 o = float3(0,0,0);
|
//float3 o = float3(0,0,0);
|
||||||
float c = (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1 : 0; // top left
|
float c = (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1 : 0; // top left
|
||||||
c += (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy + o.xy).r) ? 1 : 0; // bottom right
|
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.xy).r) ? 1 : 0; // bottom right
|
||||||
c += (shadowMapPos.z <= 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; // bottom left
|
||||||
c += (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1 : 0; // top right
|
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1 : 0; // top right
|
||||||
return c / 4;
|
return c / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue