Coder Social home page Coder Social logo

mmp / pbrt-v4 Goto Github PK

View Code? Open in Web Editor NEW
2.6K 2.6K 385.0 13.83 MB

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.

Home Page: https://pbrt.org

License: Apache License 2.0

CMake 0.33% Shell 0.01% C 4.43% C++ 95.10% Cuda 0.09% Python 0.04%

pbrt-v4's People

Contributors

1div0 avatar aclysma avatar anderslanglands avatar aspurdy avatar chaosink avatar dcousens avatar feimos32 avatar gonsolo avatar hannes-vernooij avatar hearwindsaying avatar jalberse avatar jromang avatar kingiler avatar luzpaz avatar mike-leo-smith avatar mmp avatar mserquet avatar pbrt4bounty avatar pierremoreau avatar ruevs avatar shadeops avatar stevemoody73 avatar stig-atle avatar togtja avatar vertexwahn avatar w3ntao avatar webanck avatar wjakob avatar wuyakuma avatar zzooooooozz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pbrt-v4's Issues

Save logs to a file

When starting PBRT via tools like Nsight Systems you do not get access to the application's output, leaving one in the dark as to why it stopped early.

Edit: I figured out how to access the logs in Nsight Systems, but I think it could still be a nice debugging feature to have.

pmj02bn skipping precomputed sets?

I'm not sure but it looks like the dimension variable is used to index into the pmj02bn sets, but those are tables of 2D points, so when the dimension gets incremented by 2, it would be skipping the next set without using it? Also the 1D samples don't use the precomputed tables, but they still increment the dimension value, so I think that would also skip unused sets of the precomputed samples.

I apologize if I'm mistaken about this, I haven't tested it, I was just reading the code.

missing strcasestr function in MSVC 2019

when I build pbrt-v4 in windows platform using MSVC 2019, strcasestr function is missing, used in file src\ext\rply\rply.cpp, line 382. I just replace it with strstr function.

Interior Mediums and Shape alphas

Description

When a ray hits a Shape primitive that has an alpha texture (value < 1), should pbrt evaluate the interior medium if one exists?

My first naive assumption was that alpha hit would be the equivalent to a Material "none", but that doesn't seem to be the case [1].

From reading the book [2], it appears the main use case of alpha is for things like leaves. Does it make sense to evaluate an interior medium?

Current behavior

Rendered with CPU with https://github.com/mmp/pbrt-v4/tree/8364444
single_v4

Expected behavior

Created by nesting a second slightly smaller shape inside.
nested_v4

Scene sources

pbrt_v4_medium.zip

References

[1]

pstd::optional<ShapeIntersection> GeometricPrimitive::Intersect(const Ray &r,
Float tMax) const {
pstd::optional<ShapeIntersection> si = shape.Intersect(r, tMax);
if (!si)
return {};
CHECK_LT(si->tHit, 1.001 * tMax);
// Test intersection against alpha texture, if present
if (alpha) {
if (Float a = alpha.Evaluate(si->intr); a < 1) {
Float u = (a <= 0)
? 1.f
: (uint32_t(Hash(r.o.x, r.o.y, r.o.z, r.d.x, r.d.y, r.d.z)) *
0x1p-32f);
if (u > a) {
// Ignore this hit and trace a new ray.
Ray rNext = si->intr.SpawnRay(r.d);
pstd::optional<ShapeIntersection> siNext =
Intersect(rNext, tMax - si->tHit);
if (siNext)
// The returned t value has to account for both ray segments.
siNext->tHit += si->tHit;
return siNext;
}
}
}
// Initialize _SurfaceInteraction_ after _Shape_ intersection
si->intr.areaLight = areaLight;
si->intr.material = material;
CHECK_GE(Dot(si->intr.n, si->intr.shading.n), 0.);
if (mediumInterface.IsMediumTransition())
si->intr.mediumInterface = &mediumInterface;
else
si->intr.medium = r.medium;
return si;
}

[2] http://www.pbr-book.org/3ed-2018/Shapes/Triangle_Meshes.html#fragment-Testintersectionagainstalphatextureifpresent-0

Window GPU build issues in Pascal cards

Old GPUs with Pascal architecture in windows only support compute capacity < sm_70
then PBRT-V4 build fails with error "CUDA atomics are only supported for sm_60 and up on *nix and sm_70 and up on Windows."

Update src/ext/ptex

The version of ptex in src/ext is currently a few years old; however, updating to the latest version causes the Windows build to break due to something related to pkg-config.

CUDA running error

After successfully compile pbrt v4 with CUDA & Optix, there is running error as below:

$ pbrt.exe --display-server 127.0.0.1:14158 v4_cornellbox_uplight_PT_spp0064_d03.pbrt --spp 1024 --gpu
pbrt version 4 (built Oct 1 2020 at 23:15:32)
Copyright (c)1998-2020 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.
Rendering: [ ] (0.1s|?s) [ 4912.000
20201001.232927 C:/Work/PBRT/pbrt-v4/src/pbrt/gpu/pathintegrator.cpp:313 ] FATAL CUDA error: unspecified launch failure
(unknown ) 0x0000000000000000 - ☺
(unknown ) 0x0000000000000000 - ☺
(unknown ) 0x0000000000000000 - ☺
(unknown ) 0x0000000000000000 - ☺
(unknown ) 0x0000000000000000 - ☺
(unknown ) 0x0000000000000000 - ☺
(unknown ) 0x00007FFFA8991430 - configthreadlocale
(unknown ) 0x00007FFFAAEC6FC0 - BaseThreadInitThunk
(unknown ) 0x00007FFFAB19CEA0 - RtlUserThreadStart

Any idea what is wrong?

It was compiled with these setting:
CMake: 3.17.5
CUDA: 11.0
Optix SDK: 7.1
Nvidia Driver Version: 456.43
Graphics card: NVIDIA GTX 2080 Ti
OS: Windows 10

sigma_a / sigma_s Check Failing with RGBDensity uniformgrid Mediums

Howdy,

I was playing with the uniformgrid mediums using rgb densities and have been occasionally running into a failure during the render. I was able to reproduce the issue with a simple scene.

There error is:
pbrt-v4/src/pbrt/cpu/integrators.cpp:1025
FATAL Check failed: 1 - pAbsorb - pScatter >= -1e-6 with 1 - pAbsorb - pScatter = -0.0011489391, -1e-6 = -0.000001

The example I made is a bit contrived as it has significant increases in density in neighboring voxels of the maxDensityGrid. Its also worth nothing I've only run into this with the RGBDensity, I haven't encountered this with FloatDensity.

Here is an example scene -
max_density.zip
It errors out almost immediately, but here is the debug start command -

Rendering failed at pixel (734, 205) sample 0. Debug with "--debugstart 734,205,0"

Rendered on the CPU with https://github.com/mmp/pbrt-v4/tree/08f863d3786

CMake and compile error

I have some issues with CMake and compile on Ubuntu.
CUDA: v11.1
NVIDIA Driver: GTX2080Ti v455.23.05
CMake: 3.18.3

Due to recent update of CMake, there is an issue of "Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES"
How can I set this?

=====
$ cmake -DPBRT_OPTIX7_PATH=/opt/optix/SDK/ ../../pbrt-v4/

-- The CXX compiler identification is GNU 5.4.0
-- The C compiler identification is GNU 5.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'Release' as none was specified.
-- Found Git: /usr/bin/git (found version "2.7.4")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Configure ILMBASE Version: 2.5.3 Lib API: 25.0.2
CMake Warning (dev) at src/ext/openexr/IlmBase/config/IlmBaseSetup.cmake:56 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the
normal variable 'BUILD_SHARED_LIBS'.
Call Stack (most recent call first):
src/ext/openexr/IlmBase/CMakeLists.txt:35 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for include file ucontext.h
-- Looking for include file ucontext.h - found
-- Performing Test ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
-- Performing Test ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT - Success
-- Looking for include file semaphore.h
-- Looking for include file semaphore.h - found
-- Looking for sem_init in pthread
-- Looking for sem_init in pthread - found
-- Configure OpenEXR Version: 2.5.3 Lib API: 25.0.2
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN - Success
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX - Success
-- clang-format not found.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Unable to find -lprofiler
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - /usr/local/cuda-11.1/bin/nvcc
-- Found CUDA: /usr/local/cuda-11.1 (found version "11.1")
-- Found CUDA: 11.1
-- The CUDA compiler identification is NVIDIA 11.1.74
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda-11.1/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- CUDA Architecture: sm_61
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Success
-- Performing Test HAVE_MMAP
-- Performing Test HAVE_MMAP - Success
-- Performing Test HAS_INTRIN_H
-- Performing Test HAS_INTRIN_H - Failed
-- Performing Test HAVE_DECLSPEC_NOINLINE
-- Performing Test HAVE_DECLSPEC_NOINLINE - Failed
-- Performing Test HAVE_ATTRIBUTE_NOINLINE
-- Performing Test HAVE_ATTRIBUTE_NOINLINE - Success
-- Performing Test HAVE__ALIGNED_MALLOC
-- Performing Test HAVE__ALIGNED_MALLOC - Failed
-- Performing Test HAVE_POSIX_MEMALIGN
-- Performing Test HAVE_POSIX_MEMALIGN - Success
-- Performing Test INT64_IS_OWN_TYPE
-- Performing Test INT64_IS_OWN_TYPE - Failed
-- Configuring done
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.

CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.

CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.

CUDA_ARCHITECTURES is empty for target "optix.cu".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /user/work/pbrt-v4/build

Then if fails to compile.

$ make
Scanning dependencies of target double-conversion
[ 0%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/bignum.cc.o
[ 0%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/bignum-dtoa.cc.o
[ 1%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/cached-powers.cc.o
[ 1%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/double-to-string.cc.o
[ 1%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/fast-dtoa.cc.o
[ 1%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/fixed-dtoa.cc.o
[ 2%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/string-to-double.cc.o
[ 2%] Building CXX object src/ext/double-conversion/CMakeFiles/double-conversion.dir/double-conversion/strtod.cc.o
[ 2%] Linking CXX static library libdouble-conversion.a
[ 2%] Built target double-conversion
Scanning dependencies of target rgb2spec_opt
[ 2%] Building CXX object CMakeFiles/rgb2spec_opt.dir/src/pbrt/cmd/rgb2spec_opt.cpp.o
[ 3%] Linking CXX executable rgb2spec_opt
[ 3%] Built target rgb2spec_opt
Scanning dependencies of target soac
[ 3%] Building CXX object CMakeFiles/soac.dir/src/pbrt/cmd/soac.cpp.o
[ 3%] Linking CXX executable soac
[ 3%] Built target soac
Scanning dependencies of target pbrt_soa_generated
[ 3%] Generating pbrt_soa.h
[ 3%] Generating gpu_workitems_soa.h
[ 3%] Built target pbrt_soa_generated
[ 4%] Generating rgbspectrum_srgb.cpp
Optimizing sRGB spectra...
[ 4%] Generating rgbspectrum_dci_p3.cpp
Optimizing DCI_P3 spectra...
[ 4%] Generating rgbspectrum_rec2020.cpp
Optimizing REC2020 spectra...
[ 4%] Generating rgbspectrum_aces.cpp
Optimizing ACES2065_1 spectra...
Scanning dependencies of target pbrt_lib
[ 4%] Building CXX object CMakeFiles/pbrt_lib.dir/rgbspectrum_srgb.cpp.o
In file included from /user/inyu/work/pbrt-v4/build/rgbspectrum_srgb.cpp:1:0:
/user/inyu/work/pbrt-v4/src/pbrt/pbrt.h:163:52: error: ‘byte’ is not a member of ‘std’
using Allocator = pstd::pmr::polymorphic_allocatorstd::byte;
^
/user/work/pbrt-v4/src/pbrt/pbrt.h:163:52: error: ‘byte’ is not a member of ‘std’
/user/work/pbrt-v4/src/pbrt/pbrt.h:163:61: error: template argument 1 is invalid
using Allocator = pstd::pmr::polymorphic_allocatorstd::byte;
^
CMakeFiles/pbrt_lib.dir/build.make:107: recipe for target 'CMakeFiles/pbrt_lib.dir/rgbspectrum_srgb.cpp.o' failed
make[2]: *** [CMakeFiles/pbrt_lib.dir/rgbspectrum_srgb.cpp.o] Error 1
CMakeFiles/Makefile2:776: recipe for target 'CMakeFiles/pbrt_lib.dir/all' failed
make[1]: *** [CMakeFiles/pbrt_lib.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2

Blue-ish tinge with (1,1,1) RGB spectra

Doughnut scene with sigma_a/sigma_s as RGB 0.99 0.99 0.99
image

And with RGB 1 1 1 (note blue tinge on the ground around it).
image

Anders also noted this blue tinge with RGB reflectances on surfaces

CMake build linkage error

Trying to compile on the IN2P3 environment with cmake-3.18.2 compiled from source, I get linkage errors:

[100%] Linking CXX executable pbrt_test
libpbrt_lib.a(cameras.cpp.o): In function `pbrt::RealisticCamera::RenderExitPupil(float, float, char const*) const':
cameras.cpp:(.text+0x40a3): undefined reference to `pstd::optional<pbrt::Bounds2<int> >::optional()'
cameras.cpp:(.text+0x40cb): undefined reference to `pstd::optional<pbrt::Point2<int> >::optional()'
cameras.cpp:(.text+0x40ef): undefined reference to `pstd::optional<int>::optional()'
cameras.cpp:(.text+0x4134): undefined reference to `pstd::optional<pbrt::RGBColorSpace const*>::optional()'
cameras.cpp:(.text+0x417d): undefined reference to `std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 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> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, 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> > > > > > >::map()'
libpbrt_lib.a(stats.cpp.o): In function `pbrt::StatsAccumulator::WritePixelImages() const':
stats.cpp:(.text+0x1a27): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x1aac): undefined reference to `pstd::optional<pbrt::Bounds2<int> >::optional()'
stats.cpp:(.text+0x1ad0): undefined reference to `pstd::optional<pbrt::Point2<int> >::optional()'
stats.cpp:(.text+0x1af0): undefined reference to `pstd::optional<int>::optional()'
stats.cpp:(.text+0x1b10): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x1b30): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x1b4b): undefined reference to `pstd::optional<pbrt::RGBColorSpace const*>::optional()'
stats.cpp:(.text+0x1f02): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x1f8a): undefined reference to `pstd::optional<pbrt::Bounds2<int> >::optional()'
stats.cpp:(.text+0x1fae): undefined reference to `pstd::optional<pbrt::Point2<int> >::optional()'
stats.cpp:(.text+0x1fce): undefined reference to `pstd::optional<int>::optional()'
stats.cpp:(.text+0x1fee): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x200e): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x2029): undefined reference to `pstd::optional<pbrt::RGBColorSpace const*>::optional()'
stats.cpp:(.text+0x258f): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x2614): undefined reference to `pstd::optional<pbrt::Bounds2<int> >::optional()'
stats.cpp:(.text+0x2638): undefined reference to `pstd::optional<pbrt::Point2<int> >::optional()'
stats.cpp:(.text+0x2658): undefined reference to `pstd::optional<int>::optional()'
stats.cpp:(.text+0x2678): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x2698): undefined reference to `pstd::optional<float>::optional()'
stats.cpp:(.text+0x26b3): undefined reference to `pstd::optional<pbrt::RGBColorSpace const*>::optional()'
collect2: error: ld returned 1 exit status

How to pass the linkage successfully ?

For more details, below is the cmake output:

-- The CXX compiler identification is GNU 7.3.0
-- The C compiler identification is GNU 7.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /pbs/software/centos-7-x86_64/gcc/7.3.0/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /pbs/software/centos-7-x86_64/gcc/7.3.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'Release' as none was specified.
-- Found Git: /usr/bin/git (found version "1.8.3.1") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") 
-- Configure ILMBASE Version: 2.5.3 Lib API: 25.0.2
-- Looking for include file ucontext.h
-- Looking for include file ucontext.h - found
-- Performing Test ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
-- Performing Test ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT - Success
-- Looking for include file semaphore.h
-- Looking for include file semaphore.h - found
-- Looking for sem_init in pthread
-- Looking for sem_init in pthread - found
-- Configure OpenEXR Version: 2.5.3 Lib API: 25.0.2
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN - Success
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX - Success
-- clang-format not found.
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.5") found components: doxygen dot 
-- Unable to find -lprofiler
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- CUDA not found
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Success
-- Performing Test HAVE_MMAP
-- Performing Test HAVE_MMAP - Success
-- Performing Test HAS_INTRIN_H
-- Performing Test HAS_INTRIN_H - Failed
-- Performing Test HAVE_DECLSPEC_NOINLINE
-- Performing Test HAVE_DECLSPEC_NOINLINE - Failed
-- Performing Test HAVE_ATTRIBUTE_NOINLINE
-- Performing Test HAVE_ATTRIBUTE_NOINLINE - Success
-- Performing Test HAVE__ALIGNED_MALLOC
-- Performing Test HAVE__ALIGNED_MALLOC - Failed
-- Performing Test HAVE_POSIX_MEMALIGN
-- Performing Test HAVE_POSIX_MEMALIGN - Success
-- Performing Test INT64_IS_OWN_TYPE
-- Performing Test INT64_IS_OWN_TYPE - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: <...>/pbrt-v4/build

Invalid PTX input on RTX 2080 Ti on Windows

Trying to run the latest version of pbrt is failing when creating the OptiX modules from PTX, due to "Invalid PTX input"; the full reported error can be found further down.

I am a bit surprised by the

ptx2llvm-module-001, line 9; warning : Unsupported .version 7.1; current version is '6.4'

given that OptiX 7.2.0 does support CUDA 11.1, and the driver used (456.80) is higher than the minimum requested by OptiX 7.2.0 (456.71).

PBRT version: 703953d + the commit from #68.
OS: Windows 10 Pro, version 2004, build 19041.572
GPU: NVIDIA GeForce RTX 2080 Ti
NVIDIA driver version: 456.80
Visual Studio: 2019, 16.7.6
CUDA: 11.1; same issue when trying with 11.0
OptiX: 7.2.0
Using the Visual Studio built-in CMake support

[ 2948.000 20201022.233225 D:/Softwares/pbrt-v4/src/pbrt/gpu/accel.cpp:618 ] FATAL OptiX call optixModuleCreateFromPTX(optixContext, &moduleCompileOptions, &pipelineCompileOptions, ptxCode.c_str(), ptxCode.size(), log, &logSize, &optixModule) failed with code 7200: "Invalid PTX input"
COMPILE ERROR: Invalid PTX input: ptx2llvm-module-001: error: Failed to translate PTX input to LLVM
ptx2llvm-module-001, line 9; warning : Unsupported .version 7.1; current version is '6.4'
Call parameter type does not match function signature!
  %94 = load [8 x i8]* %param5, !dbg !2003
 [0 x i8]  %95 = call i32 %88(i32 %89, i64 %90, i32 %91, i64 %92, i64 %93, [8 x i8] %94), !dbg !2003
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Call parameter type does not match function signature!
  %45 = load [8 x i8]* %param5, !dbg !2001
 [0 x i8]  %46 = call i32 %39(i32 %40, i64 %41, i32 %42, i64 %43, i64 %44, [8 x i8] %45), !dbg !2001
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Call parameter type does not match function signature!
  %45 = load [8 x i8]* %param5, !dbg !2001
 [0 x i8]  %46 = call i32 %39(i32 %40, i64 %41, i32 %42, i64 %43, i64 %44, [8 x i8] %45), !dbg !2001
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, co
(D:\Softwares\pbrt-v4\src\pbrt\util\check.cpp)  0x00007FF744389330 - pbrt::PrintStackTrace + line 120
(D:\Softwares\pbrt-v4\src\pbrt\util\check.cpp)  0x00007FF7443896F0 - pbrt::CheckCallbackScope::Fail + line 148
(D:\Softwares\pbrt-v4\src\pbrt\util\log.cpp)    0x00007FF743EDACD0 - pbrt::LogFatal + line 177
(D:\Softwares\pbrt-v4\src\pbrt\util\log.h)      0x00007FF743E91A60 - pbrt::LogFatal<int,char const *,char (&)[4096]> + line 112
(D:\Softwares\pbrt-v4\src\pbrt\gpu\accel.cpp)   0x00007FF74447F750 - pbrt::GPUAccel::GPUAccel + line 616
(D:\Softwares\pbrt-v4\src\pbrt\gpu\pathintegrator.cpp)  0x00007FF743F95D50 - pbrt::GPUPathIntegrator::GPUPathIntegrator + line 159
(D:\Softwares\pbrt-v4\src\pbrt\gpu\pathintegrator.cpp)  0x00007FF743F957A0 - pbrt::GPURender + line 570
(D:\Softwares\pbrt-v4\src\pbrt\cmd\pbrt.cpp)    0x00007FF743E8FA70 - main + line 237
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl)      0x00007FF7448701E0 - invoke_main + line 79
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl)      0x00007FF74486FF90 - __scrt_common_main_seh + line 288
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl)      0x00007FF74486FF70 - __scrt_common_main + line 331
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp) 0x00007FF7448702A0 - mainCRTStartup + line 17
(unknown                                 )      0x00007FFD3D377020 - BaseThreadInitThunk
(unknown                                 )      0x00007FFD3E2BCEA0 - RtlUserThreadStart

