LuxRays - LuxRender Wiki
Luxrender GPL Physically Based Renderer

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:

OpenCL-smallptGPU-high-smaples.jpg

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

OpenCL-smallptGPU-Test-lux.jpg

And same scene rendered for 60 seconds with SmallptGPU:

OpenCL-smallptGPU-Test-smallptgpu.jpg

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

All the code included in LuxRays repository (i.e. LuxRays, LuxCore, LuxCore implementation aka SLG) has been released under a new license: Apache Licence 2.0. It is a very liberal license allowing the use of the code inside commercial products too.

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:

LuxRays-gpu-only.jpg

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:

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

LuxrenderGPU included the very first prototype of LuxRays:

LuxrenderGPU-first-rendering.jpg

Sources

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

If you are having trouble downloading from the main site, a backup mirror has been provided for Luxrays at googlecode

hg clone https://luxrays.googlecode.com/hg/ 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 Ubuntu

Building Luxrays on Ubuntu

Building on Ubuntu 10.10


Archlinux

A package for Luxrays is now available for Archlinux users.

Building on Mac OS X

Snow Leopard 10.6.x

Prerequisites:

- Install the OSX Developer SDK which can be downloaded from here.

- Get mercurial for managing the repositoryy ( checkouts/updates )

- Get CMake 2.6-4 or newer.

- Get QT 4.7.1 or higher and install it. ( for 64bit cocoa-version is mandatory )

- Get cl.hpp from KHRONOS and place it in: /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers

All other needed dependencies are located in the "macos" repository.

Get source of Luxrender, LuxRays and macos in the same directory ( you can use the mirror too )

hg clone http://src.luxrender.net/luxrays

hg clone http://src.luxrender.net/macos

The new OSX buildprocess :

Compile LuxRays (OSX 10.6):


In cmakeGUI ( 2.6+ recommended ), do following action :

1. fill in the "Where is the source code" field, using the folder where you put the LuxRays source code

2. fill in the "Where to build the binaries" field

3. configure -> xcode-crosscompile

4. set in crosscompile: Name = darwin, version = 10.6, Processor = i386, x86_64, c = gcc, c++ = g++, root = /Developer/SDKs/MacOSX10.6.sdk

... Modes = set all to "find from root then native system".

press configure once more , then boost is found in boostroot

5. generate

6. open XCode.project

7. set your preferred architecture by going to the Project menu -> Edit Project Settings -> Architectures (cmake 2.6 sets default = two architectures, universal Intel, cmake 2.8 sets" active architecture only"by default, uncheck for universal builds)

8. build


Hint:If you wanna deploy LuxMark complete "dependencyless", use macdeployqt for bundling used Qt-frameworks into the app-bundle.

Important: only SDK-builds are guarantied to be crosscompatible.

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.

LuxMark

LuxMark is an OpenCL benchmark based on SLG and LuxRays.

Credits

A special thanks goes to:

  • Alain "Chiaroscuro" Ducharme for Blender 2.5 SLG exporter and several scenes provided;
  • Sladjan "lom" Ristic for several scenes provided;
  • Rikb for source patches;
  • Livuxman for source patches;
  • Nate Robins for glut32.dll;
  • Diego Nehab for PLY reading/writing library;
  • all OSX-porting by Jens Verwiebe
  • http://www.hdrlabs.com and http://shtlab.blogspot.com for HDR maps;