I’ve made a few things in Blender, but when I “import asset” them to Unity, the vertex colouring I gave them does not some with them. Loading the files in Blender confirms that it knows they have colour, but Unity does not seem to register that. Any ideas of what I’m doing wrong?
Are you using a shader that supports vertex colors?
This is a bare bones shader that displays vertex colors.
Shader "VertexColorOnly"
{
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// Data from the mesh
struct appdata
{
float4 vertex : POSITION;
fixed3 color : COLOR;
};
// Vertex to fragment
struct v2f
{
float4 posv2f : SV_POSITION;
fixed3 colorv2f : COLOR;
};
// Vertex function
v2f vert(appdata IN)
{
v2f OUT;
OUT.posv2f = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.colorv2f = IN.color;
return OUT;
}
// Fragment function
fixed3 frag(v2f i) : SV_Target
{
return fixed3(i.colorv2f);
}
ENDCG
}
}
}