There are two texture maps and mapping methods:
- A PNG image of the earth mapped to a sphere using a transform from XYZ coordinates to spherical coordinates.
- A procedural checkerboard texture map for the plane. The color for the plane is calculated based on the intersection point.
The antialiasing technique used fairly simple. It takes the number of samples requested and generates that number of equally spaced rays through the corresponding pixel. Each ray's color is determined and the colors are averaged
Adding some jitter to the samples will provide better antialiasing. It would have been added to this version of the ray tracer, but too much time was spent rewriting the code from the previous assignment and fighting with C++. It isn't C++'s fault that my coding skills are rusty. That's my excuse for the simplistic antialiasing :)
The antialiasing removed the jaggy edges from the spheres, triangles and checkerboard pattern on the plane. It also made the earth texture less speckled.
The difference between 16 samples/pixel and 128 samples/pixel is subtle. I suspect that if the surfaces were not being modeled as perfectly smooth that the difference between 16 and 128 samples per pixel would be much more noticeable.
Interestingly, the rewrite sped up rendering by 60%. This was very surprising considering the number of abstractions added to the code.
tar jxf jbowles-assign4.tar.bz2
cd jbowles-assign4
make
./raytracer --width=512 --height=512 --reflections \
--shadows --samples=16
Usage: ./raytracer [options]
options:
--width Window width
--height Window height
--reflections turn on reflections
--maxdepth maximum number of reflections
(default 3)
--shadows turn on shadows
--samples square root of the number of
samples per pixel.
--perf turn on performance measurement
rendering
To exit, pressing Apple-Q, escape, or just q.
Output generated on a MacBook Pro 17" 2.4GHz dual core. Size of each image is 512x512. Each image can be clicked on to view a larger 1280x1024 version.
1 sample/pixel:
4 samples/pixel:
16 samples/pixel:
32 samples/pixel:
128 samples/pixel:
Alternate viewpoints:
Render times:
Samples | 512x512 render time (s) | 1280x1024 render time (s) |
1 | 0.323498 | 1.716881 |
4 | 1.189341 | 6.245954 |
16 | 4.617202 | 25.190776 |
32 | 7.222273 | 39.810833 |
128 | 36.107344 | 188.703291 |
No comments:
Post a Comment