Accessing first value in vertex struct

Is there a way to read in the single point values in a cg shader? I want to try storing object position in uv values.
Something like:

float3 worldPos;
worldPos.x = input.texcoord1.x[0]; // first uv points x value
worldPos.y = input.texcoord1.x[1]; //second uv points x value
worldPos.z = input.texcoord1.x[2];// third uv points x value

Doesn’t seem possible to read a specific index of the texcoord1 which means I could only store x and y position and would need to use something like tangents to store the z and have to store the same value on every point of the model, instead of just the first 3?

i’m a bit confused on what your asking but this is pretty simple if all you want is the world position in the fragment shader.

Let’s say you have this

struct data
{
  float4 pos : POSITION;
};

struct v2f
{
 float4 pos : SV_POSITION;
 float3 pos_to_uv : TEXCOORD0;
};

v2f vertex(data IN)
{
 v2f o;
o.pos = mul(_Object2World,IN.pos); //To multiply a 4x4 matrix by a vector the vector must be a float4
o.pos_to_uv = o.pos.xyz;
 //This is known as swizzling. Swizzling lets you make vectors from individual components of a vector.
 //using this method i have made a float4 into a float3(x,y,z). I could have just as easily done o.pos.xxx, o.pos.zyx, or 
 //any other combo of the above.
o.pos = mul(UNITY_MATRIX_MVP,IN.pos); 
return o;
}

This code will store your world position to

Sorry, let me restate the question hopefully a bit clearer. I have a series of objects all at the origin of the scene, 0,0,0. I want to offset their xyz position by values stored in the first 3 indices of the uv2 texcoord for each corresponding model.

Lets say I stored the x position in the first U value eg: polysurface.uv.x[0]=15. Then I store the y position in the second U value eg: polysurface.uv.x[1]=16, and the z position in polysurface.uv.x[2]=17;
Can I read just a single value index in a shader becuase it seems uv2.x contains all the U coordinates sent to the shader and there is no way to pick out the first index of each object. If this is not possible I guess I can use something like tangents or normals as the third y value to offset the position.

No.

These are “vertex” shaders, not “vertices” shaders. They only operate on one vertex at a time and know nothing of others.

Ahh, that makes sense.