View on GitHub

Embree

High Performance Ray Tracing Kernels

Supported Platforms

Embree supports Windows (32 bit and 64 bit), Linux (64 bit) and Mac OS X (64 bit). The code compiles with the Intel Compiler, GCC, CLANG and the Microsoft Compiler. Embree is tested with Intel Compiler 15.0.2, CLANG 3.4.2, GCC 4.8.2, and Visual Studio 12 2013. Using the Intel Compiler improves performance by approximately 10%.

Performance also varies across different operating systems. Embree is optimized for Intel CPUs supporting SSE, AVX, and AVX2 instructions, and requires at least a CPU with support for SSE2.

The Xeon Phi version of Embree only works under Linux in 64 bit mode. For compilation of the the Xeon Phi code the Intel Compiler is required. The host side code compiles with GCC, CLANG, and the Intel Compiler.

Downloading Embree

For Windows we provide an installer for precompiled 64 bit and 32 bit Embree binaries as well as ZIP files:

embree-2.5.1-x64.exe
embree-2.5.1-win32.exe

embree-2.5.1.x64.windows.zip
embree-2.5.1.win32.windows.zip

For Linux we provide Embree precompiled for 64 bit as a TGZ file or as RPMs:

embree-2.5.1.x86_64.linux.tar.gz
embree-devel-2.5.1-1.x86_64.rpm
embree-examples-2.5.1.x86_64.rpm
embree-devel_xeonphi-2.5.1.x86_64.rpm
embree-examples_xeonphi-2.5.1-1.x86_64.rpm

For Mac OS X we provide Embree as an installer and as a TGZ file:

embree-bin-2.5.1.x86_64.dmg
embree-bin-2.5.1.x86_64.macosx.tar.gz

If you need to recompile Embree for your platform, please download the sources and follow the compilation instructions below:

embree-2.5.1.zip
embree-2.5.0.zip
embree-2.4.zip
embree-2.3.3.1.zip
embree-2.3.3.zip
embree-2.3.2.zip
embree-2.3.1.zip
embree-2.3.zip
embree-2.2.zip
embree-2.1.zip
embree-2.0.zip
embree-1.1.zip

Alternatively you can also use git to get the latest Embree 2.5.1

$ git clone https://github.com/embree/embree.git embree
$ cd embree
$ git checkout v2.5.1

You can also check out Embree with subversion:

$ svn checkout https://github.com/embree/embree.git/branches/v2.5.1 embree
$ cd embree

If you encounter bugs please report them to the GitHub Issue Tracker for Embree.

Once you downloaded or checked out Embree you will see the following folder structure:

embree
Embree root folder
embree/include
User API to the ray tracing kernels
embree/kernels
Embree ray tracing kernels implementation
embree/kernels/xeon
Embree kernels for Intel® Xeon® CPUs
embree/kernels/xeonphi
Embree kernels for Intel® Xeon Phi™ Accelerators
embree/tutorials
Embree tutorials

Compiling Embree

Linux and Mac OS X

To compile Embree you need a modern C++ compiler that supports C++11. Embree is tested with Intel® Compiler 15.0.2, CLANG 3.4.2, and GCC 4.8.2. If the GCC that comes with your Fedora/Redhat/CentOS distribution is too old then you can run the provided script scripts/install_linux_gcc.sh to locally install a recent GCC into $HOME/devtools-2.

Embree supports to use the Intel® Threading Building Blocks (TBB) as tasking system. For performance and flexibility reasons we recommend to use Embree with the Intel® Threading Building Blocks (TBB) and best also use TBB inside your application. Optionally you can disable TBB in Embree through the RTCORE_TASKING_SYSTEM CMake variable.

Embree supported the Intel® SPMD Program Compiler (ISPC), which allows straight forward parallelization of an entire renderer. If you do not want to use ISPC then you can disable ENABLE_ISPC_SUPPORT in CMake. Otherwise, download and install the ISPC binaries (we have tested ISPC version 1.8.0) from ispc.github.io. After installation, put the path to ispc permanently into your PATH environment variable or you need to correctly set the ISPC_EXECUTABLE variable during CMake configuration.

You additionally have to install CMake 2.8.11 or higher and the developer version of GLUT.

Under Mac OS X, all these dependencies can be installed using MacPorts:

sudo port install cmake tbb freeglut

Depending on you Linux distribution you can install these dependencies using yum or apt-get. Some of these packages might already be installed or might have slightly different names.

Type the following to install the dependencies using yum:

sudo yum install cmake.x86_64
sudo yum install tbb.x86_64 tbb-devel.x86_64
sudo yum install freeglut.x86_64 freeglut-devel.x86_64
sudo yum install libXmu.x86_64 libXi.x86_64
sudo yum install libXmu-devel.x86_64 libXi-devel.x86_64

Type the following to install the dependencies using apt-get:

sudo apt-get install cmake-curses-gui
sudo apt-get install libtbb-dev
sudo apt-get install freeglut3-dev
sudo apt-get install libxmu-dev libxi-dev

Finally you can compile Embree using CMake. Create a build directory inside the Embree root directory and execute “ccmake ..” inside this build directory.

mkdir build
cd build
ccmake ..

This will open a configuration dialog where you can perform various configurations as described below. After having configured Embree, press c (for configure) and g (for generate) to generate a Makefile and leave the configuration. The code can be compiled by executing make.

make

The executables will be generated inside the build folder. We recommend to finally install the Embree library and header files on your system. Therefore set the CMAKE_INSTALL_PREFIX to /usr in cmake and type:

sudo make install

If you keep the default CMAKE_INSTALL_PREFIX of /usr/local then you have to make sure the path /usr/local/lib is in your LD_LIBRARY_PATH.

You can also uninstall Embree again by executing:

sudo make uninstall

If you cannot install Embree on your system (e.g. when you don’t have administrator rights) you need to add embree_root_directory/build to your LD_LIBRARY_PATH (and SINK_LD_LIBRARY_PATH in case you want to use Embree on Intel® Xeon Phi™ coprocessors).

Intel® Xeon Phi™ coprocessor

Embree supports the Intel® Xeon Phi™ coprocessor under Linux. To compile Embree for Xeon Phi you need to enable the XEON_PHI_ISA option in CMake and have the Intel Compiler and the Intel® Manycore Platform Software Stack (Intel® MPSS) installed.

Enabling the buffer stride feature reduces performance for building spatial hierarchies on Xeon Phi. Under Xeon Phi the Intel® Threading Building Blocks (TBB) tasking system is not supported, and the implementation will always use some internal tasking system.

Windows

To compile Embree under Windows you need a recent version of Visual Studio that supports C++11. We have tested Visual Studio 2013, Visual Studio 2012, and Visual Studio 2010. Under Visual Studio 2013 you can enable AVX2 in CMake, however, Visual Studio 2012 supports at most AVX, and Visual Studio 2010 at most the SSE4.2 CMake configuration.

Embree supports to use the Intel® Threading Building Blocks (TBB) as tasking system. For performance and flexibility reasons we recommend to use Embree with the Intel® Threading Building Blocks (TBB) and best also use TBB inside your application. Optionally you can disable TBB in Embree through the RTCORE_TASKING_SYSTEM CMake variable.

Embree will either find the Intel® Threading Building Blocks (TBB) installation that comes with the Intel® Compiler, or you can install the binary distribution of TBB directly from www.threadingbuildingblocks.org into a folder named tbb into your Embree root directory. You also have to make sure that the libraries tbb.dll and tbb_malloc.dll can be found when executing your Embree applications, e.g. by putting the path to these libraries into your PATH environment variable.

Embree supported the Intel® SPMD Program Compiler (ISPC), which allows straight forward parallelization of an entire renderer. If you do not want to use ISPC then you can disable ENABLE_ISPC_SUPPORT in CMake. Otherwise, download and install the ISPC binaries (we have tested ISPC version 1.8.0) from ispc.github.io. After installation, put the path to ispc.exe permanently into your PATH environment variable or you need to correctly set the ISPC_EXECUTABLE variable during CMake configuration.