Compile issue on Ubuntu 20.4 and Windows 10 with RTX3090, cuda 11.1 and Optix 7.1

I've just upgraded to an RTX 3090. This required updating to CUDA 11.1 so nvcc would recognize sm86. I'm now getting a build failure under both Ubuntu and Windows 10.

Ubuntu Cmake:
cmake -S . -B ./build -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -D PBRT_OPTIX7_PATH=/home/goodin/NVIDIA-OptiX-SDK-7.1.0-linux64-x86_64/

Windows Cmake:
$ cmake -S . -B ./build -D CUDA_TOOLKIT_ROOT_DIR="c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1" -D PBRT_OPTIX7_PATH="c:/ProgramData/NVIDIA Corporation/Optix SDK 7.1.0"

Ubuntu compile error:
[ 21%] Built target pbrt_lib
make[2]: *** No rule to make target 'CMakeFiles/optix.cu.dir/src/pbrt/gpu/optix.ptx', needed by 'src/pbrt/gpu/optix.cu.ptx_embedded.c'. Stop.
make[1]: *** [CMakeFiles/Makefile2:802: CMakeFiles/pbrt_embedded_ptx_lib.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Windows compile error (a whole bunch of these errors):
2>C:\cygwin64\home\goodin\pbrt-v4\build>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe" -gencode=arch=compute_86,code="sm_86,compute_86" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -I"C:\cygwin64\home\goodin\pbrt-v4\src" -I"C:\cygwin64\home\goodin\pbrt-v4\build" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openvdb\nanovdb" -I"C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.1.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" --keep-dir x64\Release -maxrregcount=128 --machine 64 -ptx -cudart static -Xcudafe --diag_suppress=partial_override -Xcudafe --diag_suppress=virtual_function_decl_hidden -Xcudafe --diag_suppress=integer_sign_change -Xcudafe --diag_suppress=declared_but_not_referenced -Xcudafe --diag_suppress=implicit_return_from_non_void_function --expt-relaxed-constexpr --extended-lambda -Xnvlink -suppress-stack-size-warning --std=c++17 -lineinfo -O3 -Xcudafe=--display_error_number -Xcudafe=--diag_suppress=3089 --define-macro=NDEBUG --define-macro=PBRT_IS_MSVC --define-macro=PBRT_IS_WINDOWS --define-macro=NOMINMAX --define-macro=PBRT_BUILD_GPU_RENDERER --define-macro=NVTX --define-macro=PBRT_HAS_INTRIN_H --define-macro=PBRT_NOINLINE=__declspec(noinline) --define-macro=PBRT_HAVE__ALIGNED_MALLOC -Xcompiler="/EHsc -Ob2" -o optix.cu.dir\Release\optix.ptx "C:\cygwin64\home\goodin\pbrt-v4\src\pbrt\gpu\optix.cu"

4>C:\cygwin64\home\goodin\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfBoxAttribute.cpp(53,17): error C2491: 'Imf_2_5::TypedAttribute<Imath_2_5::Box2i>::staticTypeName': definition of dllimport function not allowed

Attribute directive usage

A Question:

As far as I can tell, being able to specify Material overrides on Shapes is no longer supported.
If this is correct, how come? Due to GPU implementation? Simplification of code? (I'm not advocating for the return of this functionality I'm simply curious.)

Background:

In pbrt-v3 you could do something along the lines of -

# From https://www.pbrt.org/fileformat-v3.html#materials
Material "matte" "rgb Kd" [ 1 0 0 ]
Shape "sphere" "float radius" [ .5 ] "rgb Kd" [ 0 1 0 ]  

In pbrt-v4 this results in a unused parameter error.

A Follow-up:

Assuming this functionality is no longer supported, then the following code in parsedscene.cpp should probably be changed.

https://github.com/mmp/pbrt-v4/blob/08f863d3/src/pbrt/parsedscene.cpp#L1776

void FormattingScene::Shape(
        ...
        dict.RenameParameter("Kd", "reflectance");

Which renames the "Kd" parameter found on Shapes to "reflectance". This would still result in an error in pbrt-v4, so it should probably be replaced with a dict.RemoveTexture("Kd"). Or perhaps more appropriate a straight up error instructing the user to update their scenes.

Windows build improvements

There are a number of ways the Windows build could be improved:

  • Parallel builds would be nice
  • The organization of the source files in the MSVC project browser could be improved. (Among other things, the headers don't seem to appearing even though there's a source_group directive that should be putting them there.)
  • There are a fair number of warnings in the build, especially from OpenEXR. It would be nice to fix and or suppress those...

Windows 10/CUDA 11.1 fails to compile

Here is the error I'm seeing. I'm building master from 10/12 am.
24>Compiling CUDA source file ..\src\pbrt\gpu\optix.cu...
11>Generating Code...
24>
24>C:\cygwin64\home\goodin\pbrt-v4\build>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe" -gencode=arch=compute_86,code="sm_86,compute_86" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -I"c:\ProgramData\NVIDIA Corporation\Optix SDK 7.1.0\include" -I"C:\cygwin64\home\goodin\pbrt-v4\src" -I"C:\cygwin64\home\goodin\pbrt-v4\build" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openvdb\nanovdb" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" --keep-dir x64\Release -maxrregcount=128 --machine 64 -ptx -cudart static -Xcudafe --diag_suppress=partial_override -Xcudafe --diag_suppress=virtual_function_decl_hidden -Xcudafe --diag_suppress=integer_sign_change -Xcudafe --diag_suppress=declared_but_not_referenced -Xcudafe --diag_suppress=implicit_return_from_non_void_function --expt-relaxed-constexpr --extended-lambda -Xnvlink -suppress-stack-size-warning --std=c++17 -lineinfo -Xcudafe=--display_error_number -Xcudafe=--diag_suppress=3089 -Xcompiler="/EHsc -Ob2" -o optix.cu.dir\Release\optix.ptx "C:\cygwin64\home\goodin\pbrt-v4\src\pbrt\gpu\optix.cu"
24>C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/util/float.h(400): error #3182: identifier "__float2half" is undefined
24>
24>C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/util/float.h(400): error #3182: identifier "__half_as_ushort" is undefined
24>
24>C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/util/float.h(453): error #3182: identifier "__ushort_as_half" is undefined
24>
7>C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/options.h(58): error #3182: identifier "OptionsGPU" is undefined
7>
7>C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/shapes.h(1170): error #3182: identifier "allTriangleMeshesGPU" is undefined
7>
7>C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/shapes.h(1481): error #3182: identifier "allBilinearMeshesGPU" is undefined
7>
7>8 errors detected in the compilation of "C:/cygwin64/home/goodin/pbrt-v4/src/pbrt/gpu/optix.cu".
7>optix.cu
7>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.1.targets(785,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe" -gencode=arch=compute_86,code="sm_86,compute_86" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -I"c:\ProgramData\NVIDIA Corporation\Optix SDK 7.1.0\include" -I"C:\cygwin64\home\goodin\pbrt-v4\src" -I"C:\cygwin64\home\goodin\pbrt-v4\build" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openvdb\nanovdb" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" --keep-dir x64\Release -maxrregcount=128 --machine 64 -ptx -cudart static -Xcudafe --diag_suppress=partial_override -Xcudafe --diag_suppress=virtual_function_decl_hidden -Xcudafe --diag_suppress=integer_sign_change -Xcudafe --diag_suppress=declared_but_not_referenced -Xcudafe --diag_suppress=implicit_return_from_non_void_function --expt-relaxed-constexpr --extended-lambda -Xnvlink -suppress-stack-size-warning --std=c++17 -lineinfo -Xcudafe=--display_error_number -Xcudafe=--diag_suppress=3089 -Xcompiler="/EHsc -Ob2" -o optix.cu.dir\Release\optix.ptx "C:\cygwin64\home\goodin\pbrt-v4\src\pbrt\gpu\optix.cu"" exited with code 1.
7>Done building project "optix.cu.vcxproj" -- FAILED.

The build is looking for build/optix.cu.dir/Release/optix.ptx which isn't found.

Issues with CMake(3.18.3) wit Visual Studio 2017 on Windows 10

I had no issue with PBRT v3 to compile but I've got some errors with PBRT v4.

I've cleanly installed CMake(3.18.3) and Visual Studio Community 2017 on Windows 10.
Then I cloned the project files 'git clone --recursive https://github.com/mmp/pbrt-v4.git' in shell.

Somehow, there are a few errors in CMake-gui step as follow:
`
$ cmake ../../pbrt-v4/
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19041.
-- The CXX compiler identification is MSVC 19.16.27043.0
-- The C compiler identification is MSVC 19.16.27043.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.28.0.windows.1")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Configure ILMBASE Version: 2.5.3 Lib API: 25.0.2
CMake Warning (dev) at src/ext/openexr/IlmBase/config/IlmBaseSetup.cmake:56 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the
normal variable 'BUILD_SHARED_LIBS'.
Call Stack (most recent call first):
src/ext/openexr/IlmBase/CMakeLists.txt:35 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for include file ucontext.h
-- Looking for include file ucontext.h - not found
-- WARNING pkg-config generation disabled
-- Configure OpenEXR Version: 2.5.3 Lib API: 25.0.2
-- Found ZLIB: zlibstatic
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN - Failed
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX - Failed
-- clang-format not found.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Unable to find -lprofiler
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- CUDA not found
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Failed
-- Performing Test HAVE_MMAP
-- Performing Test HAVE_MMAP - Failed
-- Performing Test HAS_INTRIN_H
-- Performing Test HAS_INTRIN_H - Success
-- Performing Test HAVE_DECLSPEC_NOINLINE
-- Performing Test HAVE_DECLSPEC_NOINLINE - Success
-- Performing Test HAVE_ATTRIBUTE_NOINLINE
-- Performing Test HAVE_ATTRIBUTE_NOINLINE - Failed
-- Performing Test HAVE__ALIGNED_MALLOC
-- Performing Test HAVE__ALIGNED_MALLOC - Success
-- Performing Test HAVE_POSIX_MEMALIGN
-- Performing Test HAVE_POSIX_MEMALIGN - Failed
-- Performing Test INT64_IS_OWN_TYPE
-- Performing Test INT64_IS_OWN_TYPE - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: C:/project/pbrt-v4/build
`

Then VS 2017 can build some projects only.

`
7>C:\project\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfBoxAttribute.cpp(56): error C2491: 'Imf_2_5::TypedAttribute<Imath_2_5::Box2i>::staticTypeName': definition of dllimport function not allowed
7>C:\project\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfBoxAttribute.cpp(67): error C2491: 'Imf_2_5::TypedAttribute<Imath_2_5::Box2i>::writeValueTo': definition of dllimport function not allowed

7>ImfChannelListAttribute.cpp
7>C:\project\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfChannelListAttribute.cpp(70): error C2491: 'Imf_2_5::TypedAttribute<Imf_2_5::ChannelList>::staticTypeName': definition of dllimport function not allowed
7>C:\project\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfChannelListAttribute.cpp(104): error C2491: 'Imf_2_5::TypedAttribute<Imf_2_5::ChannelList>::writeValueTo': definition of dllimport function not allowed

7>ImfOpaqueAttribute.cpp
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(295): error C2977: 'pbrt::Vector3<pbrt::Intervalpbrt::Float>': too many template arguments
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(519): note: see declaration of 'pbrt::Vector3<pbrt::Intervalpbrt::Float>'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(492): note: see reference to class template instantiation 'pbrt::Tuple3<pbrt::Vector3<pbrt::Intervalpbrt::Float>,T>' being compiled
8> with
8> [
8> T=pbrt::Intervalpbrt::Float
8> ]

8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(519): note: see reference to class template instantiation 'pbrt::Vector3<pbrt::Intervalpbrt::Float>' being compiled
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(295): error C2977: 'pbrt::Vector3<pbrt::Intervalpbrt::Float>': too many template arguments
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(519): note: see declaration of 'pbrt::Vector3<pbrt::Intervalpbrt::Float>'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(324): error C2977: 'pbrt::Vector3<pbrt::Intervalpbrt::Float>': too many template arguments
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(519): note: see declaration of 'pbrt::Vector3<pbrt::Intervalpbrt::Float>'

8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(295): error C2977: 'pbrt::Vector3pbrt::Float': too many template arguments
8>C:\project\pbrt-v4\src\pbrt/pbrt.h(106): note: see declaration of 'pbrt::Vector3pbrt::Float'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(324): error C2977: 'pbrt::Vector3pbrt::Float': too many template arguments
8>C:\project\pbrt-v4\src\pbrt/pbrt.h(106): note: see declaration of 'pbrt::Vector3pbrt::Float'

8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(492): error C3210: 'Tuple3<pbrt::Vector3,float>': a member using-declaration can only be applied to a base class member
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(493): error C3210: 'Tuple3<pbrt::Vector3,float>': a member using-declaration can only be applied to a base class member
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(494): error C3210: 'Tuple3<pbrt::Vector3,float>': a member using-declaration can only be applied to a base class member
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(555): error C2326: 'pbrt::Vector3f pbrt::Vector3fi::Error(void) const': function cannot access 'pbrt::Vector3fi::x'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(555): error C2326: 'pbrt::Vector3f pbrt::Vector3fi::Error(void) const': function cannot access 'pbrt::Vector3fi::y'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(555): error C2326: 'pbrt::Vector3f pbrt::Vector3fi::Error(void) const': function cannot access 'pbrt::Vector3fi::z'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(557): error C2326: 'bool pbrt::Vector3fi::IsExact(void) const': function cannot access 'pbrt::Vector3fi::x'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(557): error C2326: 'bool pbrt::Vector3fi::IsExact(void) const': function cannot access 'pbrt::Vector3fi::y'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(557): error C2326: 'bool pbrt::Vector3fi::IsExact(void) const': function cannot access 'pbrt::Vector3fi::z'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(295): error C2977: 'pbrt::Point3pbrt::FloatInterval': too many template arguments
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(703): note: see declaration of 'pbrt::Point3pbrt::FloatInterval'
8>C:\project\pbrt-v4\src\pbrt/util/vecmath.h(630): note: see reference to class template instantiation 'pbrt::Tuple3<pbrt::Point3pbrt::FloatInterval,T>' being compiled
...
=== Build: 26 succeeded, 8 failed, 0 up-to-date, 6 skipped ===
`

I've tried to compile on another machine with the same setting but had the same issues.

Could you guide me on how to resolve this issue?

Volume blue halo with "White" RGB vs constant SPECTRUM.

Hello and thanks for sharing this new version of pbrt; I am very happy to discover the new features, especially the participating media ones!

When rendering a volumetric scene with "white" RGB values instead of a constant spectrum such as in the bunny-cloud, a blue halo is produced.

The provided "spectrum sigma_s" [200 10 900 10] "spectrum sigma_a" [200 .5 900 .5]:
bunny-cloud-spectrum
Versus "rgb sigma_s" [10 10 10] "rgb sigma_a" [.5 .5 .5]:
bunny-cloud-rgb

Is it the expected behavior, knowing that the automatic converter between pbrt-v3 and pbrt-v4 scenes keeps the RGB values, even when it is "white" ?

windows VS2017 camke error

when I use cmake to generate project with vs2017, I get one error . It shows that src/pbrt/util/shuffle.h can not find.(517 line in the CMakeLists.txt) I can not find it also . So I delete this line in the CMakeLists.txt. The I generate the VS project .
But when I compile the pbrt_lib , I get a lot of errors like that:

E:\pbrt\pbrt-v4\src\pbrt/util/vecmath.h(295) error C2977: “pbrt::Vector3<pbrt::Intervalpbrt::Float>” : too many template arguments
E:\pbrt\pbrt-v4\src\pbrt/util/vecmath.h(519): see declaration of 'pbrt::Vector3<pbrt::Intervalpbrt::Float>'
So where is wrong?

Bilinear Mesh AreaLight Artifacts

Hello,

When using a bilinear mesh as a area light source I'm seeing some artifacts on the back side of the light. (When rendering single sided)

Here is an example of the back side of the light-
back_side

And here is the front side of the light-
lit_side

Simple scene to reproduce:

Film "rgb" 
    "integer xresolution" [ 800 ]
    "integer yresolution" [ 600 ]
    "string filename" [ "simple.exr" ]

PixelFilter "gaussian" 
    "float yradius" [ 2 ]
    "float xradius" [ 2 ]

Sampler "pmj02bn"
    "integer pixelsamples" [ 16 ]

Integrator "volpath"
    "integer maxdepth" [ 5 ]

Accelerator "bvh"

LookAt  0 20 -50
        0 5 0
        0 1 0

Camera "perspective"
        "float fov" [ 45 ]
        "float screenwindow" [ -1 1 -0.75 0.75 ]

WorldBegin

AttributeBegin
    AreaLightSource "diffuse"
        "float scale" [ 10 ]
        "bool twosided" [ false ]
    Translate 0 10 0
    Scale 5 5 1
    # Uncomment to see lit side of mesh
    # Rotate 180 0 1 0
    Shape "bilinearmesh" "point3 P" [ -1 -1 0
                                     1 -1 0
                                     -1 1 0
                                     1 1 0 ]
AttributeEnd

MakeNamedMaterial "matte" "string type" "diffuse"
    "rgb reflectance" [ 0.5 0.5 0.5 ]

# Ground
AttributeBegin
    NamedMaterial "matte"
    Rotate 90 1 0 0 
    Shape "disk" "float radius" [ 100 ]
AttributeEnd

Area Light Samples and UV Coords

Howdy,

I suspect this might be more of a TODO than a bug, but figured I should create an issue for any other intrepid early access users.

Summary

Currently only the (0,0) uv is used when looking up textures for Area Light samples. As an example, if your light has a texture applied, the texture could be all blue, except for the (0,0) pixel, which is red. When the texture is sampled, only the red pixel will be looked up resulting in a interesting rendering like -

uv_light

Details

When an AreaLight generates a light sample it requests a ShapeSample from the shape

pbrt-v4/src/pbrt/lights.h

Lines 523 to 525 in 33308ca

// Sample point on shape for _DiffuseAreaLight_
ShapeSampleContext shapeCtx(ctx.pi, ctx.n, ctx.ns, 0 /* time */);
pstd::optional<ShapeSample> ss = shape.Sample(shapeCtx, u);

And then later the Area Light uses the Interaction defined by the ShapeSample to fetch the uv coords.

SampledSpectrum Le = L(ss->intr.p(), ss->intr.n, ss->intr.uv, -wi, lambda);

However currently, all the ShapeSamples returned do not provide uv coordinates as is the case here with the sphere shape.

pbrt-v4/src/pbrt/shapes.h

Lines 359 to 360 in 33308ca

return ShapeSample{Interaction(Point3fi(p, pError), n, ctx.time),
1 / (2 * Pi * oneMinusCosThetaMax)};

Sample

Attached is the pbrt scene file and texture used to render the above.
issue_60.zip

Low GPU usage on Windows

With a RelWithDebInfo build on Windows, on 76a017c, rendering killeroos/killerroo-gold.pbrt on a RTX 2080 Ti took 7359 s and seemed to have an average GPU usage of 0.2%.

GPU Kernel Profile:
  Generate Camera rays                               1024 launches 580020.12 ms /  14.3% (avg 566.426, min 552.880, max 582.265)
  Generate ray samples - HaltonSampler               6144 launches 275843.19 ms /   6.8% (avg 44.896, min  1.077, max 104.482)
  Tracing closest hit rays                           6144 launches 1462553.50 ms /  36.1% (avg 238.046, min 44.757, max 854.856)
  Handle emitters hit by indirect rays               6144 launches  10279.09 ms /   0.3% (avg  1.673, min  0.467, max   2.482)
  ConductorMaterial + BxDF Eval (Basic tex)          5120 launches 301322.56 ms /   7.4% (avg 58.852, min  3.459, max 289.970)
  DiffuseMaterial + BxDF Eval (Basic tex)            5120 launches 1043981.38 ms /  25.8% (avg 203.903, min  3.911, max 630.421)
  Tracing shadow rays                                5120 launches 322700.69 ms /   8.0% (avg 63.027, min 44.073, max 629.823)
  Incorporate shadow ray contribution                5120 launches  13550.32 ms /   0.3% (avg  2.647, min  0.717, max   7.218)
  Update Film                                        1024 launches  34900.98 ms /   0.9% (avg 34.083, min 29.945, max  43.864)
  Other                                             23552 launches   5310.65 ms /   0.1% (avg  0.225)

Total GPU time: 4050462.25 ms

GPU Statistics:
    Camera rays                                                 718626816
    Indirect rays, depth 1                                      718039417
    Indirect rays, depth 2                                      411877673
    Indirect rays, depth 3                                       24306355
    Indirect rays, depth 4                                        7197276
    Indirect rays, depth 5                                        2514007
    Shadow rays, depth 0                                        359206412
    Shadow rays, depth 1                                        195456010
    Shadow rays, depth 2                                        107390074
    Shadow rays, depth 3                                          6470485
    Shadow rays, depth 4                                          2033699

Statistics:
  Geometry
    Disks                                                               2
    Buffer cache hits                                    4 /           12 (33.33%)
    TransformCache hits                                  4 /           10 (40.00%)
    Triangles per mesh                              532230 /            4 (133057.50x)
  Memory
    Acceleration structures                                         14.80 MiB
    Film pixels                                                     96.38 MiB
    GPU path integrator pixel state                                  1.02 GiB
    ImageTextures                                                    4.00 MiB
    Light BVH                                                        0.09 kB
    Redundant vertex and index buffers                               0.11 kB
    TransformCache                                                   0.75 kB
    Triangles                                                        0.25 kB
  Scene
    AreaLights                                                          1
    Lights                                                              2
    Materials                                                           5
    Textures                                                            2

Compile issues with Visual Studio 2019

I apologize in advance as I'm new to Windows and CMake. I'm getting two classes of compile errors. The first is nvcc.

Here's my command line:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_70,code="sm_70,compute_70" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64" -x cu -rdc=true -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.1.0\include" -I"C:\cygwin64\home\goodin\pbrt-v4\src" -I"C:\cygwin64\home\goodin\pbrt-v4\build" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\stb" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openexr\IlmBase\Imath" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openexr\IlmBase\Half" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openexr\IlmBase\Iex" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf" -I"C:\cygwin64\home\goodin\pbrt-v4\build\src\ext\openexr\IlmBase\config" -I"C:\cygwin64\home\goodin\pbrt-v4\build\src\ext\openexr\OpenEXR\config" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\zlib" -I"C:\cygwin64\home\goodin\pbrt-v4\build\src\ext\zlib" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\filesystem" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\ptex\src\ptex" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\double-conversion" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcudafe --diag_suppress=partial_override -Xcudafe --diag_suppress=virtual_function_decl_hidden -Xcudafe --diag_suppress=integer_sign_change -Xcudafe --diag_suppress=declared_but_not_referenced -Xcudafe --diag_suppress=implicit_return_from_non_void_function --expt-relaxed-constexpr --extended-lambda -Xnvlink -suppress-stack-size-warning --std=c++17 /wd4305 /wd4244 /wd4843 /wd4267 /wd4838 /wd26495 /wd26451 -Xcompiler="/EHsc -Zi -Ob0" -g -use_fast_math -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DPBRT_IS_MSVC -DPBRT_BUILD_GPU_RENDERER -DNVTX -DPBRT_HAS_INTRIN_H -DPBRT_IS_WINDOWS -DNOMINMAX -D"PBRT_NOINLINE=__declspec(noinline)" -DPBRT_HAVE__ALIGNED_MALLOC -DPTEX_STATIC -D"CMAKE_INTDIR="Debug"" -DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DPBRT_IS_MSVC -DPBRT_BUILD_GPU_RENDERER -DNVTX -DPBRT_HAS_INTRIN_H -DPBRT_IS_WINDOWS -DNOMINMAX -D"PBRT_NOINLINE=__declspec(noinline)" -DPBRT_HAVE__ALIGNED_MALLOC -DPTEX_STATIC -D"CMAKE_INTDIR="Debug"" -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdpbrt_lib.dir\Debug\pbrt_lib.pdb /FS /Zi /RTC1 /MDd /GR" -o pbrt_lib.dir\Debug\cameras.obj "C:\cygwin64\home\goodin\pbrt-v4\src\pbrt\cameras.cpp"

I'm getting the following error:

nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

When I run the command standalone it still fails. When I remove the output file it thinks the "/wd4305" is a file.

The second is an error:
C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/util/image.h(317): warning #3059-D: calling a host function from a host device function is not allowed
C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/textures.h(682): error #349: no operator "=" matches these operands
operand types are: pbrt::RGB = COLORREF
C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/textures.h(685): error #349: no operator "=" matches these operands
operand types are: pbrt::RGB = float
C:/cygwin64/home/goodin/pbrt-v4/src\pbrt/util/spectrum.cpp(268): error #42: operand types are incompatible ("pbrt::RGB" and "COLORREF")

Float/Spectrum eta parameter conflict in Dielectric and ThinDielectric

There is currently a bit of a conflict when using a spectrum texture for eta with the Dielectric or ThinDielectric Materials.

Take the following snippet as an example:

Texture "texture_checkerboard1" "spectrum" "checkerboard"
MakeNamedMaterial "material_dieletric1" "string type" "dielectric" "texture eta" [ "texture_checkerboard1" ]

When rendering you'll encounter the following error -
Couldn't find float texture named "texture_checkerboard1" for parameter "eta"

Currently the two materials in question should support eta as either a float or spectrum texture according to

FloatTextureHandle etaF = parameters.GetFloatTextureOrNull("eta", alloc);
SpectrumTextureHandle etaS =
parameters.GetSpectrumTextureOrNull("eta", SpectrumType::General, alloc);

However, the GetFloatTextureOrNull method has the following -

auto iter = textures->floatTextureMap.find(p->strings[0]);
if (iter != textures->floatTextureMap.end())
return iter->second;
ErrorExit(&p->loc,
R"(Couldn't find float texture named "%s" for parameter "%s")",
p->strings[0], p->name);

As currently written, since a texture has been specified but is not found in textures->floatTextureMap an ErrorExit is called despite the texture existing within textures->spectrumGeneralTextureMap

I suppose an easy fix would be to just rename spectrum eta to spectrum eta_s. Otherwise some plumbing is required.

AO issue

PBRT v4 AO results are very different from v3.

Compiling instructions for multiple installed CUDA versions on (Ubuntu) Linux

Dear All,

Not sure whether it is worth to be mentioned in the compiling instructions/README or not, for the GPU-enabled build on Linux systems with multiple installed CUDA versions, you need to modify the PATH environment variable to contain the v11 binaries first, e.g.:

export PATH=/usr/local/cuda/bin:$PATH

Otherwise compiling will fail even after manual change of all corresponding CUDA-related CMake variables (including erroneous and lengthy CMake hacking/debugging).

In my case, there are two installed versions on Ubuntu 20.04:

Regards,
Oleg

"coateddiffuse" material too dark when rendered with path integrator.

The attached test case seems to indicate bug in either the layered bxdf or in its handling in integrators...

Summary:

  • Both the lightpath integrator or the simplepath integrator (w/o light or BSDF sampling) give consistent results, an image with an average pixel value around 0.085. Since those only use BSDF evaluation (no sampling or PDF), let's assume that is correct.
  • With the path or volpath integrator, the image comes out too dark--an average pixel value around 0.045.
  • The issue seems specific to the layered bxdf, since if the "coateddiffuse" material is replaced with a diffuse material or a conductor, all of the integrators agree.
  • It doesn't seem related to noise in the stochastic PDF: increasing "nsamples" for "coateddiffuse" doesn't make a difference

...and that's as far as I've gotten

s.pbrt.txt

CUDA Runtime error

Environment: Windows10+2xRTX2080TI+CUDA 11.0+Optix 7.1
Testing scene: Each scene of pbrt-v4-scenes
Error Message:

20200921.130209 D:/work/pbrt-v4/src/pbrt/gpu/accel.cpp:1054 ] FATAL CUDA error: unspecified launch failure
0x00007FF6D0BA4160 - pbrt::PrintStackTrace + line 120
(D:\work\pbrt-v4\src\pbrt\util\check.cpp )      0x00007FF6D0BA4520 - pbrt::CheckCallbackScope::Fail + line 148
(D:\work\pbrt-v4\src\pbrt\util\log.cpp   )      0x00007FF6D07555D0 - pbrt::LogFatal + line 177
(D:\work\pbrt-v4\src\pbrt\util\log.h     )      0x00007FF6D07348B0 - pbrt::LogFatal<char const *> + line 112
(D:\work\pbrt-v4\src\pbrt\gpu\accel.cpp  )      0x00007FF6D0C99080 - pbrt::GPUAccel::getParamBuffer + line 1056
(D:\work\pbrt-v4\src\pbrt\gpu\accel.cpp  )      0x00007FF6D0C962C0 - pbrt::GPUAccel::IntersectShadowTr + line 1153
(D:\work\pbrt-v4\src\pbrt\gpu\pathintegrator.cpp)       0x00007FF6D0816D80 - pbrt::GPUPathIntegrator::TraceShadowRays + line 247
(D:\work\pbrt-v4\src\pbrt\gpu\pathintegrator.cpp)       0x00007FF6D0815E50 - pbrt::GPUPathIntegrator::Render + line 437
(D:\work\pbrt-v4\src\pbrt\gpu\pathintegrator.cpp)       0x00007FF6D0813DA0 - pbrt::GPURender + line 620
(D:\work\pbrt-v4\src\pbrt\cmd\pbrt.cpp   )      0x00007FF6D0719F40 - main + line 239
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl)       0x00007FF6D1089C90 - invoke_main + line 79
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl)       0x00007FF6D1089A40 - __scrt_common_main_seh + line 288
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl)       0x00007FF6D1089A20 - __scrt_common_main + line 331
(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp) 0x00007FF6D1089D50 - mainCRTStartup + line 17
(unknown                                 )      0x00007FF8173E7BC0 - BaseThreadInitThunk
(unknown                                 )      0x00007FF81818CEB0 - RtlUserThreadStart

