Skip to content

Commit 6ee8aee

Browse files
committed
more evaluation
1 parent 62026b9 commit 6ee8aee

11 files changed

Lines changed: 219 additions & 42 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"technique": {
3+
"type": "path",
4+
"max_depth": 4,
5+
"light_selector": "hierarchy"
6+
},
7+
"externals": [
8+
{"filename": "multilight.json"}
9+
]
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"technique": {
3+
"type": "path",
4+
"max_depth": 4,
5+
"light_selector": "simple"
6+
},
7+
"externals": [
8+
{"filename": "multilight.json"}
9+
]
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"technique": {
3+
"type": "path",
4+
"max_depth": 4,
5+
"light_selector": "uniform"
6+
},
7+
"externals": [
8+
{"filename": "multilight.json"}
9+
]
10+
}

scenes/evaluation/multilight.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"technique": {
3+
"type": "path",
4+
"max_depth": 4
5+
},
6+
"camera": {
7+
"type": "perspective",
8+
"fov": 90,
9+
"near_clip": 0.01,
10+
"far_clip": 100,
11+
"transform": { "lookat": {"origin":[0, 0, -2], "direction": [0,0,1], "up":[0,1,0]} }
12+
},
13+
"film": {
14+
"size": [256, 256]
15+
},
16+
"textures": [],
17+
"bsdfs": [
18+
{
19+
"name": "Bottom",
20+
"type": "diffuse",
21+
"reflectance": [0.885809, 0.698859, 0.666422]
22+
},
23+
{
24+
"name": "Black",
25+
"type": "diffuse",
26+
"reflectance": [0, 0, 0]
27+
}
28+
],
29+
"shapes": [
30+
{
31+
"name": "Bottom",
32+
"type": "ply",
33+
"filename": "../meshes/Bottom.ply"
34+
},
35+
{
36+
"name": "Top",
37+
"type": "ply",
38+
"filename": "../meshes/Top.ply"
39+
}
40+
],
41+
"entities": [
42+
{
43+
"name": "__entity_1",
44+
"shape": "Bottom",
45+
"bsdf": "Bottom"
46+
},
47+
{
48+
"name": "__light",
49+
"shape": "Top",
50+
"bsdf": "Black"
51+
}
52+
],
53+
"lights": [
54+
{
55+
"name": "__light_0",
56+
"type": "area",
57+
"entity": "__light",
58+
"radiance": [1,1,1]
59+
},
60+
{
61+
"name": "__light_1",
62+
"type": "constant",
63+
"radiance": [0.2,0.2,0.2]
64+
}
65+
]
66+
}

scenes/evaluation/multilight.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<scene version="2.0.0">
2+
<default name="spp" value="4096"/>
3+
<default name="res" value="256"/>
4+
<default name="max_depth" value="4"/>
5+
6+
<integrator type="path">
7+
<integer name="max_depth" value="$max_depth"/>
8+
</integrator>
9+
10+
<sensor type="perspective">
11+
<float name="near_clip" value="0.00001"/>
12+
<float name="far_clip" value="100"/>
13+
<float name="fov" value="90"/>
14+
<transform name="to_world">
15+
<lookat origin="0,0,-2"
16+
target="0,0,0"
17+
up ="0,1,0"/>
18+
</transform>
19+
<sampler type="independent"> <!-- ldsampler -->
20+
<integer name="sample_count" value="$spp"/>
21+
</sampler>
22+
<film type="hdrfilm">
23+
<integer name="width" value="$res"/>
24+
<integer name="height" value="$res"/>
25+
<rfilter type="box"/>
26+
<string name="pixel_format" value="rgb"/>
27+
</film>
28+
</sensor>
29+
30+
<bsdf type="diffuse" id="Bottom">
31+
<rgb name="reflectance" value="0.885809, 0.698859, 0.666422"/>
32+
</bsdf>
33+
34+
<bsdf type="diffuse" id="Black">
35+
<rgb name="reflectance" value="0, 0, 0"/>
36+
</bsdf>
37+
38+
<shape type="ply">
39+
<string name="filename" value="../meshes/Bottom.ply"/>
40+
<ref id="Bottom"/>
41+
</shape>
42+
43+
<shape type="ply">
44+
<string name="filename" value="../meshes/Top.ply"/>
45+
<ref id="Black"/>
46+
<emitter type="area">
47+
<spectrum name="radiance" value="1"/>
48+
</emitter>
49+
</shape>
50+
51+
<emitter type="constant" id="emitter">
52+
<rgb name="radiance" value="0.2, 0.2, 0.2"/>
53+
</emitter>
54+
</scene>
-291 KB
Binary file not shown.
46.9 KB
Binary file not shown.

scripts/MakeEvaluationFigure.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import simpleimageio as sio
44
import figuregen
55
import sys
6-
import os
76
import numpy as np
87
import matplotlib.cm as cm
98

@@ -41,20 +40,22 @@ def error_image(img, ref):
4140
ref_dir = sys.argv[2]
4241

