Docsity

Programming Assignment 2 on Computer Graphics | CSE 190, Assignments of Computer Science

Toggle sidebar
bg1
CSE190: Computer Graphics - Rendering Algorithms
Programming Assignment 2
Due 11:59pm, Monday, May 19
Henrik Wann Jensen
April 30, 2003 (revised May 6, 2003)
This assigment involves implementing two acceleration structures to the ray
tracer with the purpose of making it efficient in scenes with a large number
of triangles.
For all tasks the three builtin scenes 1, 2 and 3 that are built by the Triangles
constructor must be rendered using miro (or your own derivative renderer).
Note that if you use your own renderer then you must make sure that the cam-
era, the image resolution, the shading, and the sampling (1 sample through
the center of each pixel) matches the implementation in miro.
For reference here are the number of ray-triangle tests for the three scenes
unaccelerated at a low resolution of 16x12.
Scene Triangles Ray-triangle intersections
1 69451 13,334,592
2 69451 13,334,784
3 1389021 266,692,032
All the (accelerated) images should be rendered at 640x480 with 1 sample
per pixel.
Percentages indicate percentage value for this assignment.
This assignment requires reporting on results. Send a PDF file
or an ascii text file with the results, and send the source files (all
.cpp, .h and makefile - not object files) as a packed .tar.gz file to
[email protected] before the deadline.
Task 1: Implement and optimize a Bounding Box Hierarchy: 40 %
This task can be divided into a set of smaller tasks:
•Task 1a: Axis-aligned bounding box intersection test: 10 %
Compute bounding box for all the triangles and add a fast slab based
intersection test to see if an incoming ray intersects the box.
•Task 1b: Build the bounding box hierarchy: 10 %
Build the hierarchy for the triangles in the triangles object. One possi-
ble technique that can be used is building the hierarchy starting with
1
pf2

Partial preview of the text

Download Programming Assignment 2 on Computer Graphics | CSE 190 and more Assignments Computer Science in PDF only on Docsity!

CSE190: Computer Graphics - Rendering Algorithms

Programming Assignment 2

Due 11:59pm, Monday, May 19

Henrik Wann Jensen

April 30, 2003 (revised May 6, 2003)

This assigment involves implementing two acceleration structures to the ray tracer with the purpose of making it efficient in scenes with a large number of triangles. For all tasks the three builtin scenes 1, 2 and 3 that are built by the Triangles constructor must be rendered using miro (or your own derivative renderer). Note that if you use your own renderer then you must make sure that the cam- era, the image resolution, the shading, and the sampling (1 sample through the center of each pixel) matches the implementation in miro. For reference here are the number of ray-triangle tests for the three scenes unaccelerated at a low resolution of 16x12.

Scene Triangles Ray-triangle intersections 1 69451 13,334, 2 69451 13,334, 3 1389021 266,692,

All the (accelerated) images should be rendered at 640x480 with 1 sample per pixel. Percentages indicate percentage value for this assignment.

This assignment requires reporting on results. Send a PDF file or an ascii text file with the results, and send the source files (all .cpp, .h and makefile - not object files) as a packed .tar.gz file to [email protected] before the deadline.

Task 1: Implement and optimize a Bounding Box Hierarchy: 40 % This task can be divided into a set of smaller tasks:

  • Task 1a: Axis-aligned bounding box intersection test: 10 % Compute bounding box for all the triangles and add a fast slab based intersection test to see if an incoming ray intersects the box.
  • Task 1b: Build the bounding box hierarchy: 10 % Build the hierarchy for the triangles in the triangles object. One possi- ble technique that can be used is building the hierarchy starting with

one bounding box per triangle and then merging near bounding boxes. Alternatively, the hierarchy can be built by splitting the triangles and creating smaller bounding boxes in a top-down approach.

  • Task 1c: Intersect the hierarchy: 10 % Implement a heap-based method to intersect a ray with the hierarchy such that boxes are processed in the order in which they are intersected by the ray.
  • Task 1d: Optimize the hierarchy: 10 % Minimize the number of ray triangle and ray box intersections based on a cost function. Use the following cost: bounding box cost = 1, triangle cost = 4. Report the number of ray-triangle intersections (perhaps with a parameter study) and describe (briefly) the cost function that is being used. Particularly clever implementations will receive extra credit.

Task 2: Implement BSP tree acceleration: 60 % This task can be divided into a set of smaller tasks:

  • Task 2a: Triangle-Box intersection: 10 % Implement a function to test if a triangle overlaps with a given axis- aligned box.
  • Task 2b: BSP tree construction: 15 % Implement code to construct a BSP tree for a given number of trian- gles. The minimal set of parameters for the tree constructor should be maximum depth and maximum number of objects per node. Use the triangle-box intersection code from Task 1a.
  • Task 2c: Implement fast ray tracing of the BSP tree: 20 % Implement a ray traversal algorithm making it possible to trace rays through the BSP tree such that only triangles in the BSP nodes are checked for intersection. Once the ray tracer is implemented make a parameter study (depth and max objects per node) to investigate what combination of parameters result in the lowest number of intersections.
  • Task 2d: BSP tree optimizations: 15 % Design and optimize a cost function that can be used to build an ef- ficient BSP tree with a minimal number of ray-triangle and ray-plane intersections. As a starting point use the following cost-estimate: plane intersection = 1, triangle cost = 8. This task should be solved by carefully picking the splitting dimension x, y or z as well as the splitting plane position when building the BSP tree. Make a parameter study to investigate what combination of parameters result in the lowest number of intersections. Report the number of ray-triangle intersections as a function of parameters such as depth, number of bsp nodes, and cost function parameters. Describe (briefly) the cost function that is being used. Particularly clever implementations will receive extra credit.