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
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 windows size using the
-size command line parameter, or start the tutorials in fullscreen using the
./triangle_geometry -size 1024 1024 ./triangle_geometry -fullscreen
Implementation specific parameters 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
rtcOccluded 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 deformed spheres. Half of the spheres use the
RTC_GEOMETRY_DEFORMABLE flag, which allows Embree to use a refitting strategy for these spheres, the other half uses the
RTC_GEOMETRY_DYNAMIC flag, causing a 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 kind. 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. Demonstrated is also 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 demonstrates 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 build 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, building 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. Per default the edge tessellation level is set adaptively based on the distance to the camera origin. Embree currently supports three different modes for efficiently handling subdivision surfaces in various rendering scenarios. These three modes can be selected at the command line, e.g.
-lazy builds internal per subdivision patch data structures on demand,
-cache uses a small (per thread) tessellation cache for caching per patch data, and
-pregenerate to generate and store most per patch data during the initial build process. The
cache mode is most effective for coherent rays while providing a fixed memory footprint. The
pregenerate modes is most effective for incoherent ray distributions while requiring more memory. The
lazy mode works similar to the
pregenerate mode but provides a middle ground in terms of memory consumption as it only builds and stores data only when the corresponding patch is accessed during the ray traversal. The
cache mode is currently a bit more efficient at handling dynamic scenes where only the edge tessellation levels are changing per frame.
This tutorial demonstrates the use of Catmull Clark subdivision surfaces with procedural displacement mapping using a constant edge tessellation level.
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, bezier 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 and 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 Mac OS X the tutorial finds the Embree installation automatically, under Windows the
embree_DIR CMake variable has to be set to the following folder of the Embree installation:
C:\Program Files\Intel\Embree X.Y.Z\lib\cmake\embree-X.Y.Z.