A spectral path tracer (Monte Carlo integration, physically based, multiple importance sampling) that can simulate both vision and LIDAR, implemented in the GPGPU purely functional array programming language Futhark.
Regardless of platform, you need to install both Futhark and Rust (and a C compiler). Futhatk is used for the main implementation, and all code that runs on the GPU, while Rust and C are used for some host-side code, like loading object files and showing an SDL2 window.
On Linux, statically compiled SDL2 is included in ./deps/SDL2/.
On Windows you’ll have to install SDL2 yourself. Using MSYS2 (mingw) is recommended (yay pacman!). You may have to update your environment variables so that the linker can find the installed libraries.
You’ll need both the libraries and headers for compilation, and drivers with support at runtime.
On Linux, simply install the appropriate package (something like “opencl-dev”) to get the development library. Depending on your distribution and hardware, your drivers may be OpenCL ready out of the box. Otherwise you must install packages that provide an OpenCL runtime (and an ICD loader?).
On Windows, get an OpenCL SDK (preferably a “light” version) from your GPU vendor – for AMD, you can find it here. With regards to runtime, you should be good to go as long as you’ve installed the normal GPU drivers for your system.
Simply run make
. If it doesn’t work, try poking around in the
Makefile. You may need to change CC=clang
to CC=gcc
for example.
On Linux, run with ./main
. On Windows, use just main.exe
instead.
$ ./main -o assets/CornellBox-Original.obj Using OpenCL device: Ellesmere Use -d or -i to change this. no of triangles: 2188
For the interactive demo:
- w, a, s, d, x, z
- Translation.
- Arrow keys
- Rotation.
- 1, 2
- Increase / decrease resolution.
- q, e
- Decrease / increase samples per (virtual) pixel.
- SPACE
- Toggle accumulation.
- n, m
- Disable / enable accumulation.
- i, k
- Increase / decrease aperture size.
- o, l
- Increase / decrease focal distance.
- t
- Toggle LIDAR sensor.
- 8, 9, 0
- Self-transmitter: flash / scanning / none.
- p
- Toggle sky.
Much of the windowing code in the interactive demo is based on lys, owned by DIKU and licensed under the ISC license (see ./demo-interactive/LYS-LICENSE).
Our LBVH implementation takes a lot of inspiration from the one in here by Athas.
This project is released under the AGPL, version 3 or later. See ./LICENSE.
Copyright (C) 2020 Ari von Nordenskjöld & Johan Johansson
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.