12-05-2016 10:41 PM
12-05-2016 11:15 PM
12-06-2016 12:18 AM
12-06-2016 12:34 AM
12-06-2016 12:54 AM
12-06-2016 01:01 AM
12-06-2016 02:44 AM
12-06-2016 04:56 AM
12-06-2016 09:58 AM
Shader "Custom/VertexColor" {
Properties{
}
SubShader{
Pass{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct vertexInput {
float4 vertex : POSITION;
float4 color : COLOR;
};
struct vertexOutput {
float4 pos : SV_POSITION;
float4 vertCol : COLOR;
};
vertexOutput vert(vertexInput v) {
vertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.vertCol = v.color;
return o;
}
float4 frag(vertexOutput i) : COLOR
{
return i.vertCol;
}
ENDCG
}
}
}
12-06-2016 01:49 PM
aurialLoop said:
I've found a way of using the vertex color information inside the non-standard medium obj file to create the mtl and png texture map.
I'm using MeshLab 64bit (free and open source) for this.
The basic structure is, copy your obj file somewhere (so as to not accidentally replace your medium obj):
1. Open MeshLab
2. File -> Import Mesh (your copied obj)
3. Filters -> Texture -> Parametrization: Trivial Per-Triangle
4. Increase texture dimension in Parametrization: Trivial Per-Triangle from 1024 to 2048 (will vary) and hit apply.
5. Filters -> Texture -> Transfer Vertex Attributes to Texture (between 2 meshes)
6. Change texture width and texture height in Transfer Vertex Attributes to Texture from 1024 to 2048, and tick Assign Texture.
7. File -> Export Mesh As and resave as an obj file
Now you should have an obj, an mtl and a png file that together will form your texture.
And here it is in unity.