You additionally have to install CMake (version 2.8.11 or higher). Note that you need a native Windows CMake installation, because CMake under Cygwin cannot generate solution files for Visual Studio.

Using the IDE

Run cmake-gui, browse to the Embree sources, set the build directory and click Configure. Now you can select the Generator, e.g. “Visual Studio 12 2013” for a 32 bit build or “Visual Studio 12 2013 Win64” for a 64 bit build. Most configuration parameters described for the Linux build can be set under Windows as well. Finally, click “Generate” to create the Visual Studio solution files.

Windows-specific CMake build options for Embree.
Option Description Default
CMAKE_CONFIGURATION_TYPE List of generated configurations. Debug;Release;RelWithDebInfo
USE_STATIC_RUNTIME Use the static version of the C/C++ runtime library. OFF

For compilation of Embree under Windows use the generated Visual Studio solution file embree2.sln. The solution is by default setup to use the Microsoft Compiler. You can switch to the Intel Compiler by right clicking onto the solution in the Solution Explorer and then selecting the Intel Compiler. We recommend using 64 bit mode and the Intel Compiler for best performance.

To build Embree with support for the AVX2 instruction set you need at least Visual Studio 2013 Update 4. When switching to the Intel Compiler to build with AVX2 you currently need to manually remove the switch /arch:AVX2 from the embree_avx2 project, which can be found under Properties ⇒ C/C++ ⇒ All Options ⇒ Additional Options.

To build all projects of the solution it is recommend to build the CMake utility project ALL_BUILD, which depends on all projects. Using “Build Solution” would also build all other CMake utility projects (such as INSTALL), which is usually not wanted.

We recommend enabling syntax highlighting for the .ispc source and .isph header files. To do so open Visual Studio, go to Tools ⇒ Options ⇒ Text Editor ⇒ File Extension and add the isph and ispc extension for the “Microsoft Visual C++” editor.

Using the Command Line

Embree can also be configured and built without the IDE using the Visual Studio command prompt:

cd path\to\embree
mkdir build
cd build
cmake -G "Visual Studio 12 2013 Win64" ..
cmake --build . --config Release

You can also build only some projects with the --target switch. Additional parameters after “--” will be passed to msbuild. For example, to build the Embree library in parallel use

cmake --build . --config Release --target embree -- /m

CMake configuration

The default CMake configuration in the configuration dialog should be appropriate for most usages. The following table describes all parameters that can be configured in CMake:

CMake build options for Embree.
Option Description Default
CMAKE_BUILD_TYPE Can be used to switch between Debug mode (Debug), Release mode (Release), and Release mode with enabled assertions and debug symbols (RelWithDebInfo). Release
COMPILER Select either GCC, ICC, or CLANG as compiler. GCC
ENABLE_ISPC_SUPPORT Enables ISPC support of Embree. ON
ENABLE_STATIC_LIB Builds Embree as a static library. OFF
ENABLE_TUTORIALS Enables build of Embree tutorials. ON
ENABLE_XEON_PHI_SUPPORT Enables generation of the Xeon Phi version of Embree. OFF
RTCORE_BACKFACE_CULLING Enables backface culling, i.e. only surfaces facing a ray can be hit. OFF
RTCORE_BUFFER_STRIDE Enables the buffer stride feature. ON
RTCORE_INTERSECTION_FILTER Enables the intersection filter feature. ON
RTCORE_RAY_MASK Enables the ray masking feature. OFF
RTCORE_RETURN_SUBDIV_NORMAL Instead of the triangle normal the ray returns a smooth normal based on evaluating the subdivision surface patch. OFF
RTCORE_TASKING_SYSTEM Chooses between Intel® Threading Building Blocks (TBB) or an internal tasking system (INTERNAL). TBB
XEON_ISA Select highest supported ISA on Intel® Xeon® CPUs (SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX-I, or AVX2). AVX2