Built-in component reference

This section describes build-in components. The label of each entry shows the key with interface::implementation format used in the instantiation of the component. The parameters of the components are given as an argument of Json type to lm::Component::construct() function.

Material

Components implementing lm::Material.

material::diffuse

Lambertian diffuse model.

Parameters
  • mapKd (str) – Diffuse reflectance as texture specified by asset name or locator.

  • Kd (color) – Diffuse reflectance as color value. If both mapKd and Kd are specified, mapKd has priority. Default: [1,1,1].

This component implements Lambertian diffuse BRDF defined as

\[f_r(\omega_i, \omega_o) = \frac{\rho}{\pi},\]

where \(\rho\) is diffuse reflectance.

material::mirror

Ideal mirror reflection.

This component implements ideal mirror reflection BRDF:

\[f_r(\omega_i, \omega_o) = \delta_\Omega(\omega_{\mathrm{refl}}, \omega_o),\]

where \(\omega_{\mathrm{refl}}\equiv2(\omega_i\cdot\mathbf{n})\mathbf{n} - \omega_i\) is the reflected direction of \(\omega_i\), and \(\delta_\Omega\) is the Dirac delta function w.r.t. solid angle measure: \(\int_\Omega \delta_\Omega(\omega', \omega) d\omega = \omega'\).

material::glass

Fresnel reflection and refraction.

Parameters

Ni (float) – Relative index of refraction.

This component implement Fresnel reflection and refraction BSDF, which reads

\[f_s(\omega_i, \omega_o) = F\, \delta_\Omega(\omega_{\mathrm{refl}}, \omega_o) + (1-F)\, \delta_\Omega(\omega_{\mathrm{refr}}, \omega_o),\]

where \(F\) is Fresnel term and \(\delta_\Omega\) is the Dirac delta function w.r.t. solid angle measure. \(\omega_{\mathrm{refl}}\) and \(\omega_{\mathrm{refr}}\) are reflected and refracted directions of \(\omega_i\) respectively defined as

\[\begin{split}\begin{eqnarray} \omega_{\mathrm{refl}} &=& 2(\omega_i\cdot\mathbf{n})\mathbf{n} - \omega_i, \\ \omega_{\mathrm{refr}} &=& -\eta\omega_i + \left[ \eta(\omega_i\cdot\mathbf{n})-\sqrt{1-\eta^2(1-(\omega_i\cdot\mathbf{n})^2)} \right] \mathbf{n}, \end{eqnarray}\end{split}\]

where \(\mathbf{n}\) is the shading normal on a position of the scene surface and \(\eta\) is relative index of refraction: \(\eta\equiv\frac{n_i}{n_t}\) where \(n_i\) and \(n_t\) is the index of refraction of the media on incident and transmitted sides of scene surface respectively.

For Fresnel term, we used Schlick’s approximation [Schlick1994]:

\[\begin{eqnarray} F = R_0 + (1-R_0)(1-(\omega_i\cdot\mathbf{n})^2),\; R_0 = \left( \frac{1-\eta}{1+\eta} \right)^2. \end{eqnarray}\]

Reflection or refraction is determined by sampling Fresnel term.

Schlick1994

C. Schlick. An Inexpensive BRDF Model for Physically-based Rendering. Computer Graphics Forum. 13 (3): 233. 1994.

material::proxy

Proxy material.

Parameters

ref (str) – Asset name or locator of the referencing material.

This component gives proxy interface to the other predefined material. This component is useful when we want to reuse predefined material but we also need to create a new instance.

material::mask

Pass-through material.

This component implements a special material that only sample the outgoing ray into the same direction as the incoming ray. This material is used to implement texture-masked materials. BSDF reads

\[f_s(\omega_i, \omega_o) = \delta_\Omega(-\omega_i, \omega_o).\]

Acceleration structure

Components implementing lm::Accel.

accel::sahbvh

Bounding volume hierarchy with surface area heuristics.

Features

  • Parallel construction.

  • Split axis is determined by longest axis.

  • Split position is determined by minimum SAH cost.

  • Uses full-sort of underlying geometries.

  • Uses triangle intersection by Möller and Trumbore [Möller1997].

Möller1997

T. Möller & B. Trumbore. Fast, Minimum Storage Ray-Triangle Intersection. Journal of Graphics Tools. 2(1):21–28. 1997.

Camera

Components implementing lm::Camera.

camera::pinhole

Pinhole camera.

Parameters
  • film (str) – Underlying film specified by asset name or locator.

  • position (vec3) – Camera position.

  • center (vec3) – Look-at position.

  • up (vec3) – Up vector.

  • vfov (float) – Vertical field of view.

This component implements pinhole camera where all the incoming lights pass through an small aperture and projected onto a film in the opposite side of the aperture. Unlike real pinhole camera, the apearture is modeled as a point, and the film can be placed in front of the pinhole.

The configuration of the pinhole camera is described by a 3-tuple by position, center, and up vector. position represents a position of the pinhole, center for look-at position. This means the camera faces toward the direction to center from position. up describes the upward direction of the camera.

Field of view (FoV) describe the extent of the viewing angle of the camera. In this implementation, the configuration is given by vfov parameter. Note that we adopted vertical FoV. Be careful if you want to convert from other tools that might adopt horizontal FoV.

Film

Components implementing lm::Film.

film::bitmap

Bitmap film.

Parameters
  • w (int) – Width of the film.

  • h (int) – Height of the film.

This component implements thread-safe bitmap film. The invocation of lm::Film::setPixel() function is thread safe.

Light

Components implementing lm::Light.

light::area

Area light.

Parameters
  • Ke (color) – Luminance.

  • mesh (str) – Underlying mesh specified by asset name or locator.