lygia
/v1.1.6
/sample
/shadowPCF
)sample shadow map using PCF
Dependencies:
lygia
/v1.1.6
/sample
/shadowLerp
.glsl
Use:
<float> sampleShadowPCF(<SAMPLER_TYPE> depths, <vec2> size, <vec2> uv, <float> compare)
<float> sampleShadowPCF(<vec3> lightcoord)
#ifndef SAMPLESHADOWPCF_SAMPLER_FNC
#define SAMPLESHADOWPCF_SAMPLER_FNC sampleShadowLerp
#endif
#ifndef FNC_SAMPLESHADOWPCF
#define FNC_SAMPLESHADOWPCF
float sampleShadowPCF(SAMPLER_TYPE depths, vec2 size, vec2 uv, float compare) {
vec2 pixel = 1.0/size;
float result = 0.0;
for (float x= -2.0; x <= 2.0; x++)
for (float y= -2.0; y <= 2.0; y++)
result += SAMPLESHADOWPCF_SAMPLER_FNC(depths, size, uv + vec2(x,y) * pixel, compare);
return result/25.0;
}
#endif
Dependencies:
lygia
/v1.1.6
/sample
/shadowLerp
.glsl
Use:
<float> sampleShadowPCF(<SAMPLER_TYPE> depths, <float2> size, <float2> uv, <float> compare)
<float> sampleShadowPCF(<float3> lightcoord)
#ifndef SAMPLESHADOWPCF_SAMPLER_FNC
#define SAMPLESHADOWPCF_SAMPLER_FNC sampleShadowLerp
#endif
#ifndef FNC_SAMPLESHADOWPCF
#define FNC_SAMPLESHADOWPCF
float sampleShadowPCF(SAMPLER_TYPE depths, float2 size, float2 uv, float compare) {
float2 pixel = 1.0/size;
float result = 0.0;
for (float x= -2.0; x <= 2.0; x++)
for (float y= -2.0; y <= 2.0; y++)
result += SAMPLESHADOWPCF_SAMPLER_FNC(depths, size, uv + float2(x,y) * pixel, compare);
return result/25.0;
}
#endif
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository