mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-19 16:39:41 +00:00
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)
|
||||
{
|
||||
shadowMapPos /= shadowMapPos.w;
|
||||
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
||||
//float3 o = float3(0,0,0);
|
||||
float c = (shadowMapPos.z <= 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 <= 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
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue