Bare Bones Ray Tracing
Due: Feb. 22, 2021 @ 11:59 PM
Important Notes
- Read the submission instructions carefully!
Table of Contents
Specification
For your first programming assignment you will implement a bare bones ray-tracer with the following capabilities:
1. Ray-object intersection support for:
Planes Reference: Basic Ray Tracing Jan 28.
Spheres Reference: Ray-Sphere Intesection Feb.11
Triangles Reference: Ray-Triangle Intersection Feb. 16
2. Orthographic projection and perspective projection
Reference: Basic Ray Tracing Jan. 28
3. A movable camera
Reference: Cameras Feb. 9
4. Multi-jittered sampling for the primary rays
Reference: Sampling Feb. 4
5. Simple shading using the Blinn-Phong or Phong reflectance model.
Just do diffuse (Lambertian) shading without any specular component.
Use a point light and do not recurse…just shade the hit using a surface normal and the direction to the light.
Reference: Phong Shading Feb. 4
6. Hard shadows
Reference: Hard Shadows Feb. 9
7. Output images in one of PPM or PNG format.
Reference: RTiOW Section 2
Technical Details
-
You can use any programming /platform you wish
-
You can use any math library/package you wish to support the vector/matrix operations you need to perform
- The documentation standard is simple.
Each function or scoped block of code should have a comment describing the following:- The purpose of the function
- The inputs to the function
- The return value(s) if any
- If you use code from other sources, you must document that in a text file named README.md in your handin
FAQ
1. Should my images look like the one on this page?
Not exactly! You can ignore the cylinder and the box…you won’t render those.
And you can be creative. Generate any scene you want as long as it demonstrates the elements shown here.
Also, you should be aware that the scene on this page is in perspective, which is why there is a horizon from the plane.
An orthographic scene will not appear the same…
2. Can use code X that I found on the web?
Probably! In general, code to do basic numerical work (e.g. cross-product or even barycentric coordinates for a point) can be from a library.
You can ask on CampusWire about specific pieces of code.
Whether you use a library or copy source code from some approved source, you must cite the source in a text file named README.md in your handin.
3. In what order should I implement these features?
I would implement things in the following order:
1. Image output, orthographic and persepctive projection, ray-plane intresection (with flat shading)
2. Spheres, diffuse shading, movable camera
3. Triangles, multi-jittered sampling, shadows
Test as you go…save your test cases for re-use if possible.
Hand-in
You will hand in your code and 5 images:
-
One orthographic rendering of a scene with sphere, a plane, and triangles at a resolution of at least 500x500.
-
One perspective rendering of the same scene at a resolution of at least 500x500.
-
An additional perspective rendering of the same scene from a different viewpoint at a resolution of at least 500x500.
-
Two images illustrating the effects of using jittering.
The first image should use a single ray for each pixel.
The second should use multi-jittering.
You can reduce the resolution to something small in order to see the difference.
Submission Instructions
Hand-in will be done on Compass.
Name | Points | Description |
---|---|---|
Commented code | 5 | Comment code as described in the MP specification |
Ray-Plane Intersection | 5 | Be able to render a plane. |
Ray-Sphere Intersection | 5 | Be able to render a sphere |
Ray-Triangle Intersection | 5 | Be able to render a triangle |
Movable Camera | 5 | Be able to generate a render from an arbitrary viewpoint and direction |
Orthographic and Perspective Projection | 5 | Be able to render using either type of projection |
Multi-Jittered Sampling | 10 | Be able to render an image using multi-jittered sampling for anti-aliasing |
Simple Diffuse Shading | 5 | Use the diffuse shading term from the Phong reflection model |
Hard Shadows | 5 | Be able to produce hard-edged sahodws as shown in the image on this page |
Total | 50 |