An OpenGL-like lightweight library that supports the complete model-to-image rendering pipeline.
Given an .asc
file which defines triangle meshes of a 3D model, this library produces a 2D image of that model in .ppm
format and display on the screen by flushing the image into framebuffer as well.
-
Rasterization: Performed Linear Expression Evaluation (LEE) with vertex sorting for rasterization; solved hidden surface problem with Z-buffer; implemented Backface Culling algorithm to remove invisible faces thereby speedup the process.
-
Transformation: Achieved translation, rotation, and scale by leveraging homogeneous coordinate; supported transformation between different spaces (i.e., Model Space, World Space, Image (Camera) Space, Perspective (NDC) Space, Screen Space).
Image w/ translation Image w/ rotation Image w/ scaling -
Shading: Implemented Phong shading, Gouraud shading, and Flat shading; supported changing material appearance by altering specular/diffuse/ambient terms in shading equation.
Image w/ Phong shading Image w/ Gouraud shading Image w/ Flat shading Image w/ metal appearance Image w/ plastic appearance Image w/ matte appearance -
Texture: Provided functionalities on applying image texture or procedure texture; performed perspective correction in affine space to correct distortion.
Image w/ perspective correction Image w/o perspective correction Image w/ image texture Image w/ procedure texture -
Anti-aliasing: Used regular-jittered super-sampling for anti-aliasing.
This project requires Windows platform and Visual Studio 2019 to build and run.
- Download and install the toolkit for Visual Studio 2019 by checking
Desktop development with C++
(alsoC++ MFC for latest v142 build tools
in the installation details) inTools -> Get tools and features
. - Open the solution file, click
Build
.
To visualize .ppm
file, you can download the free software Irfanview.
- Change or put your
.asc
file and texture file insrc/
. - Open solution file, in Visual Studio, click
Debug -> Start Debugging
to launch the program. - Click
Renderer -> RunRender
to visualize image. - To perform transformation, click
Edit
and select corresponding transformations, then clickRenderer -> RunRender
to view the result.
The skeleton code (i.e., API and window) comes from course CSCI 580 3-D Graphics and Rendering, taught by Ulrich Neumann.