Evil Orb
Alberto González PalomoThe code is derived from the solution to exercise 5, and uses only the objects and textures included there. Anything else is made procedurally. Click on the image above for the video.
Fractal Geometry
The tree is generated by recursively growing branches at the end of each one (the first one is the trunk), and growing leaves at the last recursion level. The branches are truncated cones of height 1 and same base diameter at the origin pointing upwards, which gets shaped and positioned using an affine transformation that is passed to the children.
The transformation is randomized, and the algorithm done in such a way that after adding recursion levels the random values for the previous ones are the same as before, so that the existing branches keep their shape as the tree grows.


Reflective and Refractive Transparency
Computes the reflected and refracted rays using Snell's law, and combines them proportionally using the Fresnel terms Rs and Rp, for s-polarized and p-polarized light.
Each ray has a field that indicates how big its contribution to the final image will be at maximum: if the reflected part is only 0.1, the contribution of the reflected ray will be equal or less that that, so if we reach a given threshold (set to 1/256 in the program) the recursion stops.


This is part of the MaterialPhongShader, that combines the PhongShader results with this to get a nicer final result.
Tone Mapping
Mapping the pixel values to keep as much detail as possible in the final image when they exceed the range [0,1].

Implemented by first avoiding clipping the pixel values when rendering th image, and then processing it when writing. Supports several modes:
- Clipping: the values are just clipped as before.
- Linear: the min/max values of the image are mapped to [0,1], and all intermediate values interpolated linearly.
- Adaptive: first a correction field is computed, with its values being the correction factor to bring the pixel luminance into [0,1]. Then that field is blurred by a convolution (3x3 matrix) to have smooth transitions from one pixel to the next. Finally those values are used for correcting the pixels when writing the image. This actually does not help much, which is why I could not produce a good screenshot.
Stereo Rendering
A new stereoscopic camera produces stereoscopic images using a variety of techniques.
This camera contains two PerspectiveCameras inside, one for each eye, which converge on the focus point as set by calling pointTo() in the stereoscopic camera. (Note: these screenshots use an eye separation half of the submitted code: it's a number passed to the camera constructor)
Anaglyph, left image in red, right image in blue. Command line option --stereo=anaglyph
Split screen (side by side), left part for the left eye, and right for the right eye. Requires looking with the eyes parallel, which most people find harder than the cross-eyed technique, or using an stereoscope. Command line option --stereo=split
Split screen, cross-eyed version. Command line option --stereo=split-x
Interlaced, for use in CRT screens with shutter glasses. Command line option --stereo=interlaced
Additional features
- Composite objects with different shaders for each part. This is used for instance in the fractal tree: the trunk and branches are one object, and the leaves another, so that they can have different shaders. CompositeObject.hxx
- Command options for the main program:
Usage: MicroTrace <options> --start=<start_frame> first frame number to render. The default value is 0. --end=<end_frame> last frame number to render. The default value is 360. --step frame number increment from start to end. --stereo=<mode> use the stereoscopic camera: anaglyph anaglyph (red/blue) mode. split split screen (left|right) mode. split-x split screen (right|left 'crosseyed') mode. interlaced interlaced (left/right shutter) mode. --final render the image in final size and quality. --hd render the image in hidef size and quality. --geomtest use quick shaders just for testing the geometry information. --quiet don't report frame render progress. --help -h show this help message.
- Affine transformations, used all around: AffineTransformationMatrix.hxx
The Object class and the Camera class (and all the derived ones: CompositeObject, FractalTreeObject, StereoscopicCamera) implement the method transform(T), where T is an affine transformation matrix. This required extending all the primitive objects (Primitive, InfinitePlane, Sphere, Triangle) to include it. - Extended PerspectiveCamera with pointTo() function, that can point the camera towards a given point, box (center), or object (center of its bounding box). PerspectiveCamera.hxx
- Key frame interpolator: KeyFrameInterpolator.hxx, which reads the key frames from text files, for the cow and the orb