mylaboratory
Title image
 
Home
 
Software
 
Raytracer
 
Recipes
 
Photos
 
Mashup
 

Random photo

More photos More photos

Contact

  • PhotonLab related:
    photonlab@
  • PhotonLab support:
    photonlab.support@

Related areas

Related links

  • C++ @ Wikipedia
    C++ is a general-purpose programming language with high-level and low-level capabilities
  • libnoise
    A portable, open-source, coherent noise-generating library for C++
  • bzip2
    A patent free, high-quality data compressor
  • DevIL
    A full featured cross-platform image library
  • Xerces
    A validating XML parser
  • LUA
    A powerful, fast, light-weight, embeddable scripting language
  • FOX-Toolkit
    A C++ based class library for building Graphical User Interfaces

Search (Google)

Web mylab

PhotonLab Documentation

WARNING: this information is rather out of date.

Usage

PhotonLab <scenefile.sml> -m<mode> [options]
    -m<render mode> = Raytracing algorithm: 1 - raytraced, 2 - pathtraced
    -d              = Minimal screen output (useful for running with nohup)
    -s<start frame> = First frame to render
    -e<end frame>   = Last frame to render
    -p<identifier>  = Run identifier (output becomes fXXXXXX.<id>.ext - useful for running the same job across multiple machines that use the same filespace


SML Walkthrough

 0  <?xml version="1.0"?>
 1  <PhotonLab xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="plscene.sxd" version="1">

The first line describes the XML version and the second the PhotonLab SML file version and the schema to use to parse it.

 2      <header>
 3          <resolution x="100" y="100" aa="2" rdepth="10" rsamples="500" volume="1" apsamp="0" ssamp="0" ssdiff="0.3"/>
 4          <general animate="0" ftype="jpg" frate="40"/>
 5      </header>

The header section tells the raytracer the required output properies and quality. The 'x' and 'y' parameters specify the resolution. 'aa' tells it whether to apply antialiasing, 1 is for no antialiasing. For raytraced images the antialiasing is done by producing high resolution images and averaging down. For pathtraced images 2 is used to turn it on an the antialiasing is achived by jittering the shot rays. 'rdepth' controls the recursion depth, 'rsamples' the number of samples per pixel in pathtracing mode, 'volume' is a factor that controls how many rays are shot at a light (based on it's surface area) in raytracing mode. 'apsamp' controls the number of samples used for aperture effects (depth of field) and acts in an almost identical way to 'aa'. 'ssamp' turns on and 'ssdiff' controls the threshold difference between pixels before the raytracer makes a supersample. This is only really useful for the raytracer.

'animate' controls whether the output should be an animation (not currently implemented). 'ftype' is the output image type and may be bmp, dds, jpg, pcx, png, pnm, raw, sgi, tga, tif, pal or hdr. 'frate' sets the time between frames in milliseconds for the animated cameras.

 6      <postproc>
 7          <gamma factor="1.0"/>
 8          <edgedetect on="0"/>
 9          <cellshade on="0"/>
 10          <blueprint on="0"/>
 11          <softfocus on="0"/>
 12          <glow on="0"/>
 13      </postproc>

The postproc section controls post processing of the image. This section has become redundant with the addition of a standalone post processor since the affects on the image are irreversable. If you are interested in using it then the schema shows the syntax and the parameters have the same meanings as in post processor programme.

 14      <cameras number="3">
 15          <single id="0" name="cam1" viewer="19.9 0 0" focal="0 0 0" up="0 50 0" aspect="1" aperture="75"/>
 16          <paused id="1" name="cam2" viewer="19.9 0 0" focal="0 0 0" up="0 50 0" aspect="1" aperture="75" time="1000"/>
 17          <crs id="2" name="cam3" points="4" aspect="1.5" time="1000">
 18              <control viewer="1 0 0" focal="0 0 0" up="0 1 0" aperture="100"/>
 19              <control viewer="0 0 1" focal="0 0 0" up="0 1 0" aperture="100"/>
 20              <control viewer="-1 0 0" focal="0 0 0" up="0 1 0" aperture="100"/>
 21              <control viewer="0 0 -1" focal="0 0 0" up="0 1 0" aperture="100"/>
 22          </crs>
 23      </cameras>

The 'cameras' section controls the image of the scene produced by the raytracer. There are three camera types: 'single' which produces a single frame. 'paused' which gives a number of frames from the same viewpoint depending on the pause 'time' and the frame rate. And 'crs' which gives a moving camera based on the Catmull Rom Spline between the control points. All have an 'id' parameter which is unique to that camera instance, a 'name' and an 'aspect' ratio. The main elements that control the viewpoint are the 'viewer' position, 'focal' position and 'up' vectors which are three floating point numbers separated by spaces and the aperture which controls depth of field effects when enabled. The paused camera also has a 'time' property which sets the pause time in milliseconds. The CRS camera has a time which is the time to use between control points and the number of control points (minimum 4). The control points themselves contain the viewer, focal, up and aperture. The spline is created between the 2nd point and the N-1 point (the end points being used to control the initial and final shape of the spline).

 24      <environment ambient="0.0 0.0 0.0"/>
 25      <materials nbase="10" ntext="0" nproc="1">
 26          <base id="0" name="White" diffuse="1 1 1" specular="0 0 0" transmit="0 0 0" coefficients="0.75 0 0" ior="1.4" extinction="0" shinyness="100" tri="0"/>
 27          <base id="1" name="Plant" diffuse="0 1 0" specular="0 0 0" transmit="1 1 1" coefficients="0.75 0 0" ior="1" extinction="0" shinyness="1e100" tri="0"/>
 28          <base id="2" name="Water" diffuse="0 0 0" specular="0 0 0" transmit="0.95 0.95 1" coefficients="0 0 0.99" ior="1.333" extinction="0" shinyness="1e100" tri="0"/>
 29          <base id="3" name="Sand" diffuse="0.93 0.86 0.5" specular="0 0 0" transmit="0.95 0.95 1" coefficients="0.75 0 0" ior="1.333" extinction="0" shinyness="1e100" tri="0"/>
 30          <base id="4" name="Diamond" diffuse="0 0 0" specular="1 1 1" transmit="1 1 1" coefficients="0 0 1" ior="2.4" extinction="0" shinyness="1e100" tri="0"/>
 31          <base id="5" name="Chrome" diffuse="0 0 0" specular="1 1 1" transmit="0 0 0" coefficients="0 1 0" ior="1.333" extinction="0" shinyness="1e100" tri="0"/>
 32          <base id="6" name="Fish.body" diffuse="2 0.5 0" specular="1 1 1" transmit="0 0 0" coefficients="0.8 0.01 0" ior="1" extinction="0" shinyness="1e100" tri="0"/>
 33          <base id="7" name="Fish.extremities" diffuse="2 1 0" specular="1 1 1" transmit="0 0 0" coefficients="0.8 0.01 0" ior="1" extinction="0" shinyness="1e100" tri="0"/>
 34          <base id="8" name="Fish.eyes" diffuse="1 1 1" specular="1 1 1" transmit="0 0 0" coefficients="0.75 0.05 0" ior="1" extinction="0" shinyness="1e100" tri="0"/>
 35          <base id="9" name="Fish.pupils" diffuse="0 0 0" specular="1 1 1" transmit="0 0 0" coefficients="0.75 0.05 0" ior="1" extinction="0" shinyness="1e100" tri="0"/>
 36          <procedural id="0" name="water" type="colour" equation1="0.25 * billow ( 1 * $ix ) ( 1 * $iy ) ( 1 * $iz ) " equation2="0.25 * billow ( 20 + 1 * $ix ) ( 20 + 1 * $iy ) ( 20 + 1 * $iz ) " equation3="0.25 * billow ( 40 + 1 * $ix ) ( 40 + 1 * $iy ) ( 40 + 1 * $iz ) "/>
 37  <!--        <procedural id="0" name="water" type="colour" equation1="0 " equation2="0 " equation3="0 "/>-->
 38      </materials>

The 'environment' section sets the global ambient light level.

The 'materials' part sets the material settings for all the objects. Every object must be associated with one 'base' material and many also have any number of 'texture' or 'procedural' textures as well. The 'materials' tag requires the number of each type to be set. The three types all have an 'id' and 'name' as usual. The 'base' element also has RGB triplets for 'diffuse', 'specular' and 'transmit' colours. There is also a triplet for the strength coefficients for each colour. The 'ior' controls the index of recfraction, 'extriction' the scattering of light as it passes through an translucent object and 'shinyness' the distribution of the specular highlight. 'tri' is a boolean that turns on a separate index of recfraction for the three colour components. When it is on, 'ior' becomes the red value and two extra values, 'g_ior' and 'b_ior' are required.

The 'texture' tag requires a string called 'file' which points to the texture to be used. The 'procedural' tag has a property called 'type' which has values 'greyscale', 'colour' or 'ramp' that descibe the mode. If the mode is greyscale or ramp then a property 'equation1' is required which is the function to evalute. The syntax of the language is described below. If the type is colour then 'equation2' and 'equation3' are also needed which give the equations for the green and blue channels respectively. If the mode is ramp then a colour ramp must also be provided and the equation is used to evaluate a position along the ramp. This is a child tag called 'ramp' which contains a 'number' of RGB 'triplets'.

 39      <objects meshes="24" rectangles="7" spheres="2" slenses="0" boxes="1" prisms="0" instances="24">
 40          <mesh filename="./bin/models/tankplant1.obj"/>
 41          <mesh filename="./bin/models/tankplant2.obj"/>
 42          <mesh filename="./bin/models/tankplant3.obj"/>

The 'object' tag describes all the geometry in the scene. The number of each type is specified in the tag and the objects themselves then follow. A 'mesh' is an external Lightwave OBJ file that isn't displayed directly but called by 'instance' objects.

 68          <rectangle>
 69              <general id="0" name="floor" material="3"/>
 70              <location position="0 -20 0" rotation="0 0 0"/>
 71              <maps nummaps="0"/>
 72              <emission colour="1 1 1" strength="0"/>
 73              <extended xsize="21" zsize="21"/>
 74          </rectangle>

The 'rectangle' object draws a rectangle. Every object has a common set of properties which include the 'id', 'name', 'material' from the base materials list, 'position' and 'rotation' vectors, any textures to apply and the emission colour and strength. The rectangle object has 'xsize' and 'zsize' extended parameters.

 145          <box>
 146              <general id="9" name="water" material="2"/>
 147              <location position="0 -10 0" rotation="0 0 0"/>
 148              <maps nummaps="1">
 149                  <map mapid="0" target="n" operator="+" mapmode="none" offset="0 0 0" rotation="0 0 0" scaling="1 1 1"/>
 150              </maps>
 151              <emission colour="0 0 1" strength="0"/>
 152              <extended xside="41" yside="40" zside="41"/>
 153          </box>

The 'box' tag draws a cuboid with the dimensions of each face in the 'extended' parameters. This example also includes a texture map. The 'mapid' is a texture from the list defined above, 'target' is the component to which the function is applied and may be 'n', 'd', 's', 't', 'e' or 'a' for normal, diffuse, specular, transparent, emission or diffuse, specular & transparent, respectively. The 'operator' value determins how the value is combines and may be '+', '-', '/', '*', '^' (power) or 'r' (replace). The 'mapmode' sets how a bitmap texture is applied to objects and can be 'none' (for procedural textures), 'planar', 'cubic', 'spherecubic', 'cylindrical', 'rectcylind' or 'spherical'. Bitmap textures also require an 'offset', 'rotation' and 'scaling' vectors.

 154          <sphere>
 155              <general id="10" name="diamondball" material="4"/>
 156              <location position="-12 10 10" rotation="0 0 0"/>
 157              <maps nummaps="0"/>
 158              <emission colour="0 0 1" strength="0"/>
 159              <extended radius="7"/>
 160          </sphere>

Other primatives that are supported are spheres - which need a radius, spherical lens (slens) - which has a radius and radius of curvature, and a prism - which has a height, width, depth and skewness. See the schema for details.

 333          <instance>
 334              <general id="1026" name="fish3.pupils" material="9"/>
 335              <location position="3 2 -7" rotation="0 0.5 0"/>
 336              <maps nummaps="0"/>
 337              <emission colour="0 0 0" strength="0"/>
 338              <extended meshid="23" scaling="0.075"/>
 339          </instance>
 340  
 341      </objects>
 342  </PhotonLab>

The final object is the 'instance' which draws a scaled copy of a loaded mesh.


Shader Syntax

The shader language is is normal human-readable infix mathematics. The parser is fairly simple so all symbols, values and operators must be followed by a space. A list of operator with their presedence, number of arguments and a description are given in the table below. Functions can be tested for syntax errors and the output viewed using the PL Texture programme. A couple of examples of functions are given here:

Marble: “1.0 - ( 0.8 * clamp ( ( ( cos ( ( 10 * $ix ) + 8.0 * perlin ( 1.0 + $ix ) ( 1.0 + $iy ) ( 1.0 + $iz ) ) ^ 10 ) ) ) 0 1 ) ^ 2 ”.

Billow noise: “1.0 + 0.5 * billow ( 20 * $ix ) ( 20 * $iy ) ( 20 * $iz ) ”.

 Operator  Presedence  Left associative?  Number of arguments  Description 
-0true2Subtract
+1true2Add
*2true2Multiply
/3true2Divide
^4false2Power
exp5false1Exponential
cos6false1Cosine
sin6false1Sine
tan6false1Tangent
perlin6false33D Perlin noise (x,y,z) [default settings]
billow6false33D billow noise (x,y,z) [default settings]
ridgmult6false33D rigid multifractal noise (x,y,z) [default settings]
voronoi6false33D Voronoi noise (x,y,z) [default settings]
spheres6false3Spheres (x,y,z) [default settings]
chess6false3Chess board (x,y,z) [default settings]
cylind6false3Cylinders (x,y,z) [default settings]
pi-1true0Pi
$ix-1true0x intersection
$iy-1true0y intersection
$iz-1true0z intersection
abs6false1Absolute
blend6false3Blend (a,b,x) - blend a*(1-x)+bx
clamp6false3Clamp (x,a,b) - clamp x to range a->b
large6false2Large (x,y) - larger of x and y
small6false2Small (x,y) - smaller of x and y
select6false4Select (x,y,z,a) - select x if z <= a else y
perlinf6false63D Perlin noise (x,y,z,octave count,persistence,lacunarity) [full control]
billowf6false63D billow noise (x,y,z,octave count,persistence,lacunarity) [full control]
ridgmultf6false53D rigid multifractal noise (x,y,z,octave count,lacunarity) [full control]
$nx-1true0x normal
$ny-1true0y normal
$nz-1true0z normal
$rx-1true0x ray
$ry-1true0y ray
$rz-1true0z ray
int6false1Integer
tex6false2Texture lookup (texid, channel)
nmtex6false2Texture normal map lookup (texid, channel)

Examples

dispersion.sml - Dispersive objects in a box. [Output]
fishinbox.sml - Fish and plants in a box. [Output]
happybuddha.sml - Stanford Happy Buddha. [Output]
shipinbottle.sml - Ship in a bottle. [Output]


Scene XML Schema

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <xsd:annotation>
       <xsd:documentation xml:lang="en">
           PhotonLab Raytracer scene description language schema.
           Copyright 2005 Simon J Chorley. All rights reserved.
       </xsd:documentation>
   </xsd:annotation>

   <xsd:simpleType name="floatlist">
       <xsd:list itemType="xsd:float"/>
   </xsd:simpleType>
   <xsd:simpleType name="vector">
       <xsd:restriction base="floatlist">
           <xsd:length value="3"/>
       </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="operator">
       <xsd:restriction base="xsd:string">
           <xsd:enumeration value="+"/>
           <xsd:enumeration value="-"/>
           <xsd:enumeration value="*"/>
           <xsd:enumeration value="/"/>
           <xsd:enumeration value="^"/>
           <xsd:enumeration value="r"/>
       </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="target">
       <xsd:restriction base="xsd:string">
           <xsd:enumeration value="d"/>
           <xsd:enumeration value="s"/>
           <xsd:enumeration value="t"/>
           <xsd:enumeration value="e"/>
           <xsd:enumeration value="a"/>
           <xsd:enumeration value="n"/>
       </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="mapmode">
       <xsd:restriction base="xsd:string">
           <xsd:enumeration value="none"/>
           <xsd:enumeration value="planar"/>
           <xsd:enumeration value="cubic"/>
           <xsd:enumeration value="spherecubic"/>
           <xsd:enumeration value="cylindrical"/>
           <xsd:enumeration value="rectcylind"/>
           <xsd:enumeration value="spherical"/>
       </xsd:restriction>
   </xsd:simpleType>

   <xsd:group name="objectsettings" id="objectsettings">
       <xsd:sequence>
           <xsd:element name="general">
               <xsd:complexType>
                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                   <xsd:attribute name="material" type="xsd:nonNegativeInteger" use="required"/>
               </xsd:complexType>
           </xsd:element>
           <xsd:element name="location">
               <xsd:complexType>
                   <xsd:attribute name="position" type="vector" use="required"/>
                   <xsd:attribute name="rotation" type="vector" use="required"/>
               </xsd:complexType>
           </xsd:element>
           <xsd:element name="maps">
               <xsd:complexType>
                   <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                       <xsd:element name="map" minOccurs="0" maxOccurs="unbounded">
                           <xsd:complexType>
                               <xsd:attribute name="mapid" type="xsd:nonNegativeInteger" use="required"/>
                               <xsd:attribute name="target" type="target" use="required"/>
                               <xsd:attribute name="operator" type="operator" use="required"/>
                               <xsd:attribute name="mapmode" type="mapmode" use="required"/>
                               <xsd:attribute name="offset" type="vector" use="required"/>
                               <xsd:attribute name="rotation" type="vector" use="required"/>
                               <xsd:attribute name="scaling" type="vector" use="required"/>
                               <xsd:attribute name="heightmap" type="xsd:boolean" use="optional"/>
                           </xsd:complexType>
                       </xsd:element>
                   </xsd:sequence>
                   <xsd:attribute name="nummaps" type="xsd:nonNegativeInteger" use="required"/>
               </xsd:complexType>
           </xsd:element>
           <xsd:element name="emission">
               <xsd:complexType>
                   <xsd:attribute name="colour" type="vector" use="required"/>
                   <xsd:attribute name="strength" type="xsd:float" use="required"/>
               </xsd:complexType>
           </xsd:element>
       </xsd:sequence>
   </xsd:group>

   <xsd:simpleType name="ImageFileType">
       <xsd:restriction base="xsd:string">
           <xsd:enumeration value="bmp"/>
           <xsd:enumeration value="dds"/>
           <xsd:enumeration value="jpg"/>
           <xsd:enumeration value="pcx"/>
           <xsd:enumeration value="png"/>
           <xsd:enumeration value="pnm"/>
           <xsd:enumeration value="raw"/>
           <xsd:enumeration value="sgi"/>
           <xsd:enumeration value="tga"/>
           <xsd:enumeration value="tif"/>
           <xsd:enumeration value="pal"/>
           <xsd:enumeration value="hdr"/>
       </xsd:restriction>
   </xsd:simpleType>

   <xsd:element name="PhotonLab">
       <xsd:complexType>
           <xsd:sequence>
<!-- Header -->
               <xsd:element name="header">
                   <xsd:complexType>
                       <xsd:all>
                           <xsd:element name="resolution">
                               <xsd:complexType>
                                   <xsd:attribute name="x" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="y" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="aa" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="rdepth" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="rsamples" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="volume" type="xsd:float" use="required"/>
                                   <xsd:attribute name="apsamp" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="ssamp" type="xsd:boolean" use="required"/>
                                   <xsd:attribute name="ssdiff" type="xsd:float" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="general">
                               <xsd:complexType>
                                   <xsd:attribute name="animate" type="xsd:boolean" use="required"/>
                                   <xsd:attribute name="ftype" type="ImageFileType" use="required"/>
                                   <xsd:attribute name="frate" type="xsd:positiveInteger" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                       </xsd:all>
                   </xsd:complexType>
               </xsd:element>
<!-- Post Processing -->
               <xsd:element name="postproc">
                   <xsd:complexType>
                       <xsd:all>
                           <xsd:element name="gamma">
                               <xsd:complexType>
                                   <xsd:attribute name="factor" type="xsd:float" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="edgedetect">
                               <xsd:complexType>
                                   <xsd:all>
                                       <xsd:element name="settings" minOccurs="0">
                                           <xsd:complexType>
                                               <xsd:attribute name="detectm" use="required">
                                                   <xsd:simpleType>
                                                       <xsd:restriction base="xsd:string">
                                                           <xsd:enumeration value="rgb"/>
                                                            <xsd:enumeration value="r"/>
                                                           <xsd:enumeration value="g"/>
                                                           <xsd:enumeration value="b"/>
                                                           <xsd:enumeration value="hue"/>
                                                           <xsd:enumeration value="sat"/>
                                                           <xsd:enumeration value="val"/>
                                                       </xsd:restriction>
                                                   </xsd:simpleType>
                                               </xsd:attribute>
                                               <xsd:attribute name="colourm" use="required">
                                                   <xsd:simpleType>
                                                       <xsd:restriction base="xsd:string">
                                                           <xsd:enumeration value="colour"/>
                                                           <xsd:enumeration value="inv_av"/>
                                                           <xsd:enumeration value="average"/>
                                                           <xsd:enumeration value="grey_av"/>
                                                       </xsd:restriction>
                                                   </xsd:simpleType>
                                               </xsd:attribute>
                                               <xsd:attribute name="width" type="xsd:positiveInteger" use="required"/>
                                               <xsd:attribute name="difference" type="xsd:float" use="required"/>
                                               <xsd:attribute name="colour" type="vector" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:all>
                                   <xsd:attribute name="on" type="xsd:boolean" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="cellshade">
                               <xsd:complexType>
                                   <xsd:all>
                                       <xsd:element name="settings" minOccurs="0">
                                           <xsd:complexType>
                                               <xsd:attribute name="clamp" type="xsd:nonNegativeInteger" use="required"/>
                                               <xsd:attribute name="ncolours" type="xsd:positiveInteger" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:all>
                                   <xsd:attribute name="on" type="xsd:boolean" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="blueprint">
                               <xsd:complexType>
                                   <xsd:all>
                                       <xsd:element name="settings" minOccurs="0">
                                           <xsd:complexType>
                                               <xsd:attribute name="colour" type="vector" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:all>
                                   <xsd:attribute name="on" type="xsd:boolean" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="softfocus">
                               <xsd:complexType>
                                   <xsd:all>
                                       <xsd:element name="settings" minOccurs="0">
                                           <xsd:complexType>
                                               <xsd:attribute name="size" type="xsd:positiveInteger" use="required"/>
                                               <xsd:attribute name="fwhm" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:all>
                                   <xsd:attribute name="on" type="xsd:boolean" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="glow">
                               <xsd:complexType>
                                   <xsd:all>
                                       <xsd:element name="settings" minOccurs="0">
                                           <xsd:complexType>
                                               <xsd:attribute name="threshold" type="xsd:float" use="required"/>
                                               <xsd:attribute name="size" type="xsd:positiveInteger" use="required"/>
                                               <xsd:attribute name="fwhm" type="xsd:float" use="required"/>
                                               <xsd:attribute name="cheat" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:all>
                                   <xsd:attribute name="on" type="xsd:boolean" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                       </xsd:all>
                   </xsd:complexType>
               </xsd:element>
<!-- Cameras -->
               <xsd:element name="cameras">
                   <xsd:complexType>
                       <xsd:choice>
                           <xsd:element name="single" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="viewer" type="vector" use="required"/>
                                   <xsd:attribute name="focal" type="vector" use="required"/>
                                   <xsd:attribute name="up" type="vector" use="required"/>
                                   <xsd:attribute name="aspect" type="xsd:float" use="required"/>
                                   <xsd:attribute name="aperture" type="xsd:float" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="paused" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="viewer" type="vector" use="required"/>
                                   <xsd:attribute name="focal" type="vector" use="required"/>
                                   <xsd:attribute name="up" type="vector" use="required"/>
                                   <xsd:attribute name="aspect" type="xsd:float" use="required"/>
                                   <xsd:attribute name="aperture" type="xsd:float" use="required"/>
                                   <xsd:attribute name="time" type="xsd:nonNegativeInteger" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="crs" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:choice minOccurs="4" maxOccurs="unbounded">
                                       <xsd:element name="control">
                                           <xsd:complexType>
                                               <xsd:attribute name="viewer" type="vector" use="required"/>
                                               <xsd:attribute name="focal" type="vector" use="required"/>
                                               <xsd:attribute name="up" type="vector" use="required"/>
                                               <xsd:attribute name="aperture" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:choice>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="points" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="time" type="xsd:positiveInteger" use="required"/>
                                   <xsd:attribute name="aspect" type="xsd:float" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                       </xsd:choice>
                       <xsd:attribute name="number" type="xsd:positiveInteger" use="required"/>
                   </xsd:complexType>
               </xsd:element>
<!-- Environemnt -->
               <xsd:element name="environment">
                   <xsd:complexType>
                       <xsd:attribute name="ambient" type="vector" use="required"/>
                   </xsd:complexType>
               </xsd:element>
<!-- Materials -->
               <xsd:element name="materials">
                   <xsd:complexType>
                       <xsd:choice maxOccurs="unbounded">
                           <xsd:element name="base" minOccurs="1" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="diffuse" type="vector" use="required"/>
                                   <xsd:attribute name="specular" type="vector" use="required"/>
                                   <xsd:attribute name="transmit" type="vector" use="required"/>
                                   <xsd:attribute name="coefficients" type="vector" use="required"/>
                                   <xsd:attribute name="ior" type="xsd:float" use="required"/>
                                   <xsd:attribute name="extinction" type="xsd:float" use="required"/>
                                   <xsd:attribute name="shinyness" type="xsd:double" use="required"/>
                                   <xsd:attribute name="tri" type="xsd:boolean" use="required"/>
                                   <xsd:attribute name="g_ior" type="xsd:float" use="optional"/>
                                   <xsd:attribute name="b_ior" type="xsd:float" use="optional"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="texture" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="file" type="xsd:string" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="procedural" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="0" maxOccurs="1">
                                       <xsd:element name="ramp" minOccurs="0" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="number" type="xsd:nonNegativeInteger" use="required"/>
                                               <xsd:attribute name="triplets" type="floatlist" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="type" use="required">
                                       <xsd:simpleType>
                                           <xsd:restriction base="xsd:string">
                                               <xsd:enumeration value="greyscale"/>
                                               <xsd:enumeration value="colour"/>
                                               <xsd:enumeration value="ramp"/>
                                           </xsd:restriction>
                                       </xsd:simpleType>
                                   </xsd:attribute>
                                   <xsd:attribute name="equation1" type="xsd:string" use="required"/>
                                   <xsd:attribute name="equation2" type="xsd:string" use="optional"/>
                                   <xsd:attribute name="equation3" type="xsd:string" use="optional"/>
                               </xsd:complexType>
                           </xsd:element>
                       </xsd:choice>
                       <xsd:attribute name="nbase" type="xsd:positiveInteger" use="required"/>
                       <xsd:attribute name="ntext" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="nproc" type="xsd:nonNegativeInteger" use="required"/>
                   </xsd:complexType>
               </xsd:element>
<!-- Objects -->
               <xsd:element name="objects">
                   <xsd:complexType>
                       <xsd:choice minOccurs="0" maxOccurs="unbounded">
                           <xsd:element name="mesh" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required"/>
                                   <xsd:attribute name="name" type="xsd:string" use="required"/>
                                   <xsd:attribute name="filename" type="xsd:string" use="required"/>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="rectangle" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="1" maxOccurs="1">
                                       <xsd:group ref="objectsettings" minOccurs="1" maxOccurs="1"/>
                                       <xsd:element name="extended" minOccurs="1" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="xsize" type="xsd:float" use="required"/>
                                               <xsd:attribute name="zsize" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="sphere" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="1" maxOccurs="1">
                                       <xsd:group ref="objectsettings" minOccurs="1" maxOccurs="1"/>
                                       <xsd:element name="extended" minOccurs="1" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="radius" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="slens" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="1" maxOccurs="1">
                                       <xsd:group ref="objectsettings" minOccurs="1" maxOccurs="1"/>
                                       <xsd:element name="extended" minOccurs="1" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="radius" type="xsd:float" use="required"/>
                                               <xsd:attribute name="roc" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="box" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="1" maxOccurs="1">
                                       <xsd:group ref="objectsettings" minOccurs="1" maxOccurs="1"/>
                                       <xsd:element name="extended" minOccurs="1" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="xside" type="xsd:float" use="required"/>
                                               <xsd:attribute name="yside" type="xsd:float" use="required"/>
                                               <xsd:attribute name="zside" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="prism" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="1" maxOccurs="1">
                                       <xsd:group ref="objectsettings" minOccurs="1" maxOccurs="1"/>
                                       <xsd:element name="extended" minOccurs="1" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="width" type="xsd:float" use="required"/>
                                               <xsd:attribute name="height" type="xsd:float" use="required"/>
                                               <xsd:attribute name="yside" type="xsd:float" use="required"/>
                                               <xsd:attribute name="skew" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                               </xsd:complexType>
                           </xsd:element>
                           <xsd:element name="instance" minOccurs="0" maxOccurs="unbounded">
                               <xsd:complexType>
                                   <xsd:sequence minOccurs="1" maxOccurs="1">
                                       <xsd:group ref="objectsettings" minOccurs="1" maxOccurs="1"/>
                                       <xsd:element name="extended" minOccurs="1" maxOccurs="1">
                                           <xsd:complexType>
                                               <xsd:attribute name="meshid" type="xsd:nonNegativeInteger" use="required"/>
                                               <xsd:attribute name="scaling" type="xsd:float" use="required"/>
                                           </xsd:complexType>
                                       </xsd:element>
                                   </xsd:sequence>
                               </xsd:complexType>
                           </xsd:element>
                       </xsd:choice>
                       <xsd:attribute name="meshes" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="rectangles" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="spheres" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="slenses" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="boxes" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="prisms" type="xsd:nonNegativeInteger" use="required"/>
                       <xsd:attribute name="instances" type="xsd:nonNegativeInteger" use="required"/>
                   </xsd:complexType>
               </xsd:element>
<!-- End elements -->
           </xsd:sequence>
           <xsd:attribute name="version" type="xsd:positiveInteger" use="required"/>
       </xsd:complexType>
   </xsd:element>

</xsd:schema>


Bottom image