Shader Vertex Data Format

Hi,

I am attempting to use the vertex data in a surface shader to get an angle. I have the camera centered at 0,0. In what coordinate system is v.vertex in the vertex function?

#pragma surface surf Lambert vertex:vert nolightmap 

void vert (inout appdata_full v, out Input o) 
	{
		o.svc =(1-(_vc*v.vertex.z)/sqrt(pow(v.vertex.x,2) + pow(v.vertex.y,2) + pow(v.vertex.z,2)))/sqrt( 1 - _vc  * _vc);
	}

I thought it would be the world coordinate system, but I get different results for objects that are rotated in unity when compared to objects that are rotated in 3DS Max ahead of time to look the same vertex wise. What data am I actually recieving with v.vertex.xyz?

It’s the unmodified “raw” coords, also known as local; before position or rotation, based on the model’s personal (0,0,0).

For world xyz, take v.vertex times the world matrix.

Maybe you could also inspect Unity3D.cginc there should be some snippets that handle this if I remember it right.