How to assign Normals to Procedural Mesh

Well, the thing is , i know how to assign the normals , tri’s , verts etc, and create a basic simple mesh, but what i can not figure out, and i havent found any article yet on just this, is how are normals calculated, with the vertices. I guess what i really mean is… for simplicity , lets take a Generated Triangle mesh.

So , with 3 vertices, 3 UV coords, 3 Normals, i position the vertices at something like …

vert1 Vector3(0, 0, 0)
vert2 Vector3(0, 0,1)
vert3 Vector3(1, 0, 1)

now the UV mapping is easy to understand , it only uses the x, and y values of each of those vectors used to place vertices. I get that, but i dont understand how to calulate the normal Vectors at all… my simple triangle just sits in pure darkness :(, haha. I must say this is my first whack at Creating geometery on the fly in unity, it seems pretty cool, if only i could light the faces up O.o (self illumination shader beats the problem , but not quite ideal).

Thanks for any help, just a pointer to an article maybe that covers this topic would be great. Im hoping that theres some kind of resource , article , video, small tutorial, not a big unity project? Any ideas.

There is a wonderful tool called RecalculateNormals… it means, you dont have to know everything that is going on… just let Unity play with it.

1 Like

Ahh , hehe , rock solid m8 , thanks. I see bump mapping is going to require a little extra effort if using procedural generation.