before the struct VOut { line. There could be more problems, but hopefully this helps. Might want to start with the tutorials in the ShaderLab documentation instead/also.
Currently vertex shader inputs are not based on semantics; instead they must use predefined names (vertex, color, normal, texcoord, texcoord1, tangent).
So in your case you should change vertex shader prototype to:
VOut vert (float2 vertex)
and later in the shader use “vertex” as the variable name:
output.position = float4 (vertex, 0, 1);
Using UnityCG.cginc is nothing magic, it just brings some parameters that are exposed by the engine into the shaders, and has some commonly used functions. You can always check out the contents of that file in Unity.app/Contents/CGIncludes/UnityCG.cginc
Vertex shader input semantics are there only for a single reason: so that the engine would know what data to pass where. If the engine can figure that out by some other means, it’s fine as well.
Currently Unity figures that out based on the names (not semantics). In the future this will be changed, so you can either use names (like it’s done now), or use whatever names you like and pass Unity-understandable semantics.
If semantics are not indicated, Cg compiler assigns them automatically “somehow”. For OpenGL, all vertex components get mapped to “generic vertex attributes”, and that’s fine.
Yes Aras, I understand perfectly, and i can assume how it can automagically pass the data too (based on the data types and the order of the parameters can be a type), as long as it’s logical.
It’s just i want to learn CG as it should be according to the book, but i understand perfectly what you mean.