GBufferFilm

Sorry, perhaps, it is not the right place to ask but there is no place to ask.

There is a new feature ("A new GBufferFilm that provides position, normal, albedo, etc., at each pixel is now available.") which I'd like to test for denoising. But pbrt4 returns "Unknown directive: GBufferFilm".

Could you give me a simple example of how to output position, normal, albedo?

Thanks,

Switch to mainline OpenEXR

We're currently using a hacked version of OpenEXR with an install() commented out in OpenExr/config/LibraryDefine.cmake:
mmp/openexr@5cfb5da

Without this, the Windows build fails due to OpenEXR being unhappy that zlibstatic isn't exported. At that point I'm stumped, since the only reference to zlib in the OpenEXR cmake files is to ZLIB::ZLIB.

Only one GPU usable on multi-GPU system

When attempting to use the second GPU on a multi-GPU system with current git version (f6c0495), I get:

moyix@isabella:~/git/pbrt-v4-scenes/barcelona-pavilion$ ~/git/pbrt-v4/build/pbrt --gpu --gpu-device 1 pavilion-night.pbrt 
pbrt version 4 (built Oct 16 2020 at 19:02:18)
Copyright (c)1998-2020 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.
[ 181564.000 20201016.194016 /home/moyix/git/pbrt-v4/src/pbrt/textures.cpp:1141 ] FATAL CUDA error: operation not supported
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b29632a - pbrt::PrintStackTrace() + 0x3a
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b2965a6 - pbrt::CheckCallbackScope::Fail() + 0x26
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b2f9648 - pbrt::LogFatal(pbrt::LogLevel, char const*, int, char const*) + 0xe8
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b245a6c - void pbrt::LogFatal<char const*>(pbrt::LogLevel, char const*, int, char const*, char const*&&) + 0x5c
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b278140 - pbrt::GPUFloatImageTexture::Create(pbrt::Transform const&, pbrt::TextureParameterDictionary const&, pbrt::FileLoc const*, pstd::pmr::polymorphic_allocator<std::byte>) + 0x1170
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b27849b - pbrt::FloatTextureHandle::Create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pbrt::Transform const&, pbrt::TextureParameterDictionary const&, pbrt::FileLoc const*, pstd::pmr::polymorphic_allocator<std::byte>, bool) + 0x1fb
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b1d5e22 - pbrt::ParsedScene::CreateTextures(pstd::pmr::polymorphic_allocator<std::byte>, bool) const + 0x932
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b5d56c0 - pbrt::GPUAccel::GPUAccel(pbrt::ParsedScene const&, pstd::pmr::polymorphic_allocator<std::byte>, CUstream_st*, std::map<int, pstd::vector<pbrt::LightHandle, pstd::pmr::polymorphic_allocator<pbrt::LightHandle> >*, std::less<int>, std::allocator<std::pair<int const, pstd::vector<pbrt::LightHandle, pstd::pmr::polymorphic_allocator<pbrt::LightHandle> >*> > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, pbrt::MediumHandle, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, pbrt::MediumHandle> > > const&, pstd::array<bool, 12>*, pstd::array<bool, 12>*, bool*) + 0x11f0
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b3b018a - pbrt::GPUPathIntegrator::GPUPathIntegrator(pstd::pmr::polymorphic_allocator<std::byte>, pbrt::ParsedScene const&) + 0xeca
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b3b2467 - pbrt::GPURender(pbrt::ParsedScene&) + 0x57
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b1b7476 - main + 0x1326
(/lib/x86_64-linux-gnu/libc.so.6         )	0x0x7f9a90e5d0b3 - __libc_start_main + 0xf3
(/home/moyix/git/pbrt-v4/build/pbrt      )	0x0x55d25b1be9de - _start + 0x2e


