LuxRays - LuxRender Wiki

LuxRays

Personal tools

From LuxRender Wiki

Jump to: navigation, search

Contents

Introduction

LuxRays is the name we have chosen for the part of Luxrender dedicated to accelerate the ray intersection process by using GPUs. You can find more information about the ongoing effort of integrating OpenCL support in Luxrender here.

An open source component for accelerating any ray tracing application

GPGPU computing is a formidable tool to accelerate any ray tracing application. Test result has shown has modern GPGPUs can easily increase the performance of an ray tracer by an order of magnitude. This is a simple path tracer (SmallptGPU) running on a GPU at the eye-popping speed of 114,000,000 of samples/sec:

This is exactly the same scene rendered first with Luxrender for 60 seconds with Metropolis sampler and Path surface integrator:

And same scene rendered for 60 seconds with SmallptGPU:

Integrating GPU support is going to be a mandatory task for any open source rendering engine. The Luxrender team wants to share its effort with other open source developers and decided to develop LuxRays as a stand-alone library. This library will be developed with the main task of accelerating Luxrender but it will be available for any other project that does not want to waste its time developing a duplicate of our work. Indeed, as in any open source project, any contribution will be highly welcome.

License

LuxRays is release under GPL as all the other sources of LuxRender. GPL is compatible with many other open source licenses, you can find more details here and here.

Features

LuxRays will have the following list of features (in bold the features already implemented):

  • C++ API;
  • a wrapper written in C in order to expose the API to C application too;
  • Multiple OS support (i.e. Linux, Windows, MacOS);
  • Multiple hardware support (i.e. ATI and NVIDIA via OpenCL);
  • Support for rendering over a wide range of heterogeneous devices like CPU, GPU, CPU+GPU, CPU+Multiple-GPUs;
  • a level of abstraction over rendering device available with support for:
    • OpenCL devices (CPUs, GPUs, etc.);
    • Native threads;
    • NVIDIA CUDA support may be added in the future even if it is not planned at the moment.
  • A wide range of accelerator structure (i.e. BVH, QBVH, KD-Tree, etc.);
  • triangle mesh primitive support (support for other kind of primitive may be added in the future);
  • low GPU memory foot print because accelerating only the process of ray interactions (i.e. no need to use GPU memory for texture maps, materials, frame buffer, etc.);
  • support for Virtual Devices (i.e. many GPUs seen as a single device or one GPU seen as multiple devices).

LuxRays is mainly developed to accelerate off-line renderings. Even if the current generation of GPUs are so fast to offer near real-time rendering time, we are going to optimize for bandwidth (i.e. number of ray intersections per seconds) over latency.

A data parallel model

LuxRays uses a Data Parallel Model: it doesn't reduce the time spent to trace a single ray but it is able to trace many thousands of rays in parallel.

Hybrid CPU/GPU mode

LuxRays supports Hybrid CPU/GPU mode where only the ray intersection task is off load to the GPUs while everything else run on the CPU and can be written with usual tools and languages.

GPU-only mode

LuxRays support also GPU-only mode where all the work is done by the GPUs and the code is all written in OpenCL. This is an example where i7 860 + 5870 + 5850 are used:

Status of the project

LuxRays is a recently started sub-project of Luxrender. A specification of the API is not yet available. SmallLuxGPU has been used as test to define how the API should work and to collect performance results:

Image:OpenCL-smallluxGPU-Gallery01.jpg Image:OpenCL-smallluxGPU-Gallery02.jpg Image:OpenCL-smallluxGPU-Gallery03.jpg Image:OpenCL-smallluxGPU-Gallery04.jpg

LuxrenderGPU included the very first prototype of LuxRays:

Sources

LuxRays has now its own source repository at http://src.luxrender.net/luxrays.

Building on Linux

Ubuntu 10.04

Install the OpenCL SDK for your GPU. AMD/ATI OpenCL SDK is available here. NVIDIA OpenCL headers and libraries should be already included with the X11 driver. (Check /usr/include/CL/ for all headers listed on the page linked below and download them manually if required). OpenCL C++ bindings (i.e. cl.hpp) are included in ATI SDK and they will be part of OpenCL standard from version 1.1. NVIDIA doesn't yet include this file in its SDK but you can find a copy here (linked from this page)

Run the following commands:

sudo apt-get install build-essential cmake mercurial libfreeimage-dev \
 libfreeimage3 libboost-dev libboost-thread-dev libboost-date-time-dev \
 libboost-program-options-dev libboost-filesystem-dev libopenexr-dev \
 libboost-iostreams-dev libboost-regex-dev libboost-serialization-dev \
 libboost-wave-dev libtiff4-dev libpng12-dev glutg3-dev
hg clone http://src.luxrender.net/luxrays luxrays
cd luxrays

Edit the CMakeList to point to your OpenCL SDK if required and run the following commands:

cmake .
make -j 4 .

Building on Mac OS X

Snow Leopard 10.6.4 + MacPorts

Install the Snow Leopard Developer SDK which can be downloaded from here.

I'm not sure whether it's required, but I have the latest version of XQuartz installed, available from here.

Install the OpenCL SDK for your GPU. AMD/ATI OpenCL SDK is available here. NVIDIA OpenCL headers and libraries should be already included with the Snow Leopard Xcode SDK. (Check for the presence of /System/Library/Frameworks/OpenCL.framework).

OpenCL C++ bindings (i.e. cl.hpp) are included in ATI SDK and they will be part of OpenCL standard from version 1.1.

NVIDIA doesn't yet include this file in its SDK but you can find a copy here (linked from this page)

Copy cl.hpp to /System/Library/Frameworks/OpenCL.framework/Headers

Edit the CMakeList to point to your OpenCL SDK if required. Mine looks like this at line 70 after the edit :

else(LUXRAYS_DISABLE_OPENCL)
    find_path(OCL_INCLUDE_PATH NAMES cl.hpp PATHS /System/Library/Frameworks/OpenCL.framework/Headers /Library/Frameworks/CUDA.framework/Headers/cuda)
    find_library(OCL_LIBRARY OpenCL /System/Library/Frameworks/OpenCL.framework/Libraries)

Install MacPorts from here if you don't already have it installed.

Run the following commands:

sudo port install cmake mercurial freeimage boost openexr tiff libpng glut doxygen
hg clone http://src.luxrender.net/luxrays luxrays
cd luxrays
cmake .
make

API Documentation

The Doxygen LuxRays API Documentation is available here.

Demos

SmallLuxGPU (SLG)

SmallLuxGPU is now included in LuxRays has a demo of the library.

Credits

A special thanks goes to: