I’ve been searching around for information on this with no success. Unlike other threads, I’m not trying to stop interpolation. However, what I am trying to get - is consistent interpolation.
I’ve noticed that, when assigning the same data, the UV and UV1, the tangents, and the color channel, the values are all interpolated differently when interpreted in the surface shader.
Here I provide data to the mesh; I deliberately have given them the same info for testing.
if (colors != null && colorCounter == verticeCounter)
{
mesh.colors = colors.ToArray<Color>(colorCounter); //resizes from static array (used to avoid GC)
mesh.tangents = colors.ToArray(colorCounter); //converts colors to vector4's
mesh.uv1 = colors.ToArray(colorCounter, false); //takes the latter two values from the color array
mesh.uv = colors.ToArray(colorCounter, true); //takes the front two values from the color array
}
struct Input
{
//...
float4 colors;
// ....
};
void vert (inout appdata_full v, out Input o)
{
//grabs from UV coordinates
o.colors.xy = v.texcoord.xy;
o.colors.zw = v.texcoord1.xy;
//grabs from vertex color
o.colors.xyzw = v.color.xyzw;
//grabs from tangents
o.colors.xyzw = v.tangent.xyzw;
}
void surf (Input IN, inout SurfaceOutput o)
{
//.....
fixed4 tex;
tex.xyzw = IN.colors.xyzw;
o.Albedo = tex.rgb;
//.....
}
The color set results in an even interpolation;
The UV and tangents sets result in an odd interpolation, far different from the color channels…
UV’s: Dropbox
Tangents: Dropbox
The UV set is fairly close, but still off.
I’m essentially using a tri-planar shader and blending between multiple textures. I calculate the tangents, and UV’s are based upon world position. I’d like to use these color channels for additional blends, but with the interpolation being incorrect, that is nearly impossible.
Does anyone know the reason for this, and potentially, have additional ideas on how to blend multiple texture sets and information?