Embree comes with a set of tutorials aimed at helping users understand how Embree can be used and extended. All tutorials exist in an ISPC and C++ version to demonstrate the two versions of the API. Look for files named
tutorialname_device.ispc for the ISPC implementation of the tutorial, and files named
tutorialname_device.cpp for the single ray C++ version of the tutorial. To start the C++ version use the
tutorialname executables, to start the ISPC version use the
tutorialname_ispc executables. All tutorials can print available command line options using the
--help command line parameter.
For all tutorials, you can select an initial camera using the
--vp (camera position),
--vi (camera look-at point),
--vu (camera up vector), and
--fov (vertical field of view) command line parameters:
./triangle_geometry --vp 10 10 10 --vi 0 0 0
You can select the initial window size using the
--size command line parameter, or start the tutorials in full screen using the
./triangle_geometry --size 1024 1024 ./triangle_geometry --fullscreen
The initialization string for the Embree device (
rtcNewDevice call) can be passed to the ray tracing core through the
--rtcore command line parameter, e.g.:
./triangle_geometry --rtcore verbose=2,threads=1,accel=bvh4.triangle1
The navigation in the interactive display mode follows the camera orbit model, where the camera revolves around the current center of interest. With the left mouse button you can rotate around the center of interest (the point initially set with
--vi). Holding Control pressed while clicking the left mouse button rotates the camera around its location. You can also use the arrow keys for navigation.
You can use the following keys:
- Default shading
- Gray EyeLight shading
- Traces occlusion rays only.
- UV Coordinate visualization
- Geometry normal visualization
- Geometry ID visualization
- Geometry ID and Primitive ID visualization
- Simple shading with 16 rays per pixel for benchmarking.
- Switches to render cost visualization. Pressing again reduces brightness.
- Switches to render cost visualization. Pressing again increases brightness.
- Enters or leaves full screen mode.
- Prints camera parameters.
- Exits the tutorial.
- Exits the tutorial.
This tutorial demonstrates the creation of a static cube and ground plane using triangle meshes. It also demonstrates the use of the
rtcOccluded1 functions to render primary visibility and hard shadows. The cube sides are colored based on the ID of the hit primitive.
This tutorial demonstrates the creation of a dynamic scene, consisting of several deforming spheres. Half of the spheres use the
RTC_BUILD_QUALITY_REFIT geometry build quality, which allows Embree to use a refitting strategy for these spheres, the other half uses the
RTC_BUILD_QUALITY_LOW geometry build quality, causing a high performance rebuild of their spatial data structure each frame. The spheres are colored based on the ID of the hit sphere geometry.
This tutorial shows the use of user-defined geometry, to re-implement instancing, and to add analytic spheres. A two-level scene is created, with a triangle mesh as ground plane, and several user geometries that instance other scenes with a small number of spheres of different kinds. The spheres are colored using the instance ID and geometry ID of the hit sphere, to demonstrate how the same geometry instanced in different ways can be distinguished.
This tutorial demonstrates a simple OBJ viewer that traces primary visibility rays only. A scene consisting of multiple meshes is created, each mesh sharing the index and vertex buffer with the application. It also demonstrates how to support additional per-vertex data, such as shading normals.
You need to specify an OBJ file at the command line for this tutorial to work:
./viewer -i model.obj
This tutorial is a simple OBJ viewer that demonstrates the use of ray streams. You need to specify an OBJ file at the command line for this tutorial to work:
./viewer_stream -i model.obj
This tutorial demonstrates the in-build instancing feature of Embree, by instancing a number of other scenes built from triangulated spheres. The spheres are again colored using the instance ID and geometry ID of the hit sphere, to demonstrate how the same geometry instanced in different ways can be distinguished.
This tutorial demonstrates the use of filter callback functions to efficiently implement transparent objects. The filter function used for primary rays lets the ray pass through the geometry if it is entirely transparent. Otherwise, the shading loop handles the transparency properly, by potentially shooting secondary rays. The filter function used for shadow rays accumulates the transparency of all surfaces along the ray, and terminates traversal if an opaque occluder is hit.
This tutorial is a simple path tracer, based on the viewer tutorial.
You need to specify an OBJ file and light source at the command line for this tutorial to work:
./pathtracer -i model.obj --ambientlight 1 1 1
To render these models execute the following:
./pathtracer -c crown/crown.ecs ./pathtracer -c asian_dragon/asian_dragon.ecs
This tutorial demonstrates the use of the hair geometry to render a hairball.
This tutorial demonstrates the use of the Bézier curve geometry.
This tutorial demonstrates the use of Catmull-Clark subdivision surfaces.
This tutorial demonstrates the use of Catmull-Clark subdivision surfaces with procedural displacement mapping using a constant edge tessellation level.
This tutorial demonstrates the use of the memory efficient grid primitive to handle highly tessellated and displaced geometry.
Motion Blur Geometry
This tutorial demonstrates rendering of motion blur using the multi-segment motion blur feature. Shown is motion blur of a triangle mesh, quad mesh, subdivision surface, line segments, hair geometry, Bézier curves, instantiated triangle mesh where the instance moves, instantiated quad mesh where the instance and the quads move, and user geometry.
The number of time steps used can be configured using the
--time-steps <int> and
--time-steps2 <int> command line parameters, and the geometry can be rendered at a specific time using the the
--time <float> command line parameter.
This tutorial demonstrates interpolation of user-defined per-vertex data.
This tutorial demonstrates how to use the templated hierarchy builders of Embree to build a bounding volume hierarchy with a user-defined memory layout using a high-quality SAH builder using spatial splits, a standard SAH builder, and a very fast Morton builder.
This tutorial demonstrates how to access the internal triangle acceleration structure build by Embree. Please be aware that the internal Embree data structures might change between Embree updates.
This tutorial demonstrates how to use the
FIND_PACKAGE CMake feature to use an installed Embree. Under Linux and macOS the tutorial finds the Embree installation automatically, under Windows the
embree_DIR CMake variable must be set to the following folder of the Embree installation: