Question

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]);
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top