/cournia.com/dev/null - gaze contingent display home
fragment.position November 13, 2003

I played around with fragment.position today to better understand how to go about coding an anisotropic convolution filter for a gaze contingent display. Again, I was amazed how easy and fun fragment programs are to use. Here's a simple linear fall off of about 100 pixels based on the viewers gaze:

   

Here's the fragment program I used to generate the images above. I should be able to easily optimize the code.

!!ARBfp1.0

ATTRIB pos = fragment.position;

PARAM eye = program.local[0];

PARAM zero = 0.0;
PARAM one = 1.0;

#lets say the user can see a radius of 100 pixels
#we use squared distances to avoid the sqrt()
#1 / (100 * 100)
PARAM radius = 0.0001;

TEMP sample, dist, cut;

TEX sample, fragment.texcoord[0], texture[0], RECT;

MOV dist, zero;
SUB dist.xy, pos, eye;
DP3 dist, dist, dist;

MUL dist, dist, radius;
SUB_SAT dist, one, dist;

MUL result.color, sample, dist;

END

  index