summaryrefslogtreecommitdiff
path: root/hw6/doc/xml_scene_format.txt
blob: 1bdf4b5a50a29faee91a32d34dd3cf1cdedb9436 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
* The whole scene should be contained in a <scene> ... </scene> node.

* In a scene you can have (multiple of) the following nodes:
  - <camera>
  - <sceneGraphNode>
  - <triangleMesh>
  - <material>
  - <light>
  - <intersector>
  - <texture>
  - <renderer>

* Basic value types:
  - vec3d "x y z" or "xyz". E.g., name="1.0 2.0 3.0" (vec3d(1,2,3)) or name="1.0" (vec3d(1,1,1)).
  - vec2d "x y" or "xy"
  - float "f"
  - string "s"
  - integer "i"
  - bool "true" or "false"
  - color "r g b" or "rgb"

* A <camera> node is of the form: <camera eye=vec3d view=vec3d up=vec3d fov=float width=integer height=integer auto=bool/>, with the following defaults:
  - eye="0.0 0.0 0.0"
  - view="0.0 0.0 1.0"
  - up="0.0 1.0 0.0"
  - fov="60"
  - width="256"
  - height="256"
  - auto="false"
 When 'auto' is set to true, the camera will be moved along the view direction (i.e., change 'eye') such that the scene's bounding box fully falls within the view.

* <sceneGraphNode> has the following form: <sceneGraphNode id=string ref=string> .. </sceneGraphNode>, where either id or ref occurs. 'id' allows you to name the node. 'ref' refers to a named sceneGraphNode, and the rest of the sceneGraphNode is ignored.  A sceneGraphNode can contain (multiple of) the following nodes:
  - <transformation>
  - <sceneGraphNode>
  - <triangleMesh>
  - <material>

* A <transformation> node can have any of multiple of the following nodes:
  - <rotationX>
  - <rotationY>
  - <rotationZ>
  - <rotation>
  - <translation>
  - <scale>
  The resulting transformation is the multiplication of the nodes.E.g., a <rotationX> followed by a <rotationY> and then a <scale>, will be equivalent to <rotationX>*<rotationY>*<scale>

* A <rotation?> has the following form: <rotation? angle=float />

* A <translation> has the form: <translation offset=vec3d />

* A <scale> has the form: <scale scale=vec3d />

* A <rotation> has the form: <rotation angle=float axis=vec3d />, with a default of axis="0.0 0.0 1.0".

* A <triangleMesh> has the following form: <triangleMesh id=string ref=string filename=string> .. </triangleMesh>, where 'ref' and 'id' are the same as with <sceneGraphNode>, and 'obj' can contain the name of an OBJ file.  A triangleMesh can contain (multiple of) the following nodes:
  - <transformation>
  - <material>
  - <triangle> or <polygon>

* A <triangle> (or <polygon> node can have multiple occurances of a <vertex> which can have any of the following forms:
  - <vertex v=vec3d />
  - <vertex v=vec3d t=vec2d />
  - <vertex v=vec3d n=vec3d />
  - <vertex v=vec3d n=vec3d t=vec2d />
  where 'v' refers to the vertex position, 'n' to the vertex normal, and 't' to the vertex' texture coordinate. Vertices are expected to be provided in CCW order.

* A <material> node has the following form: <material id=string ref=string> which can have the following children:
  - <shadingFrameTransform>
  - <diffuse>
  - <phong>
  - <material> or <compound>

* A <shadingFrameTransformation> has the following form <shadingFrameTransform type=string> with the following general children:
  - <shadingFrameTransform>
  - <diffuse>
  - <phong>
  - <material> or <compound>
  in addition to specific node dependent children depending on the 'type' which can be:
  - normalMap
  - bumpMap

* A <normalMap> node has a <texture> child node, and a <material> node to apply it too.
* A <bumpMap> node has a <texture> child node, and a <material> node to apply it too. In addition, the shadingFrameTransformation-node also has a 'scale' parameter defined that sets the height of the bump, and a 'channel' parameter that indicates which color channel in the texture defines the bump map.

* A <diffuse> node has the following form <diffuse id=string ref=string>...</difuse>, where it can have the following children:
  - <albedo value=color> and which can have a <texture> as child. (preference if given of 'texture' over a fixed 'value'

* A <phong> node has the following form <phong id=string ref=string>...</phong>, where it can have the following children:
  - <albedo value=color> and which can have a <texture> as child. (preference if given of 'texture' over a fixed 'value'
  - <sharpness value=float channel=integer> and which can have a <texture> as child. (preference if given of 'texture' over a fixed 'value'

* A <light> node has the following form: <light type=string .../>. Depending on type the following additional parameters are defined:
 - "directional": 'direction=vec3d power=color'
 - "spot": 'direction=vec3d power=color position=vec3d cutoff=float sharpness=float attenutation=vec3d'
 - "point": 'position=vec3d power=color attenuation=vec3d'
 - "area": 'power=color attenuation=vec3d'. Furthermore, it can have a <material> and <sceneGraphNode>/<triangleMesh> children. The material is the surface reflectance of the light source, and the geometry represents the shape of the area light source.

* An <intersector> node has the following form: <intersector type=string />, where type can be any of the following:
  - "linear" : brute force linear intersector O(N) time complexity.
  - "bvh" : bounding volume hierarchy


* A <texture> node has the following form: <texture type=string filename=string repeat=bool/>, where type can be
  - "nearest": nearest pixel look-up.
  - "bilinear": bilinear interpolation.
  Textures are cached (map based on filename & type) and only read once.  


* A <renderer> node has the following forms: 
  - <renderer type="raycasting"/>
  - <renderer type="recursiveRaytracing" maxDepth=int samplesPerPixel=int />
  - <renderer type="pathtracing" samplesPerPixel=int directOnly=bool />