Skip to content

Commit

Permalink
Fixed numerical problem with photon radiance calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kbladin committed Nov 8, 2015
1 parent 3d624eb commit 5a9ec1d
Show file tree
Hide file tree
Showing 13 changed files with 330 additions and 32 deletions.
Binary file added data/rendered_images/bunny_glass2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/rendered_images/dragon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 106 additions & 0 deletions data/scenes/complex.xml
@@ -0,0 +1,106 @@
<scene>
<!-- Define all materials used in the scene -->
<material id="mirror" reflectance="1" specular_reflectance="1" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.2" g="0.2" b="0.8" />
<color_specular r="0.6" g="0.9" b="1.0" />
</material>
<material id="glass" reflectance="1" specular_reflectance="1" transmissivity="1" refraction_index="1.6" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="colored_glass" reflectance="1" specular_reflectance="1" transmissivity="1" refraction_index="1.6" diffuse_roughness="0">
<color_diffuse r="0.5" g="1" b="0.7" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_red" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="0.2" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_green" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.2" g="1" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_blue" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.6" g="0.6" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_cyan" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.5" g="0.8" b="0.8" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_white" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_gray" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.5" g="0.5" b="0.5" />
<color_specular r="1" g="1" b="1" />
</material>

<!-- Back wall -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="1.5" y="-1" z="-1" />
<P2 x="-1.5" y="1" z="-1" />
</object3D>
<!-- Left wall -->
<object3D type="plane" material_id="diffuse_red">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="-1.5" y="1" z="-1" />
<P2 x="-1.5" y="-1" z="4" />
</object3D>
<!-- Right wall -->
<object3D type="plane" material_id="diffuse_green">
<P0 x="1.5" y="-1" z="-1" />
<P1 x="1.5" y="-1" z="4" />
<P2 x="1.5" y="1" z="-1" />
</object3D>
<!-- Roof -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="1" z="-1" />
<P1 x="1.5" y="1" z="-1" />
<P2 x="-1.5" y="1" z="4" />
</object3D>
<!-- Floor -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="-1.5" y="-1" z="4" />
<P2 x="1.5" y="-1" z="-1" />
</object3D>

<!-- Light source -->
<light_source type="lamp_plane" flux="8">
<P0 x="-0.3" y="0.9999" z="1.2" />
<P1 x="0.3" y="0.9999" z="1.2" />
<P2 x="-0.3" y="0.9999" z="1.8" />
<color r="1" g="1" b="1" />
</light_source>

<!-- Objects in scene -->
<object3D type="mesh" material_id="diffuse_cyan" file_path="../data/meshes/dragon.obj">
<transform type="scale">
<v x="1.2" y="1.2" z="1.2"/>
</transform>
<transform type="rotate" angle="-2.7">
<v x="0" y="1" z="0"/>
</transform>
<transform type="translate">
<v x="0" y="-1" z="0.5"/>
</transform>
</object3D>
<object3D type="sphere" material_id="glass" radius="0.1">
<position x="0.4" y="0.6" z="0.9" />
</object3D>
<object3D type="sphere" material_id="glass" radius="0.1">
<position x="-1.0" y="-0.6" z="1.3" />
</object3D>
<object3D type="sphere" material_id="glass" radius="0.2">
<position x="0.9" y="0.2" z="0.9" />
</object3D>
<object3D type="sphere" material_id="mirror" radius="0.3">
<position x="0.9" y="-0.7" z="1.1" />
</object3D>
<object3D type="sphere" material_id="mirror" radius="0.2">
<position x="-1.0" y="0.7" z="1.1" />
</object3D>
</scene>
98 changes: 98 additions & 0 deletions data/scenes/cornell_boxes.xml
@@ -0,0 +1,98 @@
<scene>
<!-- Define all materials used in the scene -->
<material id="mirror" reflectance="1" specular_reflectance="1" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.2" g="0.2" b="0.8" />
<color_specular r="1" g="0.95" b="0.9" />
</material>
<material id="glass" reflectance="1" specular_reflectance="1" transmissivity="1" refraction_index="1.6" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_red" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="0.2" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_green" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.2" g="1" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_blue" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.6" g="0.6" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_cyan" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.5" g="0.8" b="0.8" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_white" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="bunny_material" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>

<!-- Back wall -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="1.5" y="-1" z="-1" />
<P2 x="-1.5" y="1" z="-1" />
</object3D>
<!-- Left wall -->
<object3D type="plane" material_id="diffuse_red">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="-1.5" y="1" z="-1" />
<P2 x="-1.5" y="-1" z="4" />
</object3D>
<!-- Right wall -->
<object3D type="plane" material_id="diffuse_green">
<P0 x="1.5" y="-1" z="-1" />
<P1 x="1.5" y="-1" z="4" />
<P2 x="1.5" y="1" z="-1" />
</object3D>
<!-- Roof -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="1" z="-1" />
<P1 x="1.5" y="1" z="-1" />
<P2 x="-1.5" y="1" z="4" />
</object3D>
<!-- Floor -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="-1.5" y="-1" z="4" />
<P2 x="1.5" y="-1" z="-1" />
</object3D>

<!-- Light source -->
<light_source type="lamp_plane" flux="8">
<P0 x="-0.3" y="0.9999" z="1.2" />
<P1 x="0.3" y="0.9999" z="1.2" />
<P2 x="-0.3" y="0.9999" z="1.8" />
<color r="1" g="1" b="1" />
</light_source>

<!-- Objects in scene -->
<object3D type="mesh" material_id="diffuse_white" file_path="../data/meshes/cube.obj">
<transform type="scale">
<v x="0.4" y="0.4" z="0.4"/>
</transform>
<transform type="rotate" angle="-2.7">
<v x="0.2" y="1" z="0"/>
</transform>
<transform type="translate">
<v x="-0.5" y="-0.25" z="0.4"/>
</transform>
</object3D>
<object3D type="mesh" material_id="diffuse_white" file_path="../data/meshes/cube.obj">
<transform type="scale">
<v x="0.3" y="0.3" z="0.3"/>
</transform>
<transform type="rotate" angle="-2.7">
<v x="0" y="1" z="0.5"/>
</transform>
<transform type="translate">
<v x="0.65" y="-0.1" z="0.3"/>
</transform>
</object3D>
</scene>
6 changes: 5 additions & 1 deletion data/scenes/cornell_bunny.xml
Expand Up @@ -8,6 +8,10 @@
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="colored_glass" reflectance="1" specular_reflectance="1" transmissivity="1" refraction_index="1.6" diffuse_roughness="0">
<color_diffuse r="0.8" g="0.9" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_red" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="0.2" b="0.2" />
<color_specular r="1" g="1" b="1" />
Expand Down Expand Up @@ -73,7 +77,7 @@
</light_source>

<!-- Objects in scene -->
<object3D type="mesh" material_id="glass" file_path="../data/meshes/bunny.obj">
<object3D type="mesh" material_id="colored_glass" file_path="../data/meshes/bunny.obj">
<transform type="scale">
<v x="0.5" y="0.5" z="0.5"/>
</transform>
Expand Down
4 changes: 2 additions & 2 deletions data/scenes/cornell_dragon.xml
Expand Up @@ -65,15 +65,15 @@
</object3D>

<!-- Light source -->
<light_source type="lamp_plane" flux="10">
<light_source type="lamp_plane" flux="8">
<P0 x="-0.3" y="0.9999" z="1.2" />
<P1 x="0.3" y="0.9999" z="1.2" />
<P2 x="-0.3" y="0.9999" z="1.8" />
<color r="1" g="1" b="1" />
</light_source>

<!-- Objects in scene -->
<object3D type="mesh" material_id="diffuse_cyan" file_path="../data/meshes/dragon.obj">
<object3D type="mesh" material_id="diffuse_white" file_path="../data/meshes/dragon.obj">
<transform type="scale">
<v x="1.2" y="1.2" z="1.2"/>
</transform>
Expand Down
88 changes: 88 additions & 0 deletions data/scenes/cornell_monkey.xml
@@ -0,0 +1,88 @@
<scene>
<!-- Define all materials used in the scene -->
<material id="mirror" reflectance="1" specular_reflectance="1" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.2" g="0.2" b="0.8" />
<color_specular r="1" g="0.95" b="0.9" />
</material>
<material id="glass" reflectance="1" specular_reflectance="1" transmissivity="1" refraction_index="1.6" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_red" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="0.2" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_green" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.2" g="1" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_blue" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.6" g="0.6" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_cyan" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.5" g="0.8" b="0.8" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_white" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="bunny_material" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="1" g="1" b="1" />
<color_specular r="1" g="1" b="1" />
</material>

