Ilia A. Lebedev


4/26/2010 - Assignment 4 : An HDR renderer (Slow Internet Beware!).

Notable Renderings

Both HDR and bitmap variants are included with some of the images. Many of the images lack sharp edges due to a depth-of-field effect.



The high dynamic range image (OpenEXR format)



The high dynamic range image (OpenEXR format)



The high dynamic range image (OpenEXR format)




high resulution
different camera angle

Executable and Source

Note: the source .zip is password-protected, and the password is included in the submission README. Please e-mail Ilia (ilial<at>berkeley<dot>edu) if you would like to obtain the source code.

  • A x86 binary is here.
  • A password-protected source tree and sample scenes is here. The password (and an unprotected archive) were included with the glookup submission. Please e-mail Ilia (ilial<at>berkeley<dot>edu) if you would like to obtain the source code.

Required Features

All required features have been implemented (see below). NOTE: We have extended the renderer to support multi-pass rendering, so one additional command is needed to produce the images described by the sample scripts:

render image

To use the renderer, either run the executable with no arguments (interactive mode, allows the commands to be typed into the console), or in batch mode (specifying one argument - the path to the script file). Please find the result of running our renderer with the sample scripts:
















Reflection, shadows, lights, and Phong shading are shown below.










Additional Features

In addition to the required part of the assignment, we went completely overboard with additional features. A complete list is included below, followed by a set of images that show off these features.

Refraction
Soft Shadows Directional light scattering, and spherical lights were added to simulate soft shadows.
Glossy Reflections
The appearance of brushed metal is easy with this effect, created by jittering the surface normal for computing the reflected ray.

Rough Transparent Surfaces
Refraction frost is a stochastic effect obtained by jittering the surface normal used for computing the transmitted ray. This effect is controlled separately from gloss.


Additional Primitives
The following primitives are implemented in our ratytracer:
  • Sphere
  • Triangle
  • Box
  • Disk
  • Infinite Plane

3D Texture
A 3D checkers texture is implemented.
See images above
Additional materials
The following materials were implemented
  • Phong
  • Flat
  • Lambert
  • Translucent (simulates finite penetration depth)

Anti-aliasing
We have anti-aliasing with a controllable number of samples (distributed according to the 2D gauss function) per pixel.


Depth of Field
Objects in outside of the camera's focal point appear blurry.

HDR rendering

Separate Render Passes
The renderer can output a depth map and a normal map in addition to the image. These can be used later in the production pipeline to alter lighting or add comoplex effects, such as depth-based fog or blur.



Scripting Language extension
We extended the scripting language with features such as an interactive console, and file imports (which allow portions of the scene or effect configurations to be stored and re-used).
see the section on the scripting language below.
Post-Processing Effects
Although only one post-processing effect (monochrome) was implemented, the framework was designed with post-processing in mind and easily allows others to be added.

Scripting Language

We significantly extended and improved the scripting language assigned as part of this project. While maintaining compatibility with the test scenes provided, the language includes hooks for the extra features of our compiler, and productivity features such as file sourcing and reset of the current scene. Offset addressing is uded to allow re-use via source.

The following shorthands are used in describing the semantics of the scripting language:

  • i_var : an integer value for "var".
  • f_var : a decimal value for "var".
  • s_var : a string value for "var" with no whitespace.
  • 3_var : a tiplet of decimal values for "var" (a color or a vector).
