/Ray-Tracing-API-Integration

The C++/OepnCL implementation of the paper "Ray tracing API integration for OpenGL applications"

Primary LanguageC++MIT LicenseMIT

Ray Tracing API Integration for OpenGL Applications

This repository is a Ray tracing API for OpenGL applications implemented in C++ & OpenCL. Please see below link if you are interested in our work.

Motivation

We provide a realtime ray tracing API (RTAPI) integration for OpenGL applications that can replace the original rendering pilepline (rasterization) with ray tracing by simply adding a few lines of code, and the algorithm behind in RTAPI is also fully parallelized by OpenCL.

Original OpenGL Applications RTAPI OpenGL Applications
img
Conell box w/ light diabled
img
Ray tracing is applied automatically
img
Conell box w/ light enabled
img
Refraction material extension in RTAPI
img
Mirror Reflection material extension in RTAPI

Supported Fixed Function Pipeline Calls

These calls are commonly used in fixed function pipeline, you can simply include the RayTracing.h and these calls are automatically transformed to RTAPI. Note that the extension column represents some features only provided by RTAPI which legacy OpenGL does not support.

Buffer Rendering Capability GLU
(OpenGL Utility Library)
Lighting Extension
glGenBuffers glVertexPointer glEnableClientState gluPerspective glLightfv rtMaterialEXT
glBindBuffer glColorPointer glDisableClientState gluLookAt rtBuildKDtreeCurrentSceneEXT
glBufferData glNormalPointer glEnable
glDrawArrays glDisable
glFlush

Prerequisite

  • OpenCL >= 1.2 and its Installable Client Driver (ICD)
    • Windows 10 PC
    • Linux PC (Ubuntu >= 16.04)
      • Using Intel iGPU, please install via this command sudo apt install intel-opencl-icd
      • Using NVIDIA GPU, please install via this command sudo apt install nvidia-opencl-icd
  • CMake >= 3.7
  • Git
  • GCC (Linux)
  • make (Linux)
  • Visual Studio 2015 Update 3 or greater with the English language pack (Windows)

Build from Scratch

Checkout the source tree:

> git clone --recursive https://github.com/RuinedStar/Ray-Tracing-API-Integration.git
> cd Ray-Tracing-API-Integration

Windows

Install 3rd-party libraries using vcpkg

> cd vcpkg
> .\bootstrap-vcpkg.bat
> .\vcpkg.exe install --triplet x64-windows opencl assimp freeglut glew glm

Generate your Visual Studio project

  • CMake-GUI or follow commands in Linux build section
  • Double click raytracing.sln to open Visual Studio IDE and start to play it around!

Linux

Install 3rd-party libraries using vcpkg

> cd vcpkg
> ./bootstrap-vcpkg.sh
> ./vcpkg install --triplet x64-linux opencl assimp freeglut glew glm

Configure and build your project

> cd ..
> mkdir build
> cd build
> cmake ..
> make -j$(nproc)

Special Thanks

My classmate, C.Y Tang

The College Advisor, C.F Chang