With 3d modeling, blender is a reliable tool to use with unity. But I have never been able to color objects in blender and have that color show up in unity. Is there a way to export an object’s vertex color to unity? Or will I need to use uv textures, and if so where can I go to learn how to do this?
You have to use a specific shader. A vertex shader which has to use vertex color information. Here a simple one :
Shader "Custom/VertexColor" {
SubShader {
Pass {
LOD 200
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct VertexInput {
float4 v : POSITION;
float4 color: COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float4 col : COLOR;
};
VertexOutput vert(VertexInput v) {
VertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP, v.v);
o.col = v.color;
return o;
}
float4 frag(VertexOutput o) : COLOR {
return o.col;
}
ENDCG
}
}
}