cg shader question...

Started by
2 comments, last by c-mos 14 years, 10 months ago
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
Advertisement
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.
-----------------------Or, as I put it, MMORPG's are currently about attaining two primary things: strength and a shovel. The rest is you just shoveling sh** endlessly trying to get stronger to shovel more sh** so you can look for the next new shovel to shovel more sh** with. Once you are done, you can stand on top of a large pile of sh**, raise your golden sh** shoveler up high into the air and boast how proud you are to be the best sh** shoveler of them all. -Griffin_Kemp
Thank you,
i think i understood.

c-mos

This topic is closed to new replies.

Advertisement