Hello,
I try to generate a wall structure from vertices. After putting the generated mesh into a meshfilter and meshrenderer, the wall is displayed correctly. However, when I try to apply an outline shader (i.e. this one: [GitHub - Shrimpey/Outlined-Diffuse-Shader-Fixed: This is a fixed version of diffused outline shader from http://wiki.unity3d.com/index.php/Outlined_Diffuse_3][1]), it got some strange behaviour although it works with default meshes.
[119272-shader-problem.png*_|119272]
The mesh generation method works like this:
Vector3[] meshVertices = new Vector3[entity.Triangles.Count * 3];
int[] indices = new int[entity.Triangles.Count * 3];
int j = 0;
int k = 0;
for (int i = 0; i < entity.Triangles.Count; i++)
{
indices[j] = j;
meshVertices[j++] = entity.Triangles*.A;*
- indices[j] = j;*
_ meshVertices[j++] = entity.Triangles*.C;_
_ indices[j] = j;_
_ meshVertices[j++] = entity.Triangles.B;
}*
mesh.vertices = meshVertices;
mesh.triangles = indices;_
mesh.RecalculateBounds();
mesh.RecalculateNormals();
mesh.RecalculateTangents();
The Triangle class contains just 3 Vector3 Objects for each edge of the triangle.
I cant figure out why the shader behaves like shown on the picture instead of just laying an outline around the object. So help would be appreciated.
*[1]: https://github.com/Shrimpey/Outlined-Diffuse-Shader-Fixed*_
*