Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLT generates NaN ? #134

Closed
Vutshi opened this issue May 29, 2021 · 4 comments
Closed

MLT generates NaN ? #134

Vutshi opened this issue May 29, 2021 · 4 comments

Comments

@Vutshi
Copy link

Vutshi commented May 29, 2021

I am not sure wherever it is a bug or I am doing something wrong. I tried to use MLT integrator with regularization in Dambreak scene. After a couple of hours the rendering stopped with the following message:

nice ../../pbrt-latest_v3/build_native/pbrt --write-partial-images --seed 123 mlt_dambreak0.pbrt
pbrt version 4 (built May 24 2021 at 14:12:57)
Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the Apache 2.0 License.
See the file LICENSE.txt for the conditions of the license.
Generating bootstrap paths: [++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]  (10.6s)
Rendering: [++                                                                                                 ]  (5688.5s|278737.1s)  [ tid 003 @     0.000s /home/denis/install/3D/pbrt/pbrt-latest_v3/src/pbrt/film.cpp:488 ] FATAL Check failed: !L.HasNaNs()
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88eedd30d - pbrt::PrintStackTrace() + 0x3d
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88eedd5f1 - pbrt::CheckCallbackScope::Fail() + 0x21
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88ecdcf57 - pbrt::LogFatal(pbrt::LogLevel, char const*, int, char const*) + 0x117
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88edc9d1a - void pbrt::LogFatal<char const (&) [13]>(pbrt::LogLevel, char const*, int, char const*, char const (&) [13]) + 0x5a
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88edc3e06 - (unknown) + 0x360e06
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88eebe461 - (unknown) + 0x45b461
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88ebd8e2b - std::_Function_handler<void (long, long), pbrt::ParallelFor(long, long, std::function<void (long)>)::{lambda(long, long)#1}>::_M_invoke(std::_Any_data const&, long&&, std::_Any_data const&) + 0x5b
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88ed0d221 - pbrt::ParallelForLoop1D::RunStep(std::unique_lock<std::mutex>*) + 0xd1
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88ed0d32d - pbrt::ThreadPool::WorkOrWait(std::unique_lock<std::mutex>*) + 0x3d
(../../pbrt-latest_v3/build_native/pbrt  )      0x0x55e88ed0e3cb - pbrt::ThreadPool::workerFunc(int) + 0x7b
(/usr/lib/x86_64-linux-gnu/libstdc++.so.6)      0x0x7fceba0da6df - (unknown) + 0xbd6df
(/lib/x86_64-linux-gnu/libpthread.so.0   )      0x0x7fceba5ca6db - (unknown) + 0x76db
(/lib/x86_64-linux-gnu/libc.so.6         )      0x0x7fceb9797a3f - clone + 0x3f
Rendering failed. Debug with --debugstart 8,0.9529413,0.6660328,0.83943886,0.65209574,0.23245178,0.005317758,0.47341684,0.6334719,0.6588557,0.9436859,0.44795358,0,0.7273973,0.36947548,0,0.6455976,0.8986827,0,0.8092342,0.9637802,0,0.11314469,0.4430935,0,0.37096515,0.9063639,0,0.80943274,0.352374,0,0.8580127,0.10318646,0,0.20121235,0.5568399,0,0.5285762,0.8616952,0,0.37408966,0.14323586,0,0.64026034,0.021495987,0,0.78074974,0.9877831,0,0.23040411,0.2794585,0,0.7579606,0.59357923,0,0.60892606,0.10928405,0,0.6814335,1,0,0.76458156,0.5667174,0,0.3175393,0.4408913,0,0.101278484,0.23244011,0,0.98793393,0.98233604,0,0.1620102,0.92256045,0,0.60174024,0.7933252,0,0.9751345,0.655834,0,0.81617314,0.650462,0,0.9308197,0.5189497,0,0.70974964,0.86548287,0,0.8460869,0.6153777,0,0.422762,0.13643192,0,0.7826264,0.6003363,0,0.77530897,0,0,0.33184534,0,0,0.49136093,0,0,0.7948081,0,0,0.24160881,0,0,0.5458607,0"


Aborted

pbrt was compiled with -O3 -march=native and the scene file is attached below.
mlt_dambreak0.pbrt.txt

@Vutshi
Copy link
Author

Vutshi commented May 30, 2021

I don't see this problem anymore on the latest commit. The NaN error was obtained with pbrt code version actual on May 21, 2021.
The only strange behaviour left is no intermediate output file generated with activated option --write-partial-images. The partial images worked fine with volpath integrator though.

@mmp
Copy link
Owner

mmp commented Jun 1, 2021

I tried to reproduce this and was having trouble, so I'm glad to hear it's now fixed. (In general, any time the renderer crashes, it's definitely a bug, so please do keep reporting those.)

Good catch that --write-partial-images isn't supported with the MLT integrator; I filed #137 to fix that.

@mmp mmp closed this as completed Jun 1, 2021
@Vutshi
Copy link
Author

Vutshi commented Jun 13, 2021

I tried to reproduce this and was having trouble, so I'm glad to hear it's now fixed.

@mmp
Apparently, something strange is still going on with MLT. This time NaN was generated in contemporary-bathroom scene (on the latest version of pbrt).

~/install/3D/pbrt/pbrt-scenes/contemporary-bathroom$ nice ../../pbrt-latest_v3/build_native_v4/pbrt --write-partial-images --seed 123 contemporary-bathroom_mlt.pbrt
pbrt version 4 (built Jun 11 2021 at 20:56:14)
Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the Apache 2.0 License.
See the file LICENSE.txt for the conditions of the license.
Generating bootstrap paths: [++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]  (11.1s)
Rendering: [+++++++++++++++++++++++++++++++++++++++++++++++++++                                                ]  (67521.5s|63588.2s)  [ tid 003 @     0.000s /home/denis/install/3D/pbrt/pbrt-latest_v3/src/pbrt/util/sampling.cpp:73 ] FATAL Check failed: !IsNaN(cosBp)
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1388ce3ed - pbrt::PrintStackTrace() + 0x3d
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1388ce6d1 - pbrt::CheckCallbackScope::Fail() + 0x21
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1386d0007 - pbrt::LogFatal(pbrt::LogLevel, char const*, int, char const*) + 0x117
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f13870f3e8 - pbrt::SampleSphericalTriangle(pstd::array<pbrt::Point3<float>, 3> const&, pbrt::Point3<float>, pbrt::Point2<float>, float*) + 0xe18
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1388087e0 - pbrt::Triangle::Sample(pbrt::ShapeSampleContext const&, pbrt::Point2<float>) const + 0x3d0
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1387f1bed - pbrt::DiffuseAreaLight::SampleLi(pbrt::LightSampleContext, pbrt::Point2<float>, pbrt::SampledWavelengths, pbrt::LightSamplingMode) const + 0x13d
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1388beea1 - pstd::optional<pbrt::LightLiSample> pbrt::detail::Dispatch<pbrt::Light::SampleLi(pbrt::LightSampleContext, pbrt::Point2<float>, pbrt::SampledWavelengths, pbrt::LightSamplingMode) const::{lambda(auto:1)#1}&, pstd::optional<pbrt::LightLiSample>, pbrt::PointLight, pbrt::DistantLight, pbrt::ProjectionLight, pbrt::GoniometricLight, pbrt::SpotLight, pbrt::DiffuseAreaLight, pbrt::UniformInfiniteLight, pbrt::ImageInfiniteLight, pbrt::PortalImageInfiniteLight>(pbrt::Light::SampleLi(pbrt::LightSampleContext, pbrt::Point2<float>, pbrt::SampledWavelengths, pbrt::LightSamplingMode) const::{lambda(auto:1)#1}&, void const*, int) + 0xd31
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f138891d48 - pbrt::ConnectBDPT(pbrt::Integrator const&, pbrt::SampledWavelengths&, pbrt::Vertex*, pbrt::Vertex*, int, int, pbrt::LightSampler, pbrt::Camera, pbrt::Sampler, pstd::optional<pbrt::Point2<float> >*, float*) + 0xb68
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f138899ab1 - pbrt::MLTIntegrator::L(pbrt::ScratchBuffer&, pbrt::MLTSampler&, int,
pbrt::Point2<float>*, pbrt::SampledWavelengths*) + 0x7c1
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f13889a3e8 - (unknown) + 0x4463e8
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f1385cd66b - std::_Function_handler<void (long, long), pbrt::ParallelFor(long, long, std::function<void (long)>)::{lambda(long, long)#1}>::_M_invoke(std::_Any_data const&, long&&, std::_Any_data const&) + 0x5b
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f138701771 - pbrt::ParallelForLoop1D::RunStep(std::unique_lock<std::mutex>*) + 0xd1
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f13870187d - pbrt::ThreadPool::WorkOrWait(std::unique_lock<std::mutex>*) + 0x3d
(../../pbrt-latest_v3/build_native_v4/pbrt)     0x0x55f13870298b - pbrt::ThreadPool::workerFunc(int) + 0x7b
(/usr/lib/x86_64-linux-gnu/libstdc++.so.6)      0x0x7f408b3be6df - (unknown) + 0xbd6df
(/lib/x86_64-linux-gnu/libpthread.so.0   )      0x0x7f408b8ae6db - (unknown) + 0x76db
(/lib/x86_64-linux-gnu/libc.so.6         )      0x0x7f408aa7ba3f - clone + 0x3f
Rendering failed. Debug with --debugstart 1,0.6585567,0.20555282,0.32736298,0.23283757,0.67518145,0.5127027,0.27794972,0.43664768,0.86253744,0.5439248,0.18704303,0,0.517551,0.56373316,0,0.5570287,0,0,0.97863954,0,0,0.90481824,0,0,0.1353377,0,0,0.7938408,0"


Aborted

It seems that seed parameter has been activated recently in MLT, hopefully it will help debugging.
The scene file:
contemporary-bathroom_mlt.pbrt.txt
Best

@Vutshi
Copy link
Author

Vutshi commented Jun 13, 2021

Oh, I see. It seems to be the case of a triangle covering the entire hemisphere. Isn't there a way to rewrite the formulas to avoid division by zero?

huongoss pushed a commit to huongoss/pbrt-v4-docker that referenced this issue Aug 30, 2024
C++20 usage & other improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants