Skip to content

ISET3d Workflow

David Cardinal edited this page Oct 31, 2021 · 32 revisions

PBRT is a Physically-Based Ray-Tracing program designed to transform 3D descriptions of scenes -- including objects, their materials and textures, and lights, into a ray-traced representation of the scene.

The purpose of ISET3d is to enable the user to programmatically control how PBRT renders scenes from within Matlab. ISET3d relies heavily on the Recipe class. Recipes encapsulate PBRT scenes that have been read in, along with information about how they should be modified and then rendered through an optical system.

The ISET3d workflow is:

  • Read a PBRT scene text file into an ISET3d recipe (piRead) [By convention we use the variable name thisR for the current recipe.]
  • Inspect and edit the scene and rendering properties (thisR.set/get)
  • Write the recipe into a set of PBRT scene files (piWrite)
  • Render the files, returning ISETCam scene and oi structs that can include radiance, depth, labels, illumination (piRender)

The PBRT scene text file syntax and properties are readable and well-described in the PBRT v3 Book.

Limitations

PBRT scenes files created in the wild can be very complex. Parsing those files to transform their assets and rendering parameters into a recipe is not straightforward. At this moment we can read files that are exported from a Cinema 4d plugin which is part of the PBRT distribution, as well as files that are exported from Blender.

We are working on continuing to expand the range of PBRT scenes we are able to read into recipes.

Reading

ISET3d processing starts by reading a scene file (in text format) using piRead, returning a recipe (@Recipe) that contains the information needed to render the PBRT output files. ISET3d methods are then used to edit the recipe, including adjusting the rendering, geometry, material, and lighting parameters.

The syntax of PBRT scenes is specified in the PBRT book. A simple PBRT scene file is ISET3d/data/V3/sphere/sphere.pbrt.

# Exported by PBRT exporter for Cinema 4D 
Transform [1.0 0.0 0.0 0  0.0 1.0 0.0 0  0.0 0.0 1.0 0  0.0 0.0 500.0 1]
Camera "perspective" "float fov" [72.4573146388] "float focaldistance" [2000.0] "float lensradius" [0]
Sampler "halton" "integer pixelsamples" [32]
Film "image" "string filename" ["sphere.exr"] "integer xresolution" [1280] "integer yresolution" [720]
Integrator "directlighting" "integer maxdepth" [5] "string strategy" "all"
WorldBegin
	# Default Material
	Material "uber" "rgb Kd" [0.100481509938 0.119280187622 0.139984897558] "float index" [1.333]
	Include "sphere_materials.pbrt"
	Include "sphere_geometry.pbrt"
WorldEnd

This scene file contains information about the camera, rendering, and film. The file also Includes auxiliary files describing the assets (sphere_geometry), materials and textures (sphere_materials). Sometimes there is an Include about lights. The Include files contain information that can be very large (geometry) or information that applies to the whole scene (materials, textures, and lights).

Editing

ISET3d stores the information from the PBRT scene files in a Matlab class we call a recipe. The Quick Start and related workflow sections provide information about how you can inspect and edit the recipe parameters. We are trying to make all edits available via the thisR.set and thisR.get methods.

Writing

The function piWrite creates new versions of the original PBRT files with the modified parameters. These files are usually written out in the ISET3d local/ directory. These files will be rendered.

Rendering

The modified PBRT files in the ISET3d/local directory are rendered by piRender. The piRender parameters specify the data to be returned, which can include radiance or irradiance, a depth map, and metadata labels about the scene objects and materials.

If the recipe includes a lens, then the returned data are irradiance in the format of an ISETCam optical image (oi). If the recipe specifies a pinhole, then the returned data are radiance in the format of an ISETCam scene (scene).

Over time the scenes we create have become increasingly elaborate. In addition to expanding the set of PBRT scenes we can read, we are also working towards building a database of graphics assets and related resources for experimental testing. Here is an example of a fairly complicated scene rendered using ISET3d.

Clone this wiki locally