Compiling PBRT v3, v4 and Mitsuba 3 on macOS and Linux (English)

PBRT Getting Started

https://github.com/mmp/pbrt-v3

https://github.com/mmp/pbrt-v4

To compile PBRT v3, run the following commands:

git clone --recursive https://github.com/mmp/pbrt-v3/
cd pbrt-v3
mkdir build
cd build
cmake ../
make -j
Bash

To compile PBRT v4, run the following commands:

git clone --recursive https://github.com/mmp/pbrt-v4/
cd pbrt-v4
mkdir build
cd build
cmake ../
make -j
Bash

(Options) After compiling both versions, you can create symbols links for easier access from terminal.

sudo ln -s /[your-pbrt-v4-PATH]/build/pbrt /usr/local/bin/pbrt4
sudo ln -s /[your-pbrt-v3-PATH]/build/pbrt /usr/local/bin/pbrt3
Bash

Notice: You need to change the PATH above.

If you wanna delete the links, type:

sudo rm /usr/local/bin/pbrt4
sudo rm /usr/local/bin/pbrt3
Bash

Some Problem when building pbrt-v4 cmake files:

Error Log:

Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)
Call Stack (most recent call first):

You need to download the OpenGL Lib:

sudo apt update
sudo apt install -y \
    mesa-utils \
    libgl1-mesa-dev \
    libglu1-mesa-dev \
    freeglut3-dev \
    xorg-dev
Bash

Error Log:

CMake Error at src/ext/glfw/src/CMakeLists.txt:76 (message):
Failed to find wayland-scanner

Lack wayland-scanner tool when cmake building GLFW, run following command:

sudo apt update
sudo apt install -y \
    wayland-protocols \
    libwayland-dev
Bash

Error Log:

CMake Error at /home/linuxbrew/.linuxbrew/share/cmake/Modules/FindPkgConfig.cmake:645 (message):
The following required packages were not found:

  • xkbcommon>=0.5.0

Need download Wayland:

sudo apt update
sudo apt install -y \
    libxkbcommon-dev
Bash

Warnning Log:

CMake Warning at CMakeLists.txt:200 (message):
Found CUDA but PBRT_OPTIX7_PATH is not set. Disabling GPU compilation.

Optix doesn’t support WSL2 yet.

Go optix link , download the file.

Maybe you got the file named: “NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64-35015278.sh”. (Change the name Remember)

Then, ensure the .sh file has executable permissions:

chmod +x NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64-35015278.sh
Bash

Execute the installer script:

sudo ./NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64-35015278.sh
Bash

press y to accept the license:

Log:

Do you accept the license? [yn]:
y
By default the NVIDIA OptiX will be installed in:
“/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64”
Do you want to include the subdirectory NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64?
Saying no will install in: “/home/remo-wsl” [Yn]:
y

Using target directory: /home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64
Extracting, please wait…

Unpacking finished successfully

Set the Environment Variable After Installation (Remember Change The File Name) :

export PBRT_OPTIX7_PATH=/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64
Bash

To make it permanent, add it to your .bashrc:

echo 'export PBRT_OPTIX7_PATH=/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64' >> ~/.bashrc
source ~/.bashrc
Bash

Finally, back to the pbrt-v4 PATH:

rm -rf build
mkdir build
cd build
cmake .. -DPBRT_OPTIX7_PATH=/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64
make -j$(nproc)
Bash

Mitsuba 3 Getting Started

https://www.mitsuba-renderer.org

Requirements

  • Python >= 3.8
  • (optional) For computation on the GPU: NVidia driver >= 495.89
  • (optional) For vectorized / parallel computation on the CPU: LLVM >= 11.1

The following command leads you to intall both Mitsuba 3 and JIT (If your system not already available. )

pip install mitsuba
Bash

Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_USEN