Assets
Building blocks of the scenesAssets are main building block for a scene for rendering. We need triangle meshes to define a shape to be rendered. Also we need BSDFs to assign materials to these meshes. Without lights nor sensors, nothing can be seen in the rendered images. Understanding the role for each asset is important to render scenes.
As we described in the previous section, assets
element is utilized to define assets to be used in the scene configuration file.
In this section, we will describe basic categories of assets, as well as speficic types for them.
Triangle mesh
Triangle mesh is a set of triangles which can define complex shapes. Triangle meshes are supported with various formats (obj format, ply format, etc. Many DCC tools support to create models with some trinagle mesh formats. Our framework is capable of loading these triangle meshes.
Raw mesh
Interface / Type
trianglemesh
/ raw
Description
Raw mesh is the most primitive way to define a triangle mesh directly speficying vertex and face data. This asset is useful to define relatively simple meshes without using DCC tools.
Parameters
positions
takes positions of vertices as a list of 3d vectors.normals
takes normal vectors associated to the vertex.texcoords
takes texture coordinates associated to the vertex. (optional)faces
takes a list of vertex indices to compose a set of triangles.
Example
This asset defines a quad mesh with two triangles, using a vertex information with four vertices.
mesh_quad:
interface: trianglemesh
type: raw
params:
positions: >
-1 -1 0
1 -1 0
1 1 0
-1 1 0
normals: >
0 0 1
0 0 1
0 0 1
0 0 1
texcoords: >
0 0
1 0
1 1
0 1
faces: >
0 1 2
0 2 3
Assimp loader
Interface / Type
trianglemesh
/ assimp
Description
Load a triangle mesh with Assimp.
If several number of meshes contains in a file, we utilizes only the first one.
Material data associated to the format (e.g., .mtl
for .obj
file) is ignored.
Parameters
path
specifies a path to the model file, relative to the directory where the scene file resides.
Example
This example defines an trinagle mesh to
load a obj file named bunny.obj
in the same directory as the scene file.
mesh_bunny:
interface: trianglemesh
type: assimp
params:
path: bunny.obj
Texture
The 2-dimensional texture to store information on the surface.
Texture is often used to add details to the surface.
This asset is often utilized as a reference from the other assets.
For instance, some assets of bsdf
interface can take a reference to the asset.
Bitmap texture
Interface / Type
texture
/ bitmap
Description
The texture loaded from the image files.
The asset supports various LDR (low dynamic range) image formats such as jpg
or png
. Also it supports two HDR (high dynamic range) image formats: exr
and hdr
. The types of the image format is determined from the extension of the file, so the user do not need to specify the type of the image file.
Parameters
path
: Path to the image file relative to the scene file.
Example
tex_kamen:
interface: texture
type: bitmap
params:
path: kamen.png
BSDF
BSDF describes how light reflected or refracted on the surface. In physically based rendering, BSDF is utilized to describe the material information on the surface. In this framework, we implemented some typical BSDFs with three categories: diffuse, specular, and glossy.
Diffuse
Interface / Type
bsdf
/ diffuse
Description
The BSDF implements basic Lambertian BSDF which models ideal diffuse surface. The diffuse surface reflects light with many angles exhibiting a rough-looking surface. Especially Lambertian BSDF assume the reflection occurs equally into all direction in the hemisphere around the point that light comes. Thanks its simplifity, Lambertian BSDF is often utilized in the rendering.
Parameters
R
: Irradiance reflectance with 3d vector.TexR
: Reference to the texture which represents irradiance reflectance on the surface point.- If both
R
andTexR
is defined, the renderer usesTexR
. - Intuitively we can think of
R
orTex
as the color of the object.
- If both
Example
The example defines two assets with diffuse type.
One specifies R
and the other specifies TexR
.
bsdf_red:
interface: bsdf
type: diffuse
params:
R: 1 0 0
bsdf_tex:
interface: bsdf
type: diffuse
params:
TexR: tex
Perfect mirror
Interface / Type
bsdf
/ reflect_all
Description
Models mirror-like material. This assets implements perfect mirror BSDF. With the BSDF, all incoming light reflects with respect to the (shading) normal at the surface point.
Parameters
R
: Specular reflectance with 3d vector.
Example
bsdf_S:
interface: bsdf
type: reflect_all
params:
R: 1 1 1
Flesnel
Interface / Type
bsdf
/ flesnel
Description
For some material such as glasses or water, we can see both reflected and transmitted scene. For instance, through the water surface of a pool, we can see the bottom of the pool while the reflected objects around the water.
Such phenomena can be described by Flesnel equations. Fresnel equations describes the portion of light to be reflected or transmitted between the two medium with different refractive indices. The BSDF models Flesnel reflection and transmission using the Fresnel equation for dielectric boundaries.
Parameters
R
: Specular reflectanceeta1
: Refractive index of the outer mediaeta2
: Refractive index of the inner media
Example
bsdf_S:
interface: bsdf
type: flesnel
params:
R: 1 1 1
eta1: 1
eta2: 1.5
Cook-torrance
Interface / Type
bsdf
/ cooktorrance
Description
The glossy material with Cook-Torrance model. The model assumes the microfacet normals are distributed around the surface normal. We utilized Beckmann distribution as microfacet distrbution. For Flesnel term, we utilized Flesnel equation for conductors.
Parameters
R
: Specular reflectanceeta
: Index of refraction of the conductork
: Absorption coefficient
Example
bsdf_G:
interface: bsdf
type: cook_torrance
params:
R: 1 0.64705882352 0.60784313725
eta: 0.140000 0.129000 0.158500
k: 4.586250 3.348125 2.329375
roughness: 0.1
Light
Light is the asset to simulate the light source (or illuminant) in the scene. Light emitted from the light source reflects on the scene surfaces, eventually reaches to the sensors. So without the lights, nothing can be seen in the scene. There are various types of light sources and we implemented some of them.
Area light
Interface / Type
light
/ area
Description
Area light is the light source associated with the surface. The asset can be used to simulate the self-emitting objects, that is, the object that emits light from the surface. Note that the associated mesh is specified within the scene definition, not with the parameter of the asset.
Parameters
Le
: Radiance emitted from the light source (emitted radiance, emittance).- This value is constant for all positions and direction on the surface, so the sum of the power emitted from the light sources depends on the area of the mesh associated to the light source. That is, larger light source illuminates the scene brighter.
Example
assets:
light_1:
interface: light
type: area
params:
Le: 1 1 1
...
scene:
nodes:
- light: light_1
mesh: mesh_quad
bsdf: bsdf_black
...
Directioinal light
Interface / Type
light
/ directional
Description
Directional light is a model of light source that all light comes from the single direction. We can assume that a large light source is placed on the infinitely distant position. The light source is useful for simulating sunlights, because the distance between the sun and the illuminated surface is large, we can assume the light emitted from the sun can be assumed as the direct light.
Parameters
Le
: Emitted radiancedirection
: Direction of the light. This direction can be rotated by the transformation specified by the transform node in the scene definition.
Example
light_directional:
interface: light
type: directional
params:
Le: 1 1 1
direction: -3 -1 -1
Point light
Interface / Type
light
/ point
Description
Point light models the light source on a point in the scene. The light emitted from the light source emits equally to all direction from the point. The light source has no volume in the space, so the shadow created with the light source shows sharp edges on the surface.
Parameters
Le
: Emitted radianceposition
: A position on the scene. This position can be transformed by the transformation specified by the transform node in the scene definition.
Example
light_point:
interface: light
type: point
params:
Le: 3 3 3
position: 1.5 1 0
Film
Film is the target for rendered image. This asset keeps track of the the pixel information of the rendered images on the memory while rendering. After the rendering finishes, we need to output the rendered images somehow. So the asset also has an ability to save the image into the disk or some implementation-dependent positions.
HDR film
Interface / Type
film
/ hdr
Description
The film to output HDR (high dynamic range) images.
HDRI is often utilized in many renderers because we can directly output the computation result (with floating-point values) so as to postpone preprocessing such as tone-mapping.
We supports two HDRI format: Radiance HDR (.hdr
) and OpenEXR (.exr
) formats.
Parameters
w
: Width of the output imageh
: Height of the output imagetype
: Type of the output image. Options:radiancehdr
outputs the image with Radiance HDR (.hdr
) format (default value).openexr
outputs the image with OpenEXR (.exr
) format.
Example
film_1:
interface: film
type: hdr
params:
type: openexr
w: 500
h: 500
Sensor
The emitted and reflected light are finally measured in the sensor of the camera. For humans, the retina with photoreceptor cells works as a sensor.
This category of the assets simulates the sensor of the camera or human eye.
The measured energy of the light is accumulated into
the film
(although there is no films in human eye).
So this type of the assets requires to have a reference to a film.
Pinhole camera
Interface / Type
sensor
/ pinhole
Description
Pinhole camera models a camera with simple configuration without lens, without finite-area aparture. The light coming from the scene must pass through a point (pinhole) before projected into the sensor plane. Thanks to its simplicity on its theory and implementation, the pinhole camera model is often used in rendering.
Parameters
We
: Importance of the sensor (sensibility of the sensor)fov
: Vertical field of view (FOV) of the sensorfilm
: A reference to thefilm
asset. The measured values are recorded into the film.
Example
sensor_1:
interface: sensor
type: pinhole
params:
We: 1 1 1
fov: 45
film: film_1
film_1:
interface: film
type: hdr
params:
type: hdr
w: 500
h: 500