Why does the glsl-function for sampler2DShadow
take a vec3
, when the depth buffer texture is a 2D
texture?
float texture(sampler2DShadow sampler, vec3 P, [float bias]);
This texture access does not return real value under the shadow map, but actually the result of comparison between point.z and a value in the map on location (point.x, point.y)- 0
or 1
(for nearest filtering), or value in between when linear filtering is used.
note that GL_TEXTURE_COMPARE_MODE
used in glSamplerParameter or glTexParameter should be enabled.