Foreword
This document describes the various toxic settings file formats. It is written to be easy to
read and understand, but it also contains enough details to be considered as a reference
document.
In order to improve the quality of this document, please report typos and errors but also
missing, incomplete or unclear material. In any case your comments and suggestions are welcome.
In all cases, please use the forums to discuss this document.
Contents
1 Introduction
This document describes the various settings files used by toxic.
Settings are divided into two categories: toxic settings and scene settings.
toxic settings are system-dependent. They must be set according to the system ressources
(like the number of processors) to make toxic run efficiently. They do not affect image quality.
Scene settings are system-independent, so they can be distributed along with scenes and used as-is on
different machines. Typically, each scene has its own scene settings file associated to it. Scene settings
describe how toxic is going to render the scene. They permit to control the trade-off between
simulation accurary, visual quality and rendering speed.
2 toxic Settings
By default, toxic settings are read from the settings/toxicsettings.xml file in the
toxic installation directory.
2.1 File Structure
Here is the basic structure of a valid toxic settings file:
<?xml
version="1.0"
encoding="UTF-8"?>
<ToxicSettings
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../schemas/toxicsettings.xsd">
toxic settings go here.
</ToxicSettings>
The first statement (<?xml ...
?>) indicates the type and the encoding of the document.
The second statement (<ToxicSettings ... >) opens the root
element of the settings file. The xsi:noNamespaceSchemaLocation attribute
is the path to the toxicsettings.xsd schema (which is located in the schemas/ directory of the toxic
distribution). toxic does not rely on this path to find the schema, so it will not complain if it
is incorrect. However, you must specify the right path to the toxicsettings.xsd file in order to allow your
favorite XML editor to find the schema and to validate your settings file.
The last statement (</ToxicSettings>) closes the root element.
One and ony one root element must appear in the file.
2.2 Settings
2.2.1 Multithreading
Syntax:
<Multithreading
renderingthreads="1" />
The <Multithreading /> element makes it possible to
specify the number of threads used to render a frame. The minimum value of the
renderingthreads attribute is 1. There is no maximum value.
The optimal number of rendering threads depends primarily on the number of CPU in the rendering machine.
One and only one <Multithreading /> element must appear
inside the root element.
Note: the current version of toxic can not use more than one rendering thread. This limitation will
be removed in future versions of toxic.
2.3 XML Schema
You can get the full XML Schema describing toxic settings file format
here.
2.4 Sample File
There is a sample toxic settings file
here.
3 Scene Settings
By default, the scene settings file must be located in the same directory as the scene file itself.
The name of the scene settings file is obtained by appending the .settings suffix to the scene name. For example,
given a scene file named bunny.xml, toxic will load scene settings from the file bunny.settings.xml.
3.1 File Structure
Here is the basic structure of a valid scene settings file:
<?xml
version="1.0"
encoding="UTF-8"?>
<ToxicSceneSettings
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="toxicscene.settings.xsd">
Scene settings go here.
</ToxicSceneSettings>
The first statement (<?xml ...
?>) indicates the type and the encoding of the document.
The second statement (<ToxicSceneSettings ... >) opens the root
element of the settings file. The xsi:noNamespaceSchemaLocation attribute
is the path to the toxicscene.settings.xsd schema (which is located in the schemas/ directory of the toxic
distribution). toxic does not rely on this path to find the schema, so it will not complain if it
is incorrect. However, you must specify the right path to the toxicscene.settings.xsd file in order to allow your
favorite XML editor to find the schema and to validate your settings file.
The last statement (</ToxicSceneSettings>) closes the root element.
One and ony one root element must appear in the file.
3.2 Rendering Settings
Rendering settings are grouped together into a
<Rendering /> element:
<Rendering>
Rendering settings go here.
</Rendering>
One and only one <Rendering /> element must appear
inside the root element.
3.2.1 Pixel Sampling
Pixel sampling settings control how and in how many parts is divided the surface of each pixel.
Pixel sampling settings are grouped together into a
<PixelSampling /> element:
<PixelSampling>
Pixel sampling settings go here.
</PixelSampling>
One and only one <PixelSampling /> element must appear
inside the <Rendering /> element.
The <PixelSampling /> element must contain either a
<Supersampling /> element or a
<WhittedAdaptiveSampling /> element.
3.2.1.1 Supersampling
Supersampling settings must be placed into a
<Supersampling /> block as follow:
<Supersampling>
Supersampling scheme goes here.
</Supersampling>
One and only one of these three supersampling schemes must be selected: random, regular or stratified.
The random scheme is selected with the following code fragment:
<RandomSampling
samples="16" />
The regular scheme is selected with the following code fragment:
<RegularSampling
width="4"
height="4" />
Finally, The stratified scheme is selected with the following code fragment:
<StratifiedSampling
width="4"
height="4" />
The attributes samples, width
and height must be set to strictly positive integer values.
3.2.1.2 Whitted Adaptive Sampling
Whitted adaptive sampling is an adaptive method which allows to put more antialiasing work
where it is needed. For a given pixel, it compares the contrast between the four corners of the pixel
to a user-defined contrast threshold. If the computed contrast is greater than the threshold, the
pixel is subdivided in four equal parts and this algorithm is recursively applied to the four parts.
Contrast between two colors is defined as the absolute value of the luminance difference. toxic
computes the luminance of a given (R, G, B) color according to the CIE Rec. 709 standard:
Luminance = 0.2125 * R + 0.7154 * G + 0.0721 * B
The CIE Rec. 709 standard takes into account the way the human vision works by carefully
weighting the R, G, B components in the luminance formula.
Whitted adaptive sampling is selected with the following code fragment (which must be inserted
directly into the <PixelSampling /> element):
<WhittedAdaptiveSampling
contrastthreshold="0.025"
maxdepth="3" />
The contrastthreshold attribute defines the contrast threshold
beyond which subdivision occurs. It must be set to a non-negative real value. If set to 0.0, subdivision
will occur systematically up to the maximum depth.
The maximum subdivision depth is defined by the maxdepth
attribute, which must be set to a non-negative integer value. If the
maxdepth attribute is set to 0, subdivision will never happen.
3.2.2 Lighting Components
This settings block allow to select which lighting components must be computed during the lighting
simulation.
Lighting components are declared into a
<Components /> element:
<Components>
Lighting components are declared here.
</Components>
One and only one <Components /> element must appear
inside the <Rendering /> element.
There are four lighting components: direct lighting, indirect lighting, specular reflections and caustics.
These four components form global illumination (GI). Each component can be individually enabled or disabled.
3.2.2.1 Direct Lighting
Direct lighting is computed if and only if the following block appear in the
<Components /> element:
<DirectLighting>
Direct lighting settings go here.
</DirectLighting>
The <DirectLighting /> element can not appear
more than once inside the <Components /> element.
Required direct lighting settings:
- Area lights sampling settings:
<ArealightSampling />.
Optional direct lighting settings:
The <ArealightSampling /> element is declared as follow:
<ArealightSampling>
Area lights sampling scheme goes here.
</ArealightSampling>
One and only one of these three sampling schemes must be selected: random, regular or stratified.
The random scheme is selected with the following code fragment:
<RandomSampling
samples="64" />
The regular scheme is selected with the following code fragment:
<RegularSampling
width="8"
height="8" />
Finally, The stratified scheme is selected with the following code fragment:
<StratifiedSampling
width="8"
height="8" />
The attributes samples, width
and height must be set to strictly positive integer values.
Here is a sample, complete direct lighting settings block. It enables direct lighting and instructs toxic
to use stratified sampling for area lights sampling:
<DirectLighting>
<ArealightSampling>
<StratifiedSampling
width="8"
height="8" />
</ArealightSampling>
</DirectLighting>
3.2.2.2 Indirect Lighting
Indirect lighting is computed if and only if the following block appear in the
<Components /> element:
<IndirectLighting>
Indirect lighting settings go here.
</IndirectLighting>
The <IndirectLighting /> element can not appear
more than once inside the <Components /> element.
Required indirect lighting settings:
- Photon tracing settings:
<PhotonTracing />.
- Radiance estimate settings:
<RadianceEstimate />.
Optional indirect lighting settings:
- Radiance precomputation settings:
<RadiancePrecomputation />.
- Primary final gathering settings:
<PrimaryFinalGathering />.
- Secondary final gathering settings:
<SecondaryFinalGathering />.
The <PhotonTracing /> element allows to specify
the total number of photons to emit from light sources. It is declared as follow:
<PhotonTracing
photons="1000000" />
The photons attribute specifies how many photons must be emitted.
It must be set to a strictly positive integer value.
The <RadianceEstimate /> element is declared as follow:
<RadianceEstimate
maxphotons="500"
maxdistance="1.0e6" />
The maxphotons attribute is the maximum number of photons to take into
account when estimating radiance at a given point of the scene. It must be set to a strictly positive integer
value. The maxdistance attribute is the maximum distance to include a
photon. It must be set to a strictly positive real value.
Photons are gathered until one the bounds (on distance or photon count) is reached.
If present, the <RadiancePrecomputation /> element
instructs toxic to precompute radiance at the position of some of the emitted photons. It is declared
as follow:
<RadiancePrecomputation
spacing="4"
maxsearchdistance="0.1" />
The spacing attribute specifies the density of the radiance precomputation.
It must be set to a strictly positive integer value. If set to 1, radiance will be precomputed at the position
of each photons. If set to n, radiance will be precomputed at the position of every n photons.
The maxsearchdistance attribute must be set to a strictly positive real value.
It specifies the maximum distance to search for a photon carrying a precomputed radiance estimate.
Note: future versions of toxic will probably replace the spacing
attribute by something more intuitive.
The <PrimaryFinalGathering /> element, if present, instructs
toxic to use final gathering to compute indirect lighting. This gives a much smoother indirect
lighting, but at the price of a much longer rendering. It is declared as follow:
<PrimaryFinalGathering>
Primary final gathering sampling scheme goes here.
</PrimaryFinalGathering>
One and only one of these three sampling schemes must be selected:
random, regular and stratified.
The random scheme is selected with the following code fragment:
<RandomSampling
samples="100" />
The regular scheme is selected with the following code fragment:
<RegularSampling
width="20"
height="5" />
Finally, The stratified scheme is selected with the following code fragment:
<StratifiedSampling
width="20"
height="5" />
The attributes samples, width
and height must be set to strictly positive integer values.
When using the regular and stratified sampling schemes, it is very important to set the
width attribute to a value 4 times greater than the
height value. This will ensure proper sampling of the
final gathering hemisphere.
If present, the <SecondaryFinalGathering /> element
instructs toxic to perform a secondary final gathering when needed. The secondary final gathering
improves indirect lighting in corners and along edges.
The syntax is essentially the same as for the
<PrimaryFinalGathering /> element. It just takes an
additional distancethreshold attribute:
<SecondaryFinalGathering
distancethreshold="0.01">
Secondary final gathering sampling scheme goes here.
</SecondaryFinalGathering>
The distancethreshold attribute specifies the distance below which
toxic must perform a secondary final gathering. It must be set to a strictly positive real value.
Here is a sample, complete indirect lighting settings block:
<IndirectLighting>
<PhotonTracing
photons="1000000" />
<RadiancePrecomputation
spacing="4"
maxsearchdistance="0.1" />
<RadianceEstimate
maxphotons="500"
maxdistance="1.0e6" />
<PrimaryFinalGathering>
<StratifiedSampling
width="20"
height="5" />
</PrimaryFinalGathering>
</IndirectLighting>
3.2.2.3 Specular Reflections
Specular reflections are computed if and only if the following block appear in the
<Components /> element:
<SpecularReflections
maxdepth="8" />
The <SpecularReflections /> element can not appear
more than once inside the <Components /> element.
The maxdepth attribute specifies the maximum reflection level
to take into account. The minimum value is 0. There is no maximum value. If set to 0, specular reflection
will never be computed.
3.2.2.4 Caustics
Caustics are computed if and only if the following block appear in the
<Components /> element:
<Caustics>
Caustics settings go here.
</Caustics>
The <Caustics /> element can not appear
more than once inside the <Components /> element.
Required indirect lighting settings:
- Photon tracing settings:
<PhotonTracing />.
- Radiance estimate settings:
<RadianceEstimate />.
Optional indirect lighting settings:
The <PhotonTracing /> element allows to specify
the total number of photons to emit from light sources. It is declared as follow:
<PhotonTracing
photons="1000000" />
The photons attribute specifies how many photons must be emitted.
It must be set to a strictly positive integer value.
The <RadianceEstimate /> element is declared as follow:
<RadianceEstimate
maxphotons="30"
maxdistance="1.0e6" />
The maxphotons attribute is the maximum number of photons to take into
account when estimating radiance at a given point of the scene. It must be set to a strictly positive integer
value. The maxdistance attribute is the maximum distance to include a
photon. It must be set to a strictly positive real value.
Photons are gathered until one the bounds (on distance or photon count) is reached.
Here is a sample, complete caustics settings block:
<Caustics>
<PhotonTracing
photons="1000000" />
<RadianceEstimate
maxphotons="30"
maxdistance="1.0e6" />
</Caustics>
3.3 Output Settings
Output settings are grouped together into an
<Output /> element:
<Output>
Output settings go here.
</Output>
One and only one <Output /> element must appear
inside the root element.
3.3.1 Gamma Correction
Syntax:
<GammaCorrection
targetgamma="2.2" />
If present, the <GammaCorrection /> element instructs
toxic to gamma correct the rendered image. The desired gamma value is defined by the
targetgamma attribute, which must be a strictly positive real value.
The <GammaCorrection /> element can not appear
more than once inside the <Output /> element.
3.4 XML Schema
You can get the full XML Schema describing scene settings file format
here.
3.5 Sample Files
You may want to start from this
template file to write your
own scene settings files. This file uses the following settings:
- Whitted adaptive antialiasing is used with a contrast threshold of 0.025 and a maximum
subdivision depth of 3.
- Only the direct lighting component is computed. Not indirect illumination, no specular reflections and
no caustics.
- The rendered image is gamma corrected for a target gamma value of 2.2.
Here are some other scene settings files to browse:
|