Embree ray tracing kernels repository.
% Embree: High Performance Ray Tracing Kernels 4.4.1 % Intel Corporation
Intel® Embree is a high-performance ray tracing library developed at Intel, which is released as open source under the Apache 2.0 license. Intel® Embree supports x86 CPUs under Linux, macOS, and Windows; ARM CPUs on Linux and macOS; as well as Intel® GPUs under Linux and Windows.
Intel® Embree targets graphics application developers to improve the performance of photo-realistic rendering applications. Embree is optimized towards production rendering, by putting focus on incoherent ray performance, high quality acceleration structure construction, a rich feature set, accurate primitive intersection, and low memory consumption.
Embree's feature set includes various primitive types such as triangles (as well quad and grids for lower memory consumption); Catmull-Clark subdivision surfaces; various types of curve primitives, such as flat curves (for distant views), round curves (for closeup views), and normal oriented curves, all supported with different basis functions (linear, Bézier, B-spline, Hermite, and Catmull Rom); point-like primitives, such as ray oriented discs, normal oriented discs, and spheres; user defined geometries with a procedural intersection function; multi-level instancing; filter callbacks invoked for any hit encountered; motion blur including multi-segment motion blur, deformation blur, and quaternion motion blur; and ray masking.
Intel® Embree contains ray tracing kernels optimized for the latest x86 processors with support for SSE, AVX, AVX2, and AVX-512 instructions, and uses runtime code selection to choose between these kernels. Intel® Embree contains algorithms optimized for incoherent workloads (e.g. Monte Carlo ray tracing algorithms) and coherent workloads (e.g. primary visibility and hard shadow rays) as well as supports for dynamic scenes by implementing high-performance two-level spatial index structure construction algorithms.
Intel® Embree supports applications written with the Intel® Implicit SPMD Program Compiler (Intel® ISPC, https://ispc.github.io/) by providing an ISPC interface to the core ray tracing algorithms. This makes it possible to write a renderer that automatically vectorizes and leverages SSE, AVX, AVX2, and AVX-512 instructions.
Intel® Embree supports Intel GPUs through the SYCL open standard programming language. SYCL allows to write C++ code that can be run on various devices, such as CPUs and GPUs. Using Intel® Embree application developers can write a single source renderer that executes efficiently on CPUs and GPUs. Maintaining just one code base this way can significantly improve productivity and eliminate inconsistencies between a CPU and GPU version of the renderer. Embree supports GPUs based on the Xe HPG and Xe HPC microarchitecture, which support hardware accelerated ray tracing do deliver excellent levels of ray tracing performance.
Embree supports Windows (32-bit and 64-bit), Linux (64-bit), and macOS (64-bit). Under Windows, Linux and macOS x86 based CPUs are supported, while ARM CPUs are currently only supported under Linux and macOS (e.g. Apple M1). ARM support for Windows experimental.
Embree supports Intel GPUs based on the Xe HPG microarchitecture (Intel® Arc™ GPU) under Linux and Windows and Xe HPC microarchitecture (Intel® Data Center GPU Flex Series and Intel® Data Center GPU Max Series) under Linux.
The code compiles with the Intel® Compiler, Intel® oneAPI DPC++ Compiler, GCC, Clang, and the Microsoft Compiler. To use Embree on the GPU the Intel® oneAPI DPC++ Compiler must be used. Please see section [Compiling Embree] for details on tested compiler versions.
Embree requires at least an x86 CPU with support for SSE2 or an Apple M1 CPU.
If you encounter bugs please report them via Embree's GitHub Issue Tracker.
For questions and feature requests please write us at [email protected].
To receive notifications of updates and new features of Embree please subscribe to the Embree mailing list.
A pre-built version of Embree for Windows is provided as a ZIP archive
embree-4.4.1.x64.windows.zip. After
unpacking this ZIP file, you should set the path to the lib folder
manually to your PATH environment variable for applications to find
Embree.
A pre-built version of Embree for Linux is provided as a tar.gz archive:
embree-4.4.1.x86_64.linux.tar.gz. Unpack
this file using tar and source the provided embree-vars.sh (if you
are using the bash shell) or embree-vars.csh (if you are using the C
shell) to set up the environment properly:
tar xzf embree-4.4.1.x86_64.linux.tar.gz
source embree-4.4.1.x86_64.linux/embree-vars.shWe recommend adding a relative RPATH to your application that points
to the location where Embree (and TBB) can be found, e.g. $ORIGIN/../lib.
The macOS version of Embree is also delivered as a ZIP file:
embree-4.4.1.x86_64.macosx.zip. Unpack
this file using tar and source the provided embree-vars.sh (if you
are using the bash shell) or embree-vars.csh (if you are using the C
shell) to set up the environment properly:
unzip embree-4.4.1.x64.macosx.zip source embree-4.4.1.x64.macosx/embree-vars.shIf you want to ship Embree with your application, please use the Embree
library of the provided ZIP file. The library name of that Embree
library is of the form @rpath/libembree.4.dylib
(and similar also for the included TBB library). This ensures that you
can add a relative RPATH to your application that points to the location
where Embree (and TBB) can be found, e.g. @loader_path/../lib.
The most convenient way to build an Embree application is through
CMake. Just let CMake find your unpacked Embree package using the
FIND_PACKAGE function inside your CMakeLists.txt file:
FIND_PACKAGE(embree 4 REQUIRED)For CMake to properly find Embree you need to set the embree_DIR variable to
the folder containing the embree_config.cmake file. You might also have to
set the TBB_DIR variable to the path containing TBB-config.cmake of a local
TBB install, in case you do not have TBB installed globally on your system,
e.g:
cmake -D embree_DIR=path_to_embree_package/lib/cmake/embree-4.4.1/ \
-D TBB_DIR=path_to_tbb_package/lib/cmake/tbb/ \
..The FIND_PACKAGE function will create an embree target that
you can add to your target link libraries:
TARGET_LINK_LIBRARIES(application embree)For a full example on how to build an Embree application please have a
look at the minimal tutorial provided in the src folder of the
Embree package and also the contained README.txt file.
Building Embree SYCL applications is also best done using CMake. Please first get some compatible SYCL compiler and setup the environment as decribed in sections [Linux SYCL Compilation] and [Windows SYCL Compilation].
Also perform the setup steps from the previous [Building Embree Applications] section.
Please also have a look at the [Minimal] tutorial that is provided with the Embree release, for an example how to build a simple SYCL application using CMake and Embree.
To properly compile your SYCL application you have to add additional SYCL compile flags for each C++ file that contains SYCL device side code or kernels as described next.
We recommend using just in time compilation (JIT compilation) together with [SYCL JIT caching] to compile Embree SYCL applications. For JIT compilation add these options to the compilation phase of all C++ files that contain SYCL code:
-fsycl -Xclang -fsycl-allow-func-ptr -fsycl-targets=spir64These options enable SYCL two phase compilation (-fsycl option),
enable function pointer support (-Xclang -fsycl-allow-func-ptr
option), and just in time (JIT) compilation only
(-fsycl-targets=spir64 option).
The following link options have to get added to the linking stage of your application when using just in time compilation:
-fsycl -fsycl-targets=spir64For a full example on how to build an Embree SYCL application please
have a look at the SYCL version of the minimal tutorial provided in
the src folder of the Embree package and also the contained
README.txt file.
Please have a look at the [Compiling Embree] section on how to create an Embree package from sources if required.
Ahead of time compilation (AOT compilation) allows to speed up first application start up time as device binaries are precompiled. We do not recommend using AOT compilation as it does not allow the usage of specialization constants to reduce code complexity.
For ahead of time compilation add these compile options to the compilation phase of all C++ files that contain SYCL code:
-fsycl -Xclang -fsycl-allow-func-ptr -fsycl-targets=spir64_genThese options enable SYCL two phase compilation (-fsycl option),
enable function pointer support (-Xclang -fsycl-allow-func-ptr
option), and ahead of time (AOT) compilation
(-fsycl-targets=spir64_gen option).
The following link options have to get added to the linking stage of your application when compiling ahead of time for Xe HPG devices:
-fsycl -fsycl-targets=spir64_gen
-Xsycl-target-backend=spir64_gen "-device XE_HPG_CORE"This in particular configures the devices for AOT compilation to
XE_HPG_CORE.
To get a list of all device supported by AOT compilation look at the help of the device option in ocloc tool:
ocloc compile --helpEmbree is released with a bundle of tests in an optional testing package. To run these tests extract the testing package in the same folder as your embree installation. e.g.:
tar -xzf embree-4.4.1-testing.zip -C /path/to/installed/embreeThe tests are extracted into a new folder inside you embree installation and can be run with:
cd /path/to/installed/embree/testing
cmake -B build
cmake --build build target=testsWe recommend using the prebuild Embree packages from https://github.com/embree/embree/releases. If you need to compile Embree yourself you need to use CMake as described in the following.
Do not enable fast-math optimizations in your compiler as this mode is not supported by Embree.
To compile Embree you need a modern C++ compiler that supports C++11. Embree is tested with the following compilers:
Linux
macOS x86_64
macOS Arm64
Embree supports using the Intel® Threading Building Blocks (TBB) as the
tasking system. For performance and flexibility reasons we recommend
using 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 EMBREE_TASKING_SYSTEM CMake variable.
Embree supports the Intel® Implicit SPMD
No open issues yet, or sync has not completed.