Render Engine Project
As part of my course work for 3-D Graphics and Rendering taught by Prof. Ulrich Neumann at USC I created a rendering engine that was able to output images in ppm format while taking the triangle lists as inputs.
The completed engine has major features such as 3D-transformations, rastorization, lighting, shading (Gouraud as well as Phong shading) , texturing, anti-aliasing. These features were added step by step to the engine throughout the semester. Below are some sample results and short descriptions of the same:
The first order of adding functionality to the renderer to allow it to draw 3D objects to the screen by simply reading the triangle list defined by the user. The rastorization was done by 3D transforming the triangle vertices from object to screen space followed by LEE (linear Expression Evaluation) algorithm and z-buffer testing for depth.
The image on the right shows the final result after rastorization.
- Lighting and Shading
The next step was adding lighting and shading support to the renderer. It can now support multiple light sources and perform both Gouraud and Phong shading. The lighting equation accounts for the specular, diffuse and ambient coefficients. The images above show the tea being lit by three separate distant light sources and both types of shading.
- Texture Support
The renderer supports ppm images as textures and can also generate procedural textures. The textures work with both types of shading.
Finally I encoded anti-aliasing within the rendering software. This was done using the neighboring sample points and using a weighted subsampling method. Essentially the result is obtained by rendering n times (where n is the number of samples), while shifting all x and y values by a different margin every time. Then all the pixel values are merged to give the new center pixel value.
The image to the left shows the anti-aliased image of the textured teapot. In this example six sub-samples are used to generate the effect.
The difference between this and the above textured image is made quite clear at the edges of the plane as well as the alphabets.