Progress so far
A couple of days into the project we were up and running with SDL2. The switch from SDL1.2 used in the labs wasn't really worth the effort, though. The program was now able to switch between wireframe (albeit with no wires) and raytracing to render a lonely test triangle. Camera controls were in as well.
Next addition were spheres. These are instances of the class Sphere, inheriting from the abstract class (interface) Object, which Mesh also inherits from. These Object instances are then added to a Scene instance which can be passed to each renderer in a call to renderScene(...). The ray-sphere intersection is calculated using what Scratch-a-Pixel calls the Analytic Solution.
Next we added loading of .OBJ files and created an .OBJ for the exact Cornell box used in the labs. Flat colors are pretty boring so we copied in the point lighting code from lab 2 (to be replaced later with the Phong lighting model). The triangles are contained in a Mesh object and each triangle contains a Material instance, at this point in time only supporting the single property "color".
Not having actual wires in wireframe mode was pretty silly, so we added some.
Next addition were spheres. These are instances of the class Sphere, inheriting from the abstract class (interface) Object, which Mesh also inherits from. These Object instances are then added to a Scene instance which can be passed to each renderer in a call to renderScene(...). The ray-sphere intersection is calculated using what Scratch-a-Pixel calls the Analytic Solution.
Multithreading came next. The implementation turned out to be completely straightforward and the increase in performance is as expected. The following video was captured on a laptop equipped with two physical cores and four logical cores (Intel i3-3120M) and we see a close to linear increase in performance going from one to two threads (~1.85x) and only very small improvements when using four or eight threads.
Finally, the loading of .STL files has also made it in.
Comments
Post a Comment