I am trying to render a 3D model (from volvis.org) with Gouraud shading using the marching cubes algorithm. So far I have the normals for each vertex with:
GetNormalForVertex(vertex &b, vertex &a, vertex &c) {
u.X = a.X - b.X;
u.Y = a.Y - b.Y;
u.Z = a.Z - b.Z;
v.X = c.X - b.X;
v.Y = c.Y - b.Y;
v.Z = c.Z - b.Z;
return Cross(u,v);
}
I can see a nice flat shading when its rendered. Now, far as I know I need to interpolate those vertex normals to find normal at the intersection point to get Gouraud shading. How could I interpolate the vertex normals?