4342
scenes = [
44-
("plane", 1),
45-
("plane", 6),
46-
("cbox", 1),
47-
("cbox", 6),
48-
("room", 4),
49-
("plane-scale", 4),
50-
("volume", 12),
51-
("env", 6),
52-
("env4k", 6),
53-
("env4kNoCDF", 6),
43+
("plane", None, 1),
44+
("plane", None, 6),
45+
("cbox", None, 1),
46+
("cbox", None, 6),
47+
("room", None, 4),
48+
("plane-scale", None, 4),
49+
("volume", None, 12),
50+
("env", None, 6),
51+
("env4k", None, 6),
52+
("env4kNoCDF", "env4k", 6),
53+
("multilight-uniform", "multilight", 4),
54+
("multilight-simple", "multilight", 4),
55+
("multilight-hierarchy", "multilight", 4),
5456
]
5557

56-
image_names = [f"{scene}4096-d{depth}" for (scene, depth) in scenes]
57-
ref_names = ["ref-" + name for name in image_names]
58+
image_names = [f"{scene}4096-d{depth}" for (scene, _, depth) in scenes]
5859

5960
title = figuregen.Grid(1, 1)
6061
title.get_element(0, 0).set_image(
@@ -64,9 +65,9 @@ def error_image(img, ref):
6465
errors = []
6566
grid = figuregen.Grid(len(image_names), 3)
6667
i = 0
67-
for scene, depth in scenes:
68+
for scene, ref_name, depth in scenes:
6869
image_name = f"{scene}4096-d{depth}"
69-
ref_name = "ref-" + image_name
70+
ref_name = "ref-" + (image_name if ref_name is None else f"{ref_name}4096-d{depth}")
7071

7172
img = sio.read(f"{result_dir}/{image_name}.exr")
7273
ref_img = sio.read(f"{ref_dir}/{ref_name}.exr")
@@ -81,7 +82,7 @@ def error_image(img, ref):
8182

8283
grid.set_col_titles("top", ["Reference", "Render", "Rel. Error"])
8384
grid.set_row_titles(
84-
"left", [f"{scene}-d{depth}" for (scene, depth) in scenes])
85+
"left", [f"{scene}-d{depth}" for (scene, _, depth) in scenes])
8586
grid.set_row_titles("right", [f"RelMSE {err:.2E}" for err in errors])
8687

8788
rows = []

scripts/run_evaluations.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@ output_dir=.
1111

1212
args="--spp ${spp} $@"
1313

14-
igcli ${args} -o ${output_dir}/cbox${spp}-d6.exr ${scene_dir}/cbox.json --gpu
15-
igcli ${args} -o ${output_dir}/cbox${spp}-d1.exr ${scene_dir}/cbox-d1.json --gpu
16-
igcli ${args} -o ${output_dir}/cbox${spp}-cpu-d6.exr ${scene_dir}/cbox.json --cpu
17-
igcli ${args} -o ${output_dir}/cbox${spp}-cpu-d1.exr ${scene_dir}/cbox-d1.json --cpu
14+
# igcli ${args} -o ${output_dir}/cbox${spp}-d6.exr ${scene_dir}/cbox.json --gpu
15+
# igcli ${args} -o ${output_dir}/cbox${spp}-d1.exr ${scene_dir}/cbox-d1.json --gpu
16+
# igcli ${args} -o ${output_dir}/cbox${spp}-cpu-d6.exr ${scene_dir}/cbox.json --cpu
17+
# igcli ${args} -o ${output_dir}/cbox${spp}-cpu-d1.exr ${scene_dir}/cbox-d1.json --cpu
1818

19-
igcli ${args} -o ${output_dir}/plane${spp}-d6.exr ${scene_dir}/plane.json --gpu
20-
igcli ${args} -o ${output_dir}/plane${spp}-d1.exr ${scene_dir}/plane-d1.json --gpu
21-
igcli ${args} -o ${output_dir}/plane${spp}-cpu-d6.exr ${scene_dir}/plane.json --cpu
22-
igcli ${args} -o ${output_dir}/plane${spp}-cpu-d1.exr ${scene_dir}/plane-d1.json --cpu
19+
# igcli ${args} -o ${output_dir}/plane${spp}-d6.exr ${scene_dir}/plane.json --gpu
20+
# igcli ${args} -o ${output_dir}/plane${spp}-d1.exr ${scene_dir}/plane-d1.json --gpu
21+
# igcli ${args} -o ${output_dir}/plane${spp}-cpu-d6.exr ${scene_dir}/plane.json --cpu
22+
# igcli ${args} -o ${output_dir}/plane${spp}-cpu-d1.exr ${scene_dir}/plane-d1.json --cpu
2323

24-
igcli ${args} -o ${output_dir}/room${spp}-d4.exr ${scene_dir}/room.json --gpu
24+
# igcli ${args} -o ${output_dir}/room${spp}-d4.exr ${scene_dir}/room.json --gpu
2525

26-
igcli ${args} -o ${output_dir}/plane-scale${spp}-d4.exr ${scene_dir}/plane-scale.json --gpu
26+
# igcli ${args} -o ${output_dir}/plane-scale${spp}-d4.exr ${scene_dir}/plane-scale.json --gpu
2727

28-
igcli ${args} -o ${output_dir}/volume${spp}-d12.exr ${scene_dir}/volume.json --gpu
28+
# igcli ${args} -o ${output_dir}/volume${spp}-d12.exr ${scene_dir}/volume.json --gpu
2929

30-
igcli ${args} -o ${output_dir}/env${spp}-d6.exr ${scene_dir}/env.json --gpu
31-
igcli ${args} -o ${output_dir}/env4k${spp}-d6.exr ${scene_dir}/env4k.json --gpu
32-
igcli ${args} -o ${output_dir}/env4kNoCDF${spp}-d6.exr ${scene_dir}/env4kNoCDF.json --gpu
30+
# igcli ${args} -o ${output_dir}/env${spp}-d6.exr ${scene_dir}/env.json --gpu
31+
# igcli ${args} -o ${output_dir}/env4k${spp}-d6.exr ${scene_dir}/env4k.json --gpu
32+
# igcli ${args} -o ${output_dir}/env4kNoCDF${spp}-d6.exr ${scene_dir}/env4kNoCDF.json --gpu
33+
34+
igcli ${args} -o ${output_dir}/multilight-uniform${spp}-d4.exr ${scene_dir}/multilight-uniform.json --gpu
35+
igcli ${args} -o ${output_dir}/multilight-simple${spp}-d4.exr ${scene_dir}/multilight-simple.json --gpu
36+
igcli ${args} -o ${output_dir}/multilight-hierarchy${spp}-d4.exr ${scene_dir}/multilight-hierarchy.json --gpu
3337

3438
python3 ${script} ${output_dir}/ ${scene_dir}/

src/artic/impl/light_hierarchy.art

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ mod light_hierarchy {
1616
dir: Vec3,
1717
flux: f32,
1818
id: i32,
19-
leaf: bool
19+
20+
has_dir: bool,
21+
is_leaf: bool
2022
}
2123

2224
fn @load_entry(id: i32, data: all::DeviceBuffer) -> LightHierarchyEntry {
@@ -27,19 +29,25 @@ mod light_hierarchy {
2729
LightHierarchyEntry {
2830
pos = all::make_vec3(e1.x, e1.y, e1.z),
2931
dir = all::make_vec3(e2.x, e2.y, e2.z),
30-
flux = e1.w,
32+
flux = math_builtins::fabs(e1.w),
3133
id = all::select(index < 0, -index - 1, index),
32-
leaf = index >= 0
34+
has_dir = !math_builtins::signbit(e1.w),
35+
is_leaf = index >= 0
3336
}
3437
}
3538

3639
fn @get_entry_cost(entry: LightHierarchyEntry, pos: Vec3) -> f32 {
3740
// TODO: Normal direction?
3841
let cdir = all::vec3_sub(entry.pos, pos);
3942
let dist2 = all::vec3_len2(cdir);
40-
let cos_d = math_builtins::fabs(all::vec3_dot(entry.dir, cdir)); // Has dist applied
4143

42-
entry.flux * cos_d / math_builtins::fmax(0.0001:f32, dist2)
44+
let cos_d = if entry.has_dir {
45+
math_builtins::fabs(all::vec3_dot(entry.dir, all::vec3_normalize(cdir)))
46+
} else {
47+
1:f32
48+
};
49+
50+
entry.flux * cos_d / math_builtins::fmax[f32](0.0001, dist2)
4351
}
4452

4553
fn @get_left_prop(left: LightHierarchyEntry, right: LightHierarchyEntry, pos: Vec3) -> f32 {
@@ -56,7 +64,7 @@ mod light_hierarchy {
5664
fn @sample_light_id(rnd: &mut RndState, pos: Vec3, data: DeviceBuffer) -> (i32, f32) {
5765
let mut pdf = 1:f32;
5866
let mut entry = load_entry(0, data);
59-
while !entry.leaf {
67+
while !entry.is_leaf {
6068
let (is_left, prop) = random_select_left(rnd, load_entry(entry.id, data), load_entry(entry.id+1, data), pos);
6169

6270
entry = load_entry(all::select(is_left, entry.id, entry.id+1), data);
@@ -70,7 +78,7 @@ mod light_hierarchy {
7078
let mut code = all::bitcast[u32](codes.load_i32(light.id));
7179
let mut pdf = 1:f32;
7280
let mut entry = load_entry(0, data);
73-
while !entry.leaf {
81+
while !entry.is_leaf {
7482
let left = load_entry(entry.id, data);
7583
let right = load_entry(entry.id+1, data);
7684
let prop = get_left_prop(left, right, pos);

0 commit comments

Comments
 (0)