Create an OBJ file that models a square pyramid with the following geometry:
The base of the pyramid is a square lying in the plane.
The side length of the base is 2 and its center is at the origin (0,0,0).
The height of the pyramid is at (0, 1, 0)
Start by modeling the geometry only - get the vertex positions and faces correct. Don't forget that triangle vertices need to be listed in counter-clockwise order from the perspective of someone looking at the "front" face of the triangle. Save your OBJ file using a text editor and drag and drop the file onto the mesh viewer to verify that you've got the geometry correct. In this mesh viewer, the back faces of triangles are shown in yellow, so if you see any yellow faces, you've probably got vertices specified in clockwise order.
Next, add normals to the faceted pyramid. This won't change the appearance in this case because the normals you're adding are the same ones that get automatically computed from the triangle faces. When you have this correct, you should be able to check the "Show Normals" box and see the normals for each triangle pointing in the direction that triangle is facing. Don't forget to check the triangles on the bottom of the pyramid too!
Finally, let's suppose the mesh represents some more complicated faceted shape and we want to estimate the normals. The object is faceted, so each vertex normal is just going to be the vector that's normal to the plane that the corresponding triangle lies in. Given a 3D triangle with vertices , derive an expression for the normal vector for that triangle.
Some helpful reminders:
The cross product gives a vector that is orthogonal to two other vectors. Its direction is determined by the right-hand rule.
We follow the convention that normals point towards the "front" of the triangle.
Normal vectors are conventionally stored as unit-length vectors.