Installing OIDN on Windows requires Rtools45 and building from source.
1. Install Prerequisites
Open the “Rtools45 MinGW UCRT64” shell and install the necessary build tools via pacman:
pacman -Sy --needed \
mingw-w64-ucrt-x86_64-make \
mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ispc
Ensure the toolchain is on your PATH:
export PATH="/c/rtools45/x86_64-w64-mingw32.static.posix/bin:/mingw64/bin:${PATH}"
2. Build OIDN from Source
Run these commands from the Rtools45 ucrt64 shell:
# Download the OIDN source
git clone --recursive https://github.com/RenderKit/oidn.git
cd oidn
# Create a separate build directory
mkdir build-cpu-static
cd build-cpu-static
# Choose an install prefix
OIDN_PREFIX="C:/local/oidn-static"
# Configure OIDN
cmake \
-G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="/path/to/rtools45/x86_64-w64-mingw32.static.posix/bin/gcc.exe" \
-DCMAKE_CXX_COMPILER="/path/to/rtools45/x86_64-w64-mingw32.static.posix/bin/g++.exe" \
-DOIDN_STATIC_LIB=ON \
-DOIDN_DEVICE_CPU=ON \
-DOIDN_DEVICE_SYCL=OFF \
-DOIDN_DEVICE_CUDA=OFF \
-DOIDN_DEVICE_HIP=OFF \
-DOIDN_DEVICE_METAL=OFF \
-DOIDN_APPS=OFF \
-DISPC_EXECUTABLE="$(command -v ispc)" \
-DTBB_DIR="/path/to/rtools45/x86_64-w64-mingw32.static.posix/lib/cmake/TBB" \
-DCMAKE_INSTALL_PREFIX="${OIDN_PREFIX}" \
..
# Build and install
ninja
ninja install
Note: If CMake cannot find TBB, add -DTBB_ROOT=/path/to/rtools45/x86_64-w64-mingw32.static.posix to the cmake command.
3. Configure R
Add the path to your .Renviron file and reinstall rayrender:
echo 'OIDN_PATH=C:/local/oidn' >> "$HOME/.Renviron"
Then in R:
devtools::install_github("tylermorganwall/rayrender", force = TRUE)