Arbitrary varying variables in CG

Hi Guys,
This is probably a fairly noob question, but I’ve been battling with CG and the semantics for passing things between the vertex and fragment shaders.
I’m quite familiar with GLSL, and I’m just trying to work out how to create varying variables that I can set in the vertex shader and pass to the fragment shader.

The main problem I’m having is with the semantics in the structure that gets passed to the fragment shader. At the moment I’m just trying to pass the vertex normal to the fragment shader, but I also want to be able to send through some custom data that I calculate in the vertex shader.

if I try this:

struct v2f {

    float4 pos : SV_POSITION;
    float2 uv : TEXCOORD0;

    half4 spec, ambi : COLOR;
    float3 normal:NORMAL; //doesn't recognise NORMAL

};

It complains that NORMAL is an unrecognised semantic “Program ‘frag’, unknown semantics “NORMAL” specified for “norm” at line 49”

If I don’t give a semantic it complains too.
If I try adding other misc values to the struct I just get more issues.

Are there any clear explanations for how this works in unity floating around?

Thanks,
Ben

Try use “:TEXCOORD(some unused yet number)”.

Yeah, the available semantics are SV_POSITION, COLOR and TEXCOORD0 through to TEXCOORD7.