PDA

View Full Version : texture filtering problem



apapaxionga
04-09-2011, 06:15 AM
in the orange book , it says that the fellowing code using sixteen samples per fragment to generate antialiased edges,but i do not understand why sixteen samples. the code just choose the those (-1,-1)(1,1)(1,-1)(-1,1) for samples ,why sixteen? the type of the return value of textureProjOffset is gvec4,but the type of sum is float ,why?
float sum;
sum=textureProjOffset(ShadowMap,ShadowCoord,ivect(-1,-1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (-1,1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (1,-1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (1,1));

Alfonse Reinheart
04-09-2011, 02:21 PM
It assumes that the shadow map is linearly filtered, so each texture access itself uses 4 samples to compute its value. 4 * 4 = 16.

Xmas
04-11-2011, 04:36 AM
the type of the return value of textureProjOffset is gvec4,but the type of sum is float ,why?
The return type of texel fetch function depends on the sampler type used. It is float when using a shadow sampler type.