6.1.7 Vertex shader input

The input and output of the vertex shader are defined by means of structures. In the input structure of the example you declare only the vertex attributes position and texture coordinates.

You can define more attributes as input, for example a second set of texture coordinates, normals in object coordinates, colors and tangents, using the following semantics.
struct vertexInput
{
	float4 vertex : POSITION;
	float4 tangent : TANGENT;
	float3 normal : NORMAL;
	float4 texcoord : TEXCOORD0;
	float4 texcoord1 : TEXCOORD1;
	fixed4 color : COLOR; 
};		
A semantic is a string attached to a shader input or output that provides information about the use of a parameter. You must specify a semantic for all variables passed between shader stages.
If you use incorrect semantics such as float3 tangent2 : TANGENTIAL, you get an error of the following type:
Shader error in 'Custom/ctTextured': unknown semantics "TANGENTIAL" specified for "tangent2" at line 32
For performance, only specify the parameters in the input structure that you strictly require. Unity has some predefined input structures for the most common cases of input parameter combinations: appdata_base, appdata_tan and appdata_full. These are described in the UnityCG.cginc include file. The previous vertex input structure example corresponds to appdata_full. In this case you are not required to declare the structure, only declare the include file.
Non-ConfidentialPDF file icon PDF versionARM 100140_0201_00_en
Copyright © 2014, 2015 ARM. All rights reserved.