Aborted

Setup is CUDA 11.1 on Linux:

Fri Oct 16 20:19:41 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.23.05    Driver Version: 455.23.05    CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce RTX 3090    On   | 00000000:21:00.0  On |                  N/A |
| 75%   75C    P2   348W / 350W |   5195MiB / 24265MiB |     99%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 3090    On   | 00000000:4A:00.0 Off |                  N/A |
|  0%   37C    P8    28W / 350W |     13MiB / 24268MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      6558      G   /usr/lib/xorg/Xorg                102MiB |
|    0   N/A  N/A      9083      G   /usr/lib/xorg/Xorg                537MiB |
|    0   N/A  N/A      9268      G   /usr/bin/gnome-shell               89MiB |
|    0   N/A  N/A   1062811      G   ...oken=16993796885969011938       29MiB |
|    0   N/A  N/A   1539332      C   ...ix/git/pbrt-v4/build/pbrt     1679MiB |
|    0   N/A  N/A   3735375      G   ./tev                             368MiB |
|    0   N/A  N/A   4063098      G   ...AAAAAAAAA= --shared-files       66MiB |
|    1   N/A  N/A      6558      G   /usr/lib/xorg/Xorg                  4MiB |
|    1   N/A  N/A      9083      G   /usr/lib/xorg/Xorg                  4MiB |
|    1   N/A  N/A      9268      G   /usr/bin/gnome-shell                0MiB |
|    1   N/A  N/A   1062811      G   ...oken=16993796885969011938        0MiB |
|    1   N/A  N/A   1539332      C   ...ix/git/pbrt-v4/build/pbrt        0MiB |
|    1   N/A  N/A   3735375      G   ./tev                               0MiB |
|    1   N/A  N/A   4063098      G   ...AAAAAAAAA= --shared-files        0MiB |
+-----------------------------------------------------------------------------+

