Documentation says allowed types in shader’s appdata structure are:
POSITION,NORMAL,TEXCOORD0,TEXCOORD1,TANGENT,COLOR.
But what if I need to interpolate single float value?Is there legal way to do this?
just stick the float into whatever you want. Their all just collections of floats anyway. You can abuse any channels and semantics you want, this is the basis of a lot of cool graphics techniques.
I would stick it into TEXCOORD1
TEXCOORD1 is occupied so I sticked to color.But what if I already use all these structs?It turns there is no chance to add user defined values except these six.
I believe you can make your UVs be 3- or 4-dimensional as float3s or float4s. I don’t know if this is recommended but it’s worth a try I think! The x and y components are usually used for your UV coordinates but you could use the z or w for whatever you’d like.