Command Semantic Description
Scripting Features
Source from File source (filename) Executes a script file, allowing re-use of scene parts. Due to
Comment #(...)\n If you don't know, I can't help you.
Scene Reset reset Removes everything from the scene. Useful in interactive mode.
Exit exit Terminates the interpretation of the current command stream. Useful terminating execution from file and in interactive mode
Global Settings
Output Resolution size (i_width >= 1) (i_height >= 1) Sets the dimensions (in pixels) of the image produced.
Maximum Recursion Depth maxdepth (i_depth >= 0) Sets the maximum number of ray bounces to simulate.
Samples per Pixel imagesamples (i_depth >= 1) Sets the number of rays to trace per pixel. Useful for anti-aliasing and stochastic effects such as DOF, gloss, and frost.
Output File Name output (s_filename) Sets the file name of the output image (no extension!). EXR format is used for HDR images, while 24-bit BMP is used otherwise.
Preview File Name preview (s_filename) Sets the file name of a JPEG preview file. Used when saving an HDR image for instant visualization.
Camera camera (3_eye) (3_center) (3_up > 0) (f_vertical_fov > 0) Specifies the origin, focus, and up vector, as well as the vertical field of view (in degrees) of the camera.
Lens Size (for DOF) dof (f_amount) Sets wjat is effectively the lens size for the depth of field effect. Distributed rendering is used to jitter the camera eye position, weighing the contribution of each sample using a gaussian function.
Maximum Vertex Buffer Size maxverts (i_num >= 1) Sets the max depth of the vertex buffer.
Maximum Normal Buffer Size maxvertnorms (i_num >= 1) Sets the max depth of the normal buffer.
Commands
Render render [hdr] (image/depth/normals) Invokes the renderer, which produces and saves the image. An optional "hdr" flag controls whether the image is saved as a high dynamic range file or a standard bitamp. Several render passes are available (and must be specified): depth map, normal map, and the full image.
Save Rendered Image save (ldr/hdr) Saves the last-rendered image as a high dynamic range image or as a standard bitmap.
Post-Process Rendered Image postprocess (monochrome) Applies the specified post-process effect to the image (currently only monochrome). Other effects, such as gaussian blur can easily be added.
Geometry
Sphere sphere (3_center) (f_radius) Creates a sphere of a specified radius at a specified location. The current material is applied.
Vertex vertex (3_center) Create a new vertex, which can be used for creating triangles.
Vertex with Normal vertexnormal (3_center) (3_normal >= 0) Create a new vertex with a specified normal, which can be used for creating triangles with interpolated normals.
Flat Triangle tri (i_idex >= 0) (i_idex >= 0) (i_idex >= 0) Create a new triangle using specified vertex indices (idexing is offset by a frame pointer, allowing creating a separate vertex address space for each sourced file). The normal is perpendicular to the triagnle plane. The current material is applied.
Triangle with Interpolated Normals trinormal (3_center) (f_radius) Create a new triangle using specified vertex indices (idexing is offset by a frame pointer, allowing creating a separate vertex address space for each sourced file). The normal is interpolated across the triangle area from the vertex normals. The current material is applied.
Box box (3_center) (3_dimensions) Create a new axis-aligned box of specified dimensions at the specified location. Use a rotation transform to move the box to a desired location. The current material is applied.
Plane plane (3_point) (3_normal) Create a new infinite plane given a point on the plane and a perpendicular vector. The current material is applied.
Disk disk (3_center) (3_normal) (f_radius) Create a new disk plane given a center point, a radius, and a perpendicular vector. The current material is applied.
Transformations
Push Transfrom pushTransform Pushes an identity transform to the stack.
Pop Transform popTransform Removes the most recently pushed transform from the stack.
Translate translate (3_xyz) Modifies the transform on the top of the stack to add translation by a specified vector.
Non-Uniform Scale scale (3_xyz) Modifies the transform on the top of the stack to add scaling by a specified tripple.
Rotate About Axis translate (3_axis) (f_degrees) Modifies the transform on the top of the stack to add rotation about a specified vector by the specified angle (in degrees).
Materials
Create a new Material material (flat/lambert/phong/translucent/checkers) (args) Creates a new material. The material shader must be specified, and can be one of:
  • Flat: cartoony shader with lighting and shadows.
  • Lambert: a diffuse material
  • Phong: a standard phong shader
  • Translucent: a partially opaque material, which simulates light scattering through materials such as milk and dense glass.
  • Checkers: A simple 3D checkered material with a wider band at the main axes for debugging.
Diffuse diffuse (3_rgb) Create a copy of the current material with the specified diffuse color.
Specular specular (3_rgb) Create a copy of the current material with the specified specular color.
Shininess shininess (3_rgb) Create a copy of the current material with the specified shininess.
Emission emission (3_rgb) Create a copy of the current material with the specified emission color.
Ambient ambient (3_rgb) Create a copy of the current material with the specified ambient color.
Transparency specular (3_rgb) Create a copy of the current material with the specified transparency. Transparency is used in the refraction calculations. The sum of transparency and reflectance should not exceed 1.
Reflectance reflectance (f_reflectance) Create a copy of the current material with the specified reflectance. Reflectance is used in the reflection calculations. The sum of transparency and reflectance should not exceed 1.
Index of Refraction ior (f_ior) Index of refraction is used in computing the angle of refracted light, according to Snell's law. The ray is correctly refracted when entering and leaving the surface.
Reflection Blur gloss (f_amount) A stochastic effect, which jitters the surface normal used in reflection calculations to produce a brushed metal effect. More than one sample is usually needed to get the desired result (glosssamples or imagesamples can be used to this end).
Reflection Samples glosssamples (i_samples) Sets the number of rays averaged in computing the reflection color. Useful with glossy reflections.
Refraction Blur frost (f_amount) A stochastic effect, which jitters the surface normal used to compute the transmitted ray to produce an effect similar to sub-surface scattering, or a rough transmissive surface (frost). More than one sample is usually needed to get the desired result (frostsamples or imagesamples can be used to this end).
Reflection Samples frostsamples (i_samples) Sets the number of rays averaged in computing the refraction color. Useful with frosty refractions.
Lights
Create Directional Light directional (3_towards_light) (3_color) Creates a directional light with the direction opposite the one specified (vector specifies the direction towards the light). The specified color is used.
Create Point Light point (3_towards_light) (3_color) Creates an unattenuated point light at the speficied position. The specified color is used.
Set Light Attenuation attenuation (3_const_lin_quad) Sets the constant, linear and quadratic attenuation of the last-created light.
Light Samples lightsamples (i_samples >= 1) Controls the number of times the light is sampled per lighting calculation. Useful when using a scattered or area light.
Light Spread lightspread (f_spread) Controls the amount of scattering for a directional light, or the size (spherical) of a point light. Used to produce a soft shadow effect.