And, of course, support for using multiple GPUs at once would be great as well :)

Support for multiple GPU SM versions

pbrt currently reports "FATAL CUDA error: invalid device symbol" and dumps a stack trace if its GPU path is run on a GPU that doesn't support the SM version it was compiled for. If nothing else, that's a pretty obscure error message; it would nice to say something more descriptive.

More generally, there's the question about whether the build should be improved so this doesn't happen. One option would be to just compile to PTX. Alternatively, the cmake/checkcuda.cu program currently reports a single SM version, and that of the first GPU that was detected. If multiple GPUs were installed, we might compile for each of them. Or perhaps we should allow the user to specify one or more SM versions, so that they could build for multiple SM versions even if they didn't have corresponding GPUs in their system at the moment...

Building the GPU part of the system is fairly slow already, however, so it's not attractive to add more work to that phase of compilation...

Transparent Machines scene crashing

pwd
/.../pbrt-v4-scenes/transparent-machines
pbrt frame1266.pbrt
pbrt version 4 (built Aug 20 2020 at 11:25:44)
Copyright (c)1998-2020 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the BSD License.
See the file LICENSE.txt for the conditions of the license.
Rendering: [                                                                                                                                                                              ]  (0.3s|484.9s)  [ 4522.000 20200820.124912 /home/jan/git/github/pbrt-v4/src/pbrt/interaction.cpp:86 ] FATAL Check failed: !std::isinf(ty) && !std::isnan(ty)
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f638fce - pbrt::PrintStackTrace() + 0x3e
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f639223 - pbrt::CheckCallbackScope::Fail() + 0x23
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f6a1307 - pbrt::LogFatal(pbrt::LogLevel, char const*, int, char const*) + 0x107
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f7b789a - void pbrt::LogFatal<char const (&) [35]>(pbrt::LogLevel, char const*, int, char const*, char const (&) [35]) + 0x5a
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f7ac1ae - (unknown) + 0x2dd1ae
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f7b2754 - pbrt::SurfaceInteraction::GetBSDF(pbrt::RayDifferential const&, pbrt::SampledWavelengths&, pbrt::CameraHandle, pbrt::ScratchBuffer&, pbrt::SamplerHandle) + 0x64
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f873ef3 - pbrt::VolPathIntegrator::Li(pbrt::RayDifferential, pbrt::SampledWavelengths&, pbrt::SamplerHandle, pbrt::ScratchBuffer&, pbrt::VisibleSurface*) const + 0xb13
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f863bf4 - pbrt::RayIntegrator::EvaluatePixelSample(pbrt::Point2<int> const&, int, pbrt::SamplerHandle, pbrt::ScratchBuffer&) + 0x424
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f85989e - (unknown) + 0x38a89e
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f6d6222 - pbrt::ParallelForLoop2D::RunStep(std::unique_lock<std::mutex>*) + 0x152
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f6d4a0e - pbrt::ThreadPool::WorkOrWait(std::unique_lock<std::mutex>*) + 0x3e
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f6d5fbf - pbrt::ParallelFor2D(pbrt::Bounds2<int> const&, std::function<void (pbrt::Bounds2<int>)>) + 0x1ef
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f855f9b - pbrt::ImageTileIntegrator::Render() + 0x56b
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f63100b - pbrt::CPURender(pbrt::ParsedScene&) + 0x1b9b
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f5758c5 - main + 0x1225
(/lib/x86_64-linux-gnu/libc.so.6         )	0x0x7fc9cae1db97 - __libc_start_main + 0xe7
(/home/jan/git/github/pbrt-v4/build/pbrt )	0x0x55df0f57d2aa - _start + 0x2a
Rendering failed at pixel (724, 52) sample 0. Debug with "--debugstart 724,52,0"


Aborted

issues/oddities in DielectricInterfaceBxDF

Hi there
I've noticed some oddities in DielectricInterfaceBxDF

DielectricInterfaceBxDF::Sample_f() is testing for mfDistrib.EffectivelySpecular() twice.
Once at the start of the function.
And again (redundantly) when it goes to return the BSDFSample in the non-delta part of the function

There appears to be a missing Sqr(etap) component at the bottom of DielectricInterfaceBxDF::f()

PBRTv3 had this for microfacet transmission (ie MicrofacetTransmission::f())

Float sqrtDenom = Dot(wo, wh) + eta * Dot(wi, wh);
Float factor = (mode == TransportMode::Radiance) ? (1 / eta) : 1;
return (Spectrum(1.f) - F) * T *
           std::abs(distribution->D(wh) * distribution->G(wo, wi) * eta * eta *
                    AbsDot(wi, wh) * AbsDot(wo, wh) * factor * factor /
                    (cosThetaI * cosThetaO * sqrtDenom * sqrtDenom));

Noting that eta*eta and factor*factor components cancel out when in Radiance transport mode.

In PBRTv4, there is this at the bottom of MicrofacetTransmission::f()

Float sqrtDenom = Dot(wo, wh) + etap * Dot(wi, wh);
Float factor = (mode == TransportMode::Radiance) ? Sqr(1 / etap) : 1;
return SampledSpectrum((1 - F) * factor *
                                   std::abs(mfDistrib.D(wh) * mfDistrib.G(wo, wi) *
                                            AbsDot(wi, wh) * AbsDot(wo, wh) /
                                            (cosTheta_i * cosTheta_o * Sqr(sqrtDenom))));

We can see its missing etap*etap comparing to PBRTv3.

I can see that if factor was changed to the following, then it would match PBRTv3 again. Was that the intention?
Float factor = (mode == TransportMode::Radiance) ? 1 : Sqr(etap);

I also see Sqr(etap) has been removed from the PDF calculation too, so I'm assuming this has been a conscious decision. This may not be a bug, just thought I'd raise it as it looked like it could be.

thanks

phantom smoke plume appears with GPU volume path integrator

With the smoke-plume/plume.pbrt example scene, additional scattering appears near the top of the smoke plume with the GPU path, but not with the CPU.
Screenshot from 2020-08-18 15-44-36

This is likely related to an indexing issue, where incorrect pixels are being updated.

Another "interesting" thing, likely related, is that there's extra noise in the pixels in the top part of the screen where there should be no volume scattering happening.

Screenshot from 2020-08-18 15-45-26

Blender 2.x exporter.

Hi, I've been developing a blender exporter for some time now.
You find the repository here:
https://github.com/stig-atle/io_scene_pbrt/

I'm wondering if it would be a possibility to add this as a submodule in the exporter directory in pbrt?
It currently works with Pbrt-v3 natively, but can now be used together with the --upgrade function in pbrt-v4.

I'm also right now working on direct support for pbrt-v4 - updating everything that's new.
It supports most materials, batch export of frames, most render settings and so on.
Also includes sample scenes to test with.

I am actively developing on this now and in the future.

CUDA/OptiX not detected on windows

The cmake script seems to have trouble finding OptiX, even when pointed at it, and I'm not enough of a cmake/windows expert to get it working...

Occasional NaN pixels with the GPU

e.g. with transparent-machines/frame1266 rendered at spp, it is reported:

[ 473142.061 20200818.154744 /home/mmp/pbrt-v4/src/pbrt/util/image.h:319 ] ERROR NaN at pixel 119,518 comp 0
[ 473142.061 20200818.154744 /home/mmp/pbrt-v4/src/pbrt/util/image.h:319 ] ERROR NaN at pixel 119,518 comp 1
[ 473142.061 20200818.154744 /home/mmp/pbrt-v4/src/pbrt/util/image.h:319 ] ERROR NaN at pixel 119,518 comp 2

Zero day images have spiky noise

There's a lot of spiky noise in the zero day scenes that looks like an MIS issue:

Screenshot from 2020-08-18 15-54-31

Things learned so far:

  • It even happens with --force-diffuse, so it's presumably not an issue with concentrated indirect light
  • It happens with both the path and volpath integrators (and both the CPU and GPU volpath integrators), so it's presumably not an issue with MIS computations in the integrators
  • It is being added when a BSDF-sampled ray hits a light source (hence, the assumption that something is wrong with MIS weights)
  • It happens with both solid angle sampling and uniform area sampling of the triangular light sources, so is not related to e.g. solid angle sampling blowing up for very small triangles.
  • It happens with both the BVH and the "power" light sampler, so is presumably not related to the BVH light sampler e.g. incorrectly returning zero probability for sampling a light.
  • It doesn't happen with "maxdepth" 1.

...and that's as much as I've figured out so far.

Difference between PBRT-v3 vs PBRT-v4 -- villa-lights-on.pbrt

Hello,

I'm working through the PBRT book in an independent study, and recently I've been diving into PBRT-v4 from PBRT-v3 to try to understand and quantify GPU acceleration. I have yet to be able to successfully build PBRT-v4 with GPU support. Windows 10 doesn't work with VS2019, WSL2 doesn't support Optix yet, my Mac doesn't have support for Optix/Cuda -- bleh.

The real question I'm hoping to ask, is why the villa-lights-on.pbrt scene looks worse in pbrt-v4 (due to visible artifacts):

Here is my analysis, PBRT-v3:
villa-lights-on-CPU

Here is the PBRT-v4 generated file:
villa-lights-on-GPU

I believe the lighting difference is just a change to the default lighting from the pbrt upgrade, but I'm not sure if I need to specify a number of samples to fix the dots. (I saw a --spp for the GPU option, but didn't see a CPU alternative).

Thank you in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.