Just beginning to contact shader may be confused about TEXCOORD0, Sv_target, Sv_position, and so on, these fields indicate what meaning, the following is to chat about its former present.
"Semantics", as the name implies, to interpret the meaning of something, if previously exposed to CG, HLSL programming, it may be very familiar with. To put it bluntly, semantics allows shader to know where to get the data and to know where to place the output data .
Then in unity, using TEXCOORD0 to decorate texcoord,unity will recognize TEXCOORD0 semantics and then populate the first set of textures in the model into Texcoord.
Of course, some people may be confused about the semantics of the SV Start is God horse East,SV is actually the meaning of System-value (System value) , it is necessary to note that SV begins with the semantics of the expansion of the platform, so can use the semantics of the SV beginning to use the semantics of the start of SV, Eliminate the hassle of cross-platform.
Model → Vertex shader common semantics
POSITION: Vertex position
Normal: vertex normal
TANGENT: Vertex tangent
Texcoord0-texcoordn (Unity built-in structure seems to support 6): Vertex texture coordinate
color: vertex color
Vertex shader → fragment shader
Sv_position: Vertex coordinates in clipping space
COLOR0: Vertex color
COLOR1: Vertex color
texcoordn: texture coordinates
Fragment Shader output semantics:
Sv_target: The output value is directly used to render the
The last thing to note is that if the parameter or return value of the function in the shader is a struct, do not give a semantic value to the struct, not to mention that the novice does not understand that it is really doing so. If you do not understand the welcome message exchange.