<!-- Back wall -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="1.5" y="-1" z="-1" />
<P2 x="-1.5" y="1" z="-1" />
</object3D>
<!-- Left wall -->
<object3D type="plane" material_id="diffuse_red">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="-1.5" y="1" z="-1" />
<P2 x="-1.5" y="-1" z="4" />
</object3D>
<!-- Right wall -->
<object3D type="plane" material_id="diffuse_green">
<P0 x="1.5" y="-1" z="-1" />
<P1 x="1.5" y="-1" z="4" />
<P2 x="1.5" y="1" z="-1" />
</object3D>
<!-- Roof -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="1" z="-1" />
<P1 x="1.5" y="1" z="-1" />
<P2 x="-1.5" y="1" z="4" />
</object3D>
<!-- Floor -->
<object3D type="plane" material_id="diffuse_white">
<P0 x="-1.5" y="-1" z="-1" />
<P1 x="-1.5" y="-1" z="4" />
<P2 x="1.5" y="-1" z="-1" />
</object3D>

<!-- Light source -->
<light_source type="lamp_plane" flux="8">
<P0 x="-0.3" y="0.9999" z="1.2" />
<P1 x="0.3" y="0.9999" z="1.2" />
<P2 x="-0.3" y="0.9999" z="1.8" />
<color r="1" g="1" b="1" />
</light_source>

<!-- Objects in scene -->
<object3D type="mesh" material_id="diffuse_white" file_path="../data/meshes/suzanne.obj">
<transform type="scale">
<v x="0.8" y="0.8" z="0.8"/>
</transform>
<transform type="orientation">
<normal x="-0.4" y="0.8" z="-0.3"/>
<up x="0" y="1" z="0"/>
</transform>
<transform type="translate">
<v x="0.0" y="-0.4" z="0.3"/>
</transform>
</object3D>
</scene>
2 changes: 1 addition & 1 deletion data/scenes/cornell_standard.xml
Expand Up @@ -16,7 +16,7 @@
<color_diffuse r="0.2" g="1" b="0.2" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="diffuse_blue" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<material id="diffuse_blue" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="1">
<color_diffuse r="0.6" g="0.6" b="1" />
<color_specular r="1" g="1" b="1" />
</material>
Expand Down
10 changes: 5 additions & 5 deletions data/scenes/oren_nayar_roughness.xml
Expand Up @@ -34,15 +34,15 @@
</material>

<!-- Materials with Oren Nayar reflectance model -->
<material id="high_roughness" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="100000">
<material id="high_roughness" reflectance="0.6" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="100000">
<color_diffuse r="0.8" g="0.8" b="1.0" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="medium_roughness" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="1">
<material id="medium_roughness" reflectance="0.6" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="1">
<color_diffuse r="0.8" g="0.8" b="1.0" />
<color_specular r="1" g="1" b="1" />
</material>
<material id="low_roughness" reflectance="0.8" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<material id="low_roughness" reflectance="0.6" specular_reflectance="0" transmissivity="0" refraction_index="1" diffuse_roughness="0">
<color_diffuse r="0.8" g="0.8" b="1.0" />
<color_specular r="1" g="1" b="1" />
</material>
Expand Down Expand Up @@ -79,15 +79,15 @@
</object3D>

<!-- Light source -->
<light_source type="lamp_plane" flux="30">
<light_source type="lamp_plane" flux="10">
<P0 x="-0.3" y="0.9999" z="0.7" />
<P1 x="0.3" y="0.9999" z="0.7" />
<P2 x="-0.3" y="0.9999" z="1.3" />
<color r="1" g="1" b="1" />
</light_source>

<!-- Objects in scene -->
<object3D type="sphere" material_id="low_roughness" radius="0.6">
<object3D type="sphere" material_id="high_roughness" radius="0.6">
<position x="0" y="-0.4" z="0" />
</object3D>
</scene>
3 changes: 1 addition & 2 deletions data/scenes/photon_map_test.xml
Expand Up @@ -73,7 +73,7 @@
</light_source>

<!-- Objects in scene -->
<!--

<object3D type="mesh" material_id="glass" file_path="../data/meshes/flat.obj">
<transform type="scale">
<v x="0.7" y="0.7" z="0.7"/>
Expand All @@ -93,5 +93,4 @@
<v x="1" y="0" z="0.5"/>
</transform>
</object3D>
-->
</scene>

0 comments on commit 5a9ec1d

Please sign in to comment.