(I’ve been having a pain trying to google this. and searching through Unity manual for it was revealing lots of results with no clear explanation)
I’m looking at equations in shader examples like:
float2 steppedUV = IN.grabUV.xy / IN.grabUV.w;
// where IN.grabUV is TEXCOORD0, which is at least a float2.
The problem is that I don’t know what “.xy” is. is it the value of X * Y, is it a float2 being exported with the X & Y values? if it is a float 2 being returned, how does division work on float 2’s. My impression is in Unity you can’t divide a vector by another vector.
In shaders float3.xy (or float3.rg and all kinds of variations) address the subset referred to by the letters. So in case of float3.xy you get a float2 that has the x and y coordinates in it. In case of a float4.a you get the 4th component of the float, which is alpha channel for a color. Or a float4.w is also the 4th components.
If I remember correctly all combinations within the same set of letters are allowed (from rgba you can take just rb, or from xyzw yw (skipping z!), or from a texcoord uvw uw).
See here more examples (it’s not the shader language Unity uses, but it has similar syntax).