# Make Mesh Appear Polygonal Instead of Rounded

Updated on January 21, 2017 in
14 on January 17, 2017

Hi everyone, I’ve been working on randomly generating a polygonal mesh (see my other thread here: http://forum.brackeys.com/thread/i-want-to-create-a-random-polygonal-map-generator-where-do-i-start/), and I’ve made a lot of progress. However, in the game view, the map looks like it has rounded edges, but in the wireframe view in the scene window it looks exactly how I’d like it to look. Is there anything I can do to change the individual faces of the mesh to be flat?

Game View:

Scene View:

• Liked by
on January 17, 2017

You have to look at your smoothing groups and normals.

on January 17, 2017

I’ve recalculated the normals at the end of my mesh generator script, is there anything else I should be doing with the normals? I’ll look into smoothing groups when I get a chance. Thanks!

on January 19, 2017

So I’ve since learned that the smoothed effect I was getting was caused by the RecalculateNormals() function that was being called. I’ve gotten rid of that, which has gotten rid of the smoothing. However, now the mesh isn’t being lit properly, it’s all the same color (kind of like an unlit texture).

Is there something I can do with the normals in order to keep the faces flat, but still have them lit?

Wise
on January 19, 2017

on January 20, 2017

Is there anything specific I can do with shaders to get the result that I want?

• Liked by
on January 19, 2017

public static Mesh Convert(Mesh mesh)
{
//Process the triangles
int[] triangles = mesh.triangles;

Vector3[] oldVerts = mesh.vertices;
Vector3[] vertices = new Vector3[triangles.Length];

for (int i = 0; i < triangles.Length; i++)
{
vertices[i] = oldVerts[triangles[i]];
triangles[i] = i;
}

mesh.vertices = vertices;
mesh.triangles = triangles;

mesh.RecalculateBounds();
mesh.RecalculateNormals();

return mesh;
}

on January 20, 2017

Hi- I’ve tried your function… Still getting the same result

Any other ideas?

Wise
on January 20, 2017

Can’t see pictures

on January 20, 2017

Try opening them in a new tab?

Wise
on January 20, 2017

on January 20, 2017

The problem with that is that the mesh is procedurally and randomly generated, which means it’s not something I can export and then import back in, because the mesh itself is generated at runtime.

Wise
on January 20, 2017

Look up .obj file formats 😉

Wise
on January 21, 2017

You can export it to a 3D model.

on January 21, 2017

It’s possible to export a newly created mesh while the game is running? If so, that’s definitely news to me… I’ll look it up, thanks for the tip!