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

Force C++11 (at least on Ubuntu 18.04) #207

Open
darksylinc opened this issue Mar 18, 2019 · 7 comments
Open

Force C++11 (at least on Ubuntu 18.04) #207

darksylinc opened this issue Mar 18, 2019 · 7 comments

Comments

@darksylinc
Copy link

Trying to link after compiling with Clang 7.0 will fail because it defaults to C++14; yet ImageIO as provided by Ubuntu 18.04 was built using C++11

Simply adding: set(CMAKE_CXX_STANDARD 11)
at the top of the root CMakeLists.txt fixed the problem.

Btw building with gcc is broken. It keeps complaining:

/usr/include/OpenEXR/ImathMatrix.h:2822:43: error: ISO C++1z does not allow dynamic exception specifications
 Matrix44<T>::inverse (bool singExc) const throw (IEX_NAMESPACE::MathExc)

I have no idea how to force CMake to NOT use C++1z; and I gave up since Clang works.

@McSeem
Copy link

McSeem commented Feb 8, 2020

How did you do it? I tried using this compiler, added in top of the root CMakeLists.txt the following code:

set(CMAKE_CXX_STANDARD 11)
set (CMAKE_C_COMPILER /usr/bin/clang-7)

But I get build error anyway:

/usr/include/OpenEXR/ImathVec.h:228:34: error: ISO C++1z does not allow dynamic exception specifications
     const Vec2 & normalizeExc () throw (IEX_NAMESPACE::MathExc);

I use Clang compiler, provided by standard Kubuntu 18.04 repos.

@darksylinc
Copy link
Author

darksylinc commented Feb 8, 2020

You need:

At the top of everything (one of the first things it gets executed, and find in files in other *.txt and *.cmake files that it doesn't get overriden):

set(CMAKE_CXX_STANDARD 11)

And regarding the use of Clang, you need to set the C++ compiler too:

set (CMAKE_C_COMPILER /usr/bin/clang-7)
set (CMAKE_CXX_COMPILER /usr/bin/clang++-7)

Additionally: This repo is mostly abandoned by AMD now and they kept developing it further as closed source. Some of the samples work on their modern GPUs with modern drivers, with minor glitches, while other samples completely break apart.

The only thing I managed to work out of the box exactly as intended is an older demo they packaged for Windows, on a Radeon HD 7770. But when I tried it on a RX 560 (same OS, same exe), there were issues.

When it doesn't crash but it looks glitchy, I didn't research further but it looked like NaNs were creeping out when rays hit outside the scene, thus 'tainting' the scene.

RadeonRays runs rock solid for me, but Baikal... not so much.

It's a shame, because the Radeon HD 7770 demo was amazing (pathtracing was so fast and quality so good)

@McSeem
Copy link

McSeem commented Feb 9, 2020

Thank you for your response! Now, I have another error:
Scanning dependencies of target RprTest

[ 92%] Building CXX object RprTest/CMakeFiles/RprTest.dir/main.cpp.o
[ 92%] Linking CXX shared library ../bin/libBaikalDataGenerator.so
**/usr/bin/ld: cannot find -lc++experimental**
clang: error: linker command failed with exit code 1 (use -v to see invocation)
BaikalDataGenerator/CMakeFiles/BaikalDataGenerator.dir/build.make:156: recipe for target 'bin/libBaikalDataGenerator.so' failed
make[2]: *** [bin/libBaikalDataGenerator.so] Error 1
CMakeFiles/Makefile2:658: recipe for target 'BaikalDataGenerator/CMakeFiles/BaikalDataGenerator.dir/all' failed
make[1]: *** [BaikalDataGenerator/CMakeFiles/BaikalDataGenerator.dir/all] Error 2

I don't know what's this library c++experimental and can't find it in standard Kubuntu 18.04 repos. What is it?

@darksylinc
Copy link
Author

You need to do:

sudo apt install libc++-dev

@McSeem
Copy link

McSeem commented Feb 12, 2020

Yeah, I built it. However, I was a little surprised. Initially, I wanted to check whether this library can be used in game development. As I understand it, this demo uses full ray tracing and no any noise filters used.
Is it possible to use some simplifications (such as in DXR) and noise reduction when using real-time ray tracing provided by Radeon Rays so that it can be used in games? This demo does not slow down or lag on my mashine, but the presence of noise makes it impossible to use in games in this form.
So, there some screenshots what I see on my mashine:
Noise level after 1 sec
baikal_render_1sec
Noise level after 3,5 sec
baikal_render_3 5sec
Noise level after 25 sec
baikal_render_25sec
Noise level during rotation or moving scene:
baikal_render_rotate
Is this how it should be on my GPU (Sapphire AMD RX Vega 64 Nitro+) with AMD Ryzen 7 2700 CPU? Motherboard is MSI X470 Gaming M7 AC. I didn't expect so much noise.
It is likely that real-time Radeon Rays applications require simplifications and noise reduction. Is that so?

@bsavery
Copy link

bsavery commented Feb 12, 2020

Hi @McSeem . This is a pathtracing renderer, so the performance is expected. You can use Radeon Rays for RT effects, and we also have an SDK for noise redeuction etc: https://www.amd.com/en/technologies/radeon-prorender-developers

@darksylinc
Copy link
Author

darksylinc commented Feb 13, 2020

As bsavery said, Baikal is a full-blown PBR pathtracer. Its aim is similar to that of Cycles (Blender) Octane, LuxRender and Mitsuba. By its nature, pathtracers are noisy and either require lots of samples or denoiser to get a crisp picture.

While it might be possible to be used in games, its use cases would be very specific (e.g. for baking GI data, for comparison as ground truth).

What you seem to be after is a simple raytracer. For an easy explanation of a pathtracer vs raytracer see Path Tracing vs Ray Tracing.
The TL;DR is that raytracers shoot one ray towards each light (fast & crisp but also too sharp), whereas pathtracers shoot a lot of rays in random directions (accurate & smooth but noisy & slow).

The closest equivalent replacement for DXR would be RadeonRays which is also used by Baikal.
See the tutorials for an implementation (note the tutorials process the results in the CPU to ease understanding. If you want realtime performance you'll need to move the simple CPU code into a compute or pixel shader)

RadeonRays simply takes as input "please shoot these rays at these locations & directions" and outputs "here's what they hit", which is also what DXR does.

Cheers and good luck

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

3 participants