mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.8k stars 429 forks source link

imgtool denoise-optix crashing #368

Closed wahn closed 1 year ago

wahn commented 1 year ago

I tried to install CUDA and OptiX (on Ubuntu 22.04.2 LTS) to use the imgtool for denoising. After rendering the resulting image looks good:

$ imgtool info camera-1.exr
camera-1.exr:
    resolution (750, 750)
    pixel format: Half
    color space :  (unspecified)
    full resolution (750, 750)
    pixel bounds (0, 0) - (750, 750)
    render time: 0h 0m 15.37s (total 15.37s)
    camera from world: [ [ 1, 0, 0, -359.17828 ], [ 0, 0.9985989, -0.052919526, -131.93643 ], [ 0, -0.052919526, -0.9985989, 477.11032 ], [ 0, 0, 0, 1 ] ]
    NDC from world: [ [ 3.3455782, -0.026459763, -0.49929944, -963.1039 ], [ 0, 3.314431, -0.6763458, -202.8485 ], [ 0, -0.05291979, -0.9986039, 477.1077 ], [ 0, -0.052919526, -0.9985989, 477.11032 ] ]
    samples per pixel: 16
    Channels:
                    Albedo.B: min   -0.0245361 max      1.76562 avg     0.625973 (0 infinite, 0 not-a-number)
                    Albedo.G: min  -0.00189209 max      1.69141 avg     0.639774 (0 infinite, 0 not-a-number)
                    Albedo.R: min    -0.111877 max      1.89355 avg     0.659426 (0 infinite, 0 not-a-number)
                           B: min     -1.03125 max      31.4219 avg     0.345797 (0 infinite, 0 not-a-number)
                           G: min     -2.65234 max      24.6406 avg     0.343244 (0 infinite, 0 not-a-number)
                         N.X: min           -1 max     0.992188 avg  -0.00319774 (0 infinite, 0 not-a-number)
                         N.Y: min           -1 max     0.999023 avg    0.0890586 (0 infinite, 0 not-a-number)
                         N.Z: min           -1 max    0.0529175 avg    -0.871368 (0 infinite, 0 not-a-number)
                        Ns.X: min           -1 max     0.991699 avg   -0.0129379 (0 infinite, 0 not-a-number)
                        Ns.Y: min           -1 max            1 avg     0.115018 (0 infinite, 0 not-a-number)
                        Ns.Z: min           -1 max    0.0554199 avg    -0.850936 (0 infinite, 0 not-a-number)
                         P.X: min     -157.625 max      157.625 avg       0.7722 (0 infinite, 0 not-a-number)
                         P.Y: min         -116 max      155.625 avg      4.42077 (0 infinite, 0 not-a-number)
                         P.Z: min        777.5 max         1056 avg      996.507 (0 infinite, 0 not-a-number)
                           R: min     -10.0547 max      26.9062 avg     0.385195 (0 infinite, 0 not-a-number)
          RelativeVariance.B: min            0 max       444.75 avg      1.17447 (0 infinite, 0 not-a-number)
          RelativeVariance.G: min            0 max      182.875 avg     0.871609 (0 infinite, 0 not-a-number)
          RelativeVariance.R: min            0 max      151.625 avg     0.859556 (0 infinite, 0 not-a-number)
                  Variance.B: min            0 max        13168 avg      1.07092 (0 infinite, 0 not-a-number)
                  Variance.G: min            0 max         2380 avg     0.561358 (0 infinite, 0 not-a-number)
                  Variance.R: min            0 max         1705 avg      0.53927 (0 infinite, 0 not-a-number)
                        dzdx: min            0 max      6.28516 avg    0.0198899 (0 infinite, 0 not-a-number)
                        dzdy: min  5.96046e-08 max        5.875 avg    0.0774033 (0 infinite, 0 not-a-number)
                           u: min     -9.40625 max      6.46094 avg      1.23162 (0 infinite, 0 not-a-number)
                           v: min     -4.96484 max      4.90625 avg      1.01561 (0 infinite, 0 not-a-number)

But unfortunately the denoising fails with a crash:

$ imgtool denoise-optix camera-1.exr --outfile camera-1-denoised.exr
[ tid 42822 @     0.000s cmd/imgtool.cpp:2285 ] FATAL Check failed: desc
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef46bc077a - pbrt::PrintStackTrace() + 0x3a
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef46bc0a11 - pbrt::CheckCallbackScope::Fail() + 0x21
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef46c31692 - pbrt::LogFatal(pbrt::LogLevel, char const*, int, char const*) + 0xf2
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef46a1485c - void pbrt::LogFatal<char const (&) [5]>(pbrt::LogLevel, char const*, int, char const*, char const (&) [5]) + 0x5c
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef469f1810 - denoise_optix(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) + 0x16a0
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef469d2b74 - main + 0x4a4
(/lib/x86_64-linux-gnu/libc.so.6         )  0x0x7f1beb4e6d90 - (unknown) + 0x29d90
(/lib/x86_64-linux-gnu/libc.so.6         )  0x0x7f1beb4e6e40 - __libc_start_main + 0x80
(/media/datadisk3/git/github/pbrt-v4/build/imgtool) 0x0x55ef469d9845 - _start + 0x25

Aborted (core dumped)

More details are here: https://www.janwalter.org/rnd/blog/rnd-pbrt-v4-002/

mmp commented 1 year ago

My bad, sorry. Should be fixed now.