 |
 |
 |
 |
 |
Ray Tracer |
|
 |
|
- Ray tracer with support for spheres, cubes, and convex polygon meshes:
- Implemented in C++ for CS 488 assignment. Compiles and runs under Linux (gcc 3.X) and Windows (MSVC 7.1 and CYGWIN based gcc 3.X).
- Camera viewing orientation is defined by eye point, view direction vector, and up vector.
- Perspective transformation uses NDCs (normalized device coordinates) to map scene to unit volume centered around origin infront of eye (center of scene image).
- Adjustable FOV (field of view) and aspect ratio.
- Saves rendered images of any resolution to PNG images files (using libpng).
- Recursive tracing of shadow and reflection rays (refraction coming soon).
- Lambertian diffuse lighting and Phong specular lighting models fully implemented:
- Supports ambient light and any number of point source lights defined by absolute positions and colors.
- Supports light attenuation for shadow rays.
- Hierarchical scene representation loadable through Lua script interface, supporting:
- Materials with diffuse and specular colors, including shininess exponent.
- Textures with all material properties, scalable uv coordinates, and reflectivity (ranging from 0.0 to 1.0, with 0.0 for no reflection and 1.0 for perfect mirror reflection).
- Sphere, cube, and convex polygon mesh primitives that can be translated, rotated, and/or scaled.
- Multiple/batch renderings of a scene at different resolutions with different lighting (point source and ambient), FOV, and camera orientation in a single script.
- Polygon meshes are definable in scripts by vertex and face lists and/or loadable from external Alias|Wavefront OBJ mesh files using a Lua helper script.
- Ray tracing for hierarchical scenes involves inverse transformations on rays during top-down traversal and forward transformations on intersection positions and inverse transpose transformations on normals during bottom-up traveral.
- Cube intersection uses very fast parallel planes/slabs technique for finding closest intersection distance.
- Texture mapping with bilinear filtering and PNG image loading:
- Bilinear filtering per texel is done by taking a weighted combination of the 4 pixels laying around the area of the uv coordinate.
- Uses elevation/azimuth technique for calculating uv coordinate mapping for spheres.
- Allows for tiling and stretching of textures by specifying uv coordinates less than or greater than 1.0.
- Anti-aliasing with stratified/jittered super-sampling using 3x3/4x4 rays per pixel:
- Involves treating each pixel as a larger n x n grid of pixels (n being the sampling level) centered on where the original ray would have been casted. Each of the new n x n rays are separated by a small distance and randomly jittered within their own grid cell space.
- Full-featured command line argument interface for enabling Phong shading, shadows, reflections, texture mapping, rendering of bounding volumes, super-sampling at different levels, overriding width/height, and locking maximum trace recursion depth.
- Progress completion tracking (updated after each scan line of rendering) and summary of total ray tracing time (in seconds).
|
 |
|
|
|
 |
 |
 |
 |
|
|
|
|
|