Embree
Embree ray tracing kernels repository.
Install / Use
/learn @RenderKit/EmbreeREADME
% Embree: High Performance Ray Tracing Kernels 4.4.1 % Intel Corporation
Intel® Embree Overview
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.
Supported Platforms
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.
Embree Support and Contact
If you encounter bugs please report them via Embree's GitHub Issue Tracker.
For questions and feature requests please write us at embree_support@intel.com.
To receive notifications of updates and new features of Embree please subscribe to the Embree mailing list.
Installation of Embree
Windows Installation
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.
Linux Installation
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.sh
We recommend adding a relative RPATH to your application that points
to the location where Embree (and TBB) can be found, e.g. $ORIGIN/../lib.
macOS Installation
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.sh
If 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.
Building Embree Applications
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
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.
JIT Compilation
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=spir64
These 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=spir64
For 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.
AOT Compilation
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_gen
These 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
Related Skills
node-connect
326.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
80.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
326.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
80.4kCommit, push, and open a PR
