Homework 5 - Efficient Data Structures

Michael Callahan


I implemented uniform grids for this assignment. I'll do bounding box hierarchies a little later on and compare the two, but for now I had a hard enough time getting all the bugs out of my grid walking code.

I went ahead and moved the camera position from (2, 2, 2) to (2, 0, 0), since it made for a more interesting picture, and fills the screen better. I also turned off all lighting for the tests. The images were rendered at 512x512 with only 1 sample per pixel.


IRIX R10000 Timing Tests

I first ran the tests on a 195Mhz R10000 2.6, with 256MB of ram. The results are just gettimeofday calls placed before and after the rendering code, so are closer to clock time than actual compute time, and are only to the closest second.

Number of Spheres Pre-processing Time (sec) Ray Tracing Time (sec) Total Time (sec)
10 0 1 1
100 0 1 1
1000 0 2 2
10000 0 3 3
100000 1 9 10
1000000 9 25 34


Linux Timing Tests

I also ran the tests on a PII 300Mhz PC at home with 64M of memory, linux, and gcc. It's interesting because the default 'time' command there is better than on IRIX, so the output is more informative. The overall timings were suprisingly similar between the two systems.

10 Spheres
Initialization: 0 seconds
Trace time: 2 seconds
1.09user 0.02system 0:02.42elapsed 45%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (87major+206minor)pagefaults 0swaps

100 Spheres
Initialization: 0 seconds
Trace time: 3 seconds
1.39user 0.03system 0:02.88elapsed 49%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (87major+207minor)pagefaults 0swaps

1000 Spheres
Initialization: 0 seconds
Trace time: 4 seconds
1.83user 0.03system 0:03.76elapsed 49%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (87major+218minor)pagefaults 0swaps

10000 Spheres
Initialization: 0 seconds
Trace time: 6 seconds
2.96user 0.02system 0:06.13elapsed 48%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (87major+322minor)pagefaults 0swaps

100000 Spheres
Initialization: 1 seconds
Trace time: 11 seconds
5.90user 0.04system 0:12.22elapsed 48%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (87major+1352minor)pagefaults 0swaps

1000000 Spheres
Initialization: 15 seconds
Trace time: 26 seconds
19.86user 0.39system 0:40.65elapsed 49%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (225major+11689minor)pagefaults 0swaps

10000000 Spheres
malloc failed for 1084 bytes.  AIEEEE!!!
Command exited with non-zero status 255
32.39user 4.55system 1:27.39elapsed 42%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (25907major+41486minor)pagefaults 26768swaps

Code

Is available here, in case anyone wants to try it out. It's pretty ugly still though, I'll have to clean it up as part of the next assignment.


Images

These were all generated during the course of this assignment. There are also a couple of related images on my misc page.


This is the image of 1M flat shaded red spheres.


10000 Spheres, but uses 0.3/pow(i+1, 0.333) instead of 0.1/pow(n, 0.333).


Many variable sized phong shaded spheres. This image is frame 27 of a 120 rotation movie I rendered out. Unfortunately, the movie takes up 10M of space, so I was unable to put it here.