PDA

View Full Version : texcoord lookup -- under-the-hood



pha3z
09-04-2005, 04:07 PM
I am working on a method of reading values from an image map in a fragment shader and using the values as texture coordinates when sampling a texture color with TEX. I need a technical question answered though.

Normally when you call TEX, you use fragment.texcoord[n] followed by 2D to indicate the look-up method. According to the ARB spec fragment.texcoord[n] contains four components s, t, q, and r. What type of values are stored in those components? My hope is that when you do a 2d lookup, q and r are ignored and s and t correspond to U and V on the mesh texture mapping. If this is not the case, I will need to know how I can convert my own U and V values into something that TEX can use where it would normally be given fragment.texcoord[n].

Jan
09-04-2005, 11:21 PM
Yes, s and t contain your UV-coordinates, r and q are ignored.
If you do a 3D or cube lookup, r is involved too, but q always gets ignored. However, it IS allowed, to use a 4D vector as texcoord, though only the necessary components are used for the lookup.

Jan.