This is an 3D Rendering Engine written in C++. For the details of this project, please see report.pdf. See my blog post (in Chinese) for other interesting stories..
Features
- Phong Model and Monte Carlo Path Tracing Model
- rendering of plane, sphere and mesh
- read mesh from a simple obj file
- fast SAH-Based KDtree
- depth of field
- custom texture
- mesh smoothing
- mesh simplification with polygon reduction
- qt-based gui
Usage
Dependencies
Compile
$ make (command line)
$ make gui (gui)
Use
Command line:
./ray-tracing <demo id>
, show demo scene (0~10) defined in main.cc
.
The display is based on OpenCV, allowing keyboard control of the viewpoint:
- Left/Right Arrow - Orbit around the center.
- Up/Down Arrow - Rotate the output picture.
- > < - Rotate viewpoint direction.
- = - - Zoom in/out.
- h j k l - Move viewpoint, keep direction.
- \[ \] - Move focal plane (only available in DOF demo)
GUI:
GUI is only an objviewer with some simple control.
Examples
Obj and ground texture:
Depth of field (There is also a video in demo/small/
):
Caustic using path tracing:
A Large scene: