Skip to content
Ben Heasly edited this page Jul 26, 2013 · 41 revisions

RenderToolbox3 uses adjustments files during conversion of Collada parent scene files to renderer-native scene files. First, a Collada file is converted to a default renderer-native scene file. Then, elements from the adjustments file modify or replace elements of the default renderer-native scene file. Adjustments files and renderer-native scene files must use the same XML file format.

Collada parent scene files and default renderer-native scene files contain elements that are portable across applications, like cameras, lights, polygon meshes, and RGB colors. Adjustments files may introduce scene elements that are phyiscally-based or renderer-specific, like light transport sample generators and integrators, multi-spectral reflectances and illuminant spectra.

Usually you won't need to write your own adjustments file. RenderTooblox3 has default adjustments files for PBRT and Mitsuba, and supplements these with elements that you specify in the [conditions file](Conditions File Format) and [mappings file](Mappings File Format).

Read on to learn about how adjustments work, behind the scenes.

Unique Identifiers

Adjustments can replace or modify scene elements, based on unique identifiers. Unique identifiers start life in modeling applications like Blender, where users can assign an arbitrary names to scene objects. These are saved in the Collada scene file as XML id attributes that contain object names, plus descriptive suffixes like "-material" or "-light".

Adjustments also use id attributes. These allow adjustments and scene elements to be matched up, and the scene elements to be replaced or modified. Whether a scene element, or part of a scene element, is present in both the adjustments file and the scene file, the values in the adjustments file take precedence.

Supplementing: Default Adjustments

The RenderData/ sub-folder of RenderToolbox3 contains default adjustments files for PBRT and Mitsuba. These supplement the Collada scene with elements that are necessary for physically-based rendering, but are unknown in modeling applications like Blender, or Collada scene files.

Two supplementary scene elements are light transport sample generators and integrators. Both PBRT and Mitsuba use these scene elements, although they define them with different syntax.

PBRT

Here is an excerpt from the default PBRT adjustments file, PBRTDefaultAdjustments.xml. The adjustments file uses a custom RenderToolbox3 PBRT-XML format.

<Sampler id="sampler" type="lowdiscrepancy">
    <parameter name="pixelsamples" type="integer">8</parameter>
</Sampler>

<SurfaceIntegrator id="integrator" type="directlighting" />

These adjustments specify a default sample generator and integrator.

The ColladaToPBRT() converter would include these scene elements along with scene elements from a Collada parent scene file. The result would be a PBRT scene file that contained the specified sample generator and integreator, as in this excerpt:

# Sampler
Sampler "lowdiscrepancy" 
  "integer pixelsamples" [8]

# Integrator
SurfaceIntegrator "directlighting"
Mitsuba

Here is an excerpt from the default Mitsuba adjustments file, MitsubaDefaultAdjustments.xml. The adjustments uses Mistuba's own XML format.

<sampler id="Camera-camera_sampler" type="ldsampler">
    <integer name="sampleCount" value="8"/>
</sampler>

<integrator id="integrator" type="direct">
    <integer name="shadingSamples" value="32"/>
</integrator>

These adjustments specify a sample generator and an integrator, with some default properties.

Mitsuba's scene converter would include these scene elements along with scene elements from a Collada scene file. The result would be a Mitsuba scene file that contained the specified sample generator and integrator, as in this excerpt:

<sensor id="Camera-camera" type="perspective">
    ...
    <sampler id="Camera-camera_sampler" type="ldsampler">
        <integer name="sampleCount" value="8"/>
    </sampler>
    ...
</sensor>

<integrator id="integrator" type="direct">
    <integer name="shadingSamples" value="32"/>
</integrator>

Replacing and Modifying: Manipulations in the Mappings File

The [mappings file](Mappings File Format) can specify scene manipulations to be applied to the adjustments file. The examples below use the mappings file to introduce a new material and multi-spectral reflectances and illuminant spectra to a scene.

Consider a Collada parent scene file that contains a dragon model and a distant sun light. The scene could be converted to PBRT or Mitsuba without any manipulations, but the dragon would use a boring default material type, and the material and light would use simple RGB colors.

The examples below show how adjustments can replace the default material with a renderer-specific material, and modify an existing light to use a sampled spectrum.

PBRT

Without any adjustments, the dragon scene would be converted to a PBRT scene file with default material and RGB colors:

# material DragonMaterial-material
MakeNamedMaterial "DragonMaterial-material" 
  "string type" "uber" 
  "rgb Kd" [1.000000 0.593133 0.331203] 
  "float index" [1] 

# light source Sun-light
LightSource "distant" 
  "rgb L" [1 1 1] 
  "point from" [0 0 0] 
  "point to" [0 0 -1] 

The material has the id "DragonMaterial-material", and it has the default type uber. The light has the id "Sun-light". Both scene elements use rgb colors.

The following mappings adjust the scene with a replacement material of the PBRT type plastic. They also adjust the scene to use a multi-spectral reflectance for the plastic reflectance and a multi-spectral spectrum for the light:

% PBRT-style plastic
PBRT {
    DragonMaterial-material:Material:plastic
    DragonMaterial-material:roughness.float = 0.003
    DragonMaterial-material:Kd.spectrum = mccBabel-23.spd
    DragonMaterial-material:Ks.spectrum = 300:1 800:1
}

% daylight spectrum
Generic {
    Sun-light:light:directional
    Sun-light:intensity.spectrum = D65.spd
}

These adjustments use [Scene Target](Mappings Syntax) syntax.

Using these adjustments, the PBRT scene file would contain the replacement plastic material and light spectrum:

# material DragonMaterial-material
MakeNamedMaterial "DragonMaterial-material" 
  "string type" "plastic" 
  "spectrum Kd" "mccBabel-23.spd" 
  "spectrum Ks" [300:1 800:1] 
  "float roughness" [0.003] 

# light source Sun-light
LightSource "distant" 
  "spectrum L" "D65.spd" 
  "point from" [0 0 0] 
  "point to" [0 0 -1] 

The plastic material and the light use sampled spectra specified in spd-files.

Mitsuba

Without any adjustments, the dragon scene would be converted to a Mitsuba scene file with default material and RGB colors:

<bsdf id="DragonMaterial-material" type="diffuse">
    <rgb name="reflectance" value="1 0.593133 0.331203"/>
</bsdf>

<emitter id="Sun-light" type="directional">
    <rgb name="irradiance" value="1 1 1"/>
</emitter>

The material has the id "DragonMaterial-material", and it has the default type diffuse. The light has the id "Sun-light". Both scene elements use rgb colors.

The following mappings adjust the scene with a replacement material of the Mitsuba type plastic. They also adjust the scene to use a multi-spectral reflectnace for the plastic reflectance and a multi-spectral light emission spectrum:

Mitsuba {
    DragonMaterial-material:bsdf:roughplastic
    DragonMaterial-material:alpha.float = 0.1
    DragonMaterial-material:diffuseReflectance.spectrum = mccBabel-23.spd
}

Generic {
    % use daylight
    Sun-light:light:directional
    Sun-light:intensity.spectrum = D65.spd
}

Again, these manipulations use [Scene Target](Mappings Syntax) syntax.

Using these manipulations, the Mitsuba scene file would contain the replacement plastic material and light spectrum:

<bsdf id="DragonMaterial-material" type="roughplastic">
    <float name="alpha" value="0.1"/>
    <spectrum filename="mccBabel-23.spd" name="diffuseReflectance"/>
</bsdf>

<emitter id="Sun-light" type="directional">
    <rgb name="irradiance" value="1 1 1"/>
    <spectrum filename="D65.spd" name="irradiance"/>
</emitter>

Again, the plastic material and the light use sampled spectra specified in spd-files.

Clone this wiki locally