wahn / rs_pbrt

Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code. See also https://www.rs-pbrt.org/about ...
https://www.rs-pbrt.org
Other
809 stars 59 forks source link

[debug] pbrt-v3-scenes/villa scene #111

Closed wahn closed 5 years ago

wahn commented 5 years ago

Currently (commit 09e476c66afe8546e9e9b3c0a700eb541f2a0965) the villa test scene renders differently for C++ ...

f16-20a

... and Rust

pbrt

Assumption: Something might go wrong with the glass material and letting light trough ...

wahn commented 5 years ago

Let's focus on this area:

Film "image"
...
  "float cropwindow" [ 0 0.25 0.75 1 ]
wahn commented 5 years ago

Most likely the problem is that we do not deal with shadowalpha yet (see https://www.pbrt.org/fileformat-v3.html#shapes):

> rg shadowalpha
geometry.pbrt
136:    Shape "plymesh" "string filename" "geometry/mesh_00032.ply" "float shadowalpha" [0]
144:    Shape "plymesh" "string filename" "geometry/mesh_00034.ply"  "float shadowalpha" [0]
150:    Shape "plymesh" "string filename" "geometry/mesh_00035.ply"  "float shadowalpha" [0]
162:    Shape "plymesh" "string filename" "geometry/mesh_00037.ply"  "float shadowalpha" [0]
180:    Shape "plymesh" "string filename" "geometry/mesh_00040.ply"  "float shadowalpha" [0]
186:    Shape "plymesh" "string filename" "geometry/mesh_00041.ply"  "float shadowalpha" [0]
740:    Shape "plymesh" "string filename" "geometry/mesh_00068.ply"  "float shadowalpha" [0]
1323:    Shape "plymesh" "string filename" "geometry/mesh_00137.ply"  "float shadowalpha" [0]
1463:    Shape "plymesh" "string filename" "geometry/mesh_00146.ply"  "float shadowalpha" [0]
1559:    Shape "plymesh" "string filename" "geometry/mesh_00162.ply"  "float shadowalpha" [0]
1627:    Shape "plymesh" "string filename" "geometry/mesh_00174.ply"  "float shadowalpha" [0]
2127:    Shape "plymesh" "string filename" "geometry/mesh_00258.ply"  "float shadowalpha" [0]
2147:    Shape "plymesh" "string filename" "geometry/mesh_00262.ply"  "float shadowalpha" [0]
2173:    Shape "plymesh" "string filename" "geometry/mesh_00267.ply"  "float shadowalpha" [0]
2181:    Shape "plymesh" "string filename" "geometry/mesh_00269.ply"  "float shadowalpha" [0]
wahn commented 5 years ago

Now both (C++ and Rust) versions render approx. the same image:

pbrt

> imf_diff -d -f pbrt.png pbrt_cpp.png diff.jpg
differing pixels:     1.509% (2075 of 137514)
average difference:   2.359%
maximum difference:  42.055%
Summary: Some pixels differ strongly.
== "pbrt.png" and "pbrt_cpp.png" are different

diff