Prototype for Version 2 - Part 2: System overview

Posted on Oct 29, 2015
Development Lightmetrica Prototype

In this article I will describe the overview of the rendering system developed in the prototying system. In order to focus on the implementation of the prototyping system itself, I utilized various libraries for some component of the renderer such as the ray-triangle intersection or model loading. In the following part of the section, I will focus on the implementation detail of some renderer components.


Parallelization is one of the major techniques to accelerate computations. Specially for rendering techniques based on Monte Carlo method, the computation is easy to parallelize because each sampling process can be computed independently. There is no inter-communication between processes. Although my project does not focus on the performance, I decided to employ parallelization thanks to its cost-effectiveness. As a simple way of parallelize my renderer, I adopted OpenMP, a parallelization framework which is possible to achieve parallelization with a simple set of compiler directives.

Although its simplicity, there is a few things to note with respect to the parallelization. First, the random number generator (RNG) must be managed per threads because internal state of RNG must not be shared between threads. In my implementation, I introduced a initial RNG to generate seeds of RNGs associated to each thread. Also, I duplicated the image data storage (called film) to each thread. Such a treatment is necessary for BDPT to avoid heady lock operations (although such a case rarely happens), because unlike path tracing, BDPT might generate light paths pointing to different pixel positions. In the process of rendering, the contribution is accumulated to the film associated to the thread instead of accumulating to the shared one. The final result is obtained by reducing them to one film.

Scene Description

Many rendering framework support configurable scene description file. In order to facilitate external control of the scenes, I designed and implemented the configurable scene description file. Standardized format such as COLLADA can support hierarchical form of the scene objects (scene graph), or high level control of asset management. However in my implementation, I took some assumptions to the design in order to reduce implementation cost:

  1. Loadable shapes are limited only to triangle meshes.

  2. One mesh must be associated with one material. That is, the user need to separate a mesh to some meshes associated to each materials beforehand.

  3. Transformation is not supported, so the user need to modify mesh positions beforehand. Although with such a limitations, it retains enough expressiveness to create a scene.

The scene description is written using YAML, which is known as a human-readable data serialization format.. In my system, a primitive is defined as a logical unit which associates a mesh and a material. In the scene definition, the primitives are enumerated beyond primitives element. Each primitive node has type element which represents the type of the primitive using Heckbert’s notation, e.g., L stands for a light source, D stands for a diffuse surface. Moreover, each primitive can have multiple types. The mesh associated to the primitive is specified in mesh element. And the parameters associated with the primitive types are specified in params element.

Ray-triangle intersection

Ray-triangle intersection is one of the most important features to accelerate Monte Carlo ray tracing including BDPT. However accelerating ray-triangle intersection is not a focus of the project. So in this project, in order to alleviate implementation cost and to focus on the implementation of BDPT itself, I utilized Embree to accelerate ray-triangle intersection. Embree is a collection of high performance ray tracing kernels specialized mainly to graphics applications, developed by Intel. This library is well optimized to the latest Intel’s CPU architecture and can facilitate advanced SIMD extensions such as AVX or AVX2. In my application, acceleration technique utilizing coherency of rays such as packet tracing cannot be used. So here Embree is configured to utilize the single-ray intersection technique based on SIMD accelerated Quad-BVH.


The system supports several types of materials: a diffuse material with Lambertian diffuse reflection, a specular material with Fresnel reflection and transmission, and a glossy material with Cook-Torrance model with Beckmann distribution. Moreover, diffuse and glossy materials support texture mapping. The parameters of these materials can be easily configured via scene description file. In terms of BDPT implementation, handling specular material requires careful implementation for generating correct result, I will describe the details in the another article.

Lights and Sensors

In my system, the sensor is fixed to the pinhole camera, although in design it is possible to implement other type of the sensor. Actually I implemented area sensor for debugging, which is a counterpart of the area lights and measures irradiance on a position of the mesh associated with the sensor. On the other hand, I implemented several types of the light sources: the finite-area light associated to a mesh in the scene, the point light, and the directional light. Just as specular materials, handling spatially or directionally degenerated light sources like point lights or directional lights needs careful handling in the BDPT implementation.