cg shader question...
Hello,
i've seen in some shader examples
that ppl use this for instance
float4 color : TEXCOORD1
float4 pos : TEXCOORD2;
My question is, why do they use the TEXCOORD indexes ?
For color you usually use COLOR, or COLOR0...COLORn
kind regards,
c-mos
Because they're using a texture coordinate as a color, for shaders, it's just a convention. It's the same as passing with another indexer.
Hardware registers were originally intended only for certain types of data. Since data in those registers is going to get interpolated across a primitive it allowed an easy way for doing algorithms on a per fragment level instead of a per vertex level. By sending the position through as a texture coordinate through the vertex shader more accurate positions for the fragment shader are generated because you get the point between points. The standard rasterizer is going to interpolate color and texture coordinates(0-15). More recent hardware may allow the use of generic registers for interpolating values across a primitive.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement