Description
Assignment 1
• Part A (Assignment 1): You will build the ray generation and ray-object intersection functions in this part. Your tasks are the following.
1. Read in the input file, which contains these lines:
✓ Eye position: E x y z
✓ Output Image: O ULx ULy ULz URx URy URz LLx LLy LLz LRx LRy LRz
✓ Resolution: R w h
✓ Sphere: S Ox Oy Oz r
✓ Triangle: T x1 y1 z1 x2 y2 z2 x3 y3 z3 Where:
The output image is a rectangle defined by the upper-left corner (ULx, ULy, ULz), upper-right corner (URx, URy, URz), lower-left corner (LLx, LLy, LLz), and the lower-right corner (LRx, LRy, LRz).
(Ox, Oy, Oz) is the origin of a sphere with the radius = r, and
(x1, y1, z1), (x2, y2, z2), (x3, y3, z3) are the vertices of a triangle.
2. Ray Generation: Determine the position of each screen pixel, then generate a ray from the eye position to each pixel.
3. Ray-object intersection: Determine whether a ray intersects the objects (which are the spheres and triangles defined by those lines starting with S or T in the input file.)
These modules require many 3D vector operations. Therefore you’re advised to use a 3D vector or matrix library (of your own choice) or to build your own.
In Part B (Assignment 2), we will extend the program in Part A to produce a color image with lighting effects. The detail will be announced in the next Assignment.
• Please name your programs “hw1” and submit it on Moodle
(https://moodle3.ntnu.edu.tw/course/view.php?id=29630). If you submit multiple files, then please pack your source files in a single ZIP or RAR file for the upload.
Reviews
There are no reviews yet.