I am currently in the process of building a 3D graphics engine in C#. My aim is to not use any 3D libraries that would provide support. For that reason I am using the standard GDI available through the .NET framework. Its come on a lot further than I imagined. I have done all triangle plotting by hand and it fully supports texturing and .OBJ wave front file import (bar the smoothing groups)
As you can see from the cylinder above there is some shading from a fixed point light source. I use the normal of each face with the vector of the light to the triangle to calculate the triangle intensity. I am using the Lambertian Reflectance model to calculate the correct light intensity of each face.
My draw triangle function works by specifying 3 things:
- 3 * 2D-screen coordinates
- 3 * texture UV coordinates
- 3 * intensity of a vertex of the triangle (in the above screenshot each vertex on any given triangle will have the same intensity)
My question is this: If a group of triangles are in a smoothing group how would I calculate the light intensity at each triangle vertex?
I think I may be missing something...
Thank you in advance for any help. Hope this is the correct place and what not