rtcSetGeometryBoundsFunction

title: rtcSetGeometryBoundsFunction(4embree4)

text:
# rtcSetGeometryBoundsFunction(4embree4)

### NAME

```
rtcSetGeometryBoundsFunction - sets a callback to query the

  bounding box of user-defined primitives

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCBoundsFunctionArguments
{

  void* geometryUserPtr;

  unsigned int primID;

  unsigned int timeStep;

  struct RTCBounds* bounds_o;
};
typedef void (*RTCBoundsFunction)(

  const struct RTCBoundsFunctionArguments* args
);
void rtcSetGeometryBoundsFunction(

  RTCGeometry geometry,

  RTCBoundsFunction bounds,

  void* userPtr
);

```

### DESCRIPTION
The rtcSetGeometryBoundsFunction function registers a bounding box callback function (bounds argument) with payload (userPtr argument) for the specified user geometry (geometry argument).

Only a single callback function can be registered per geometry, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

In SYCL mode the BVH construction is done on the host and the passed function pointer must be a host-side function pointer.

The registered bounding box callback function is invoked to calculate axis-aligned bounding boxes of the primitives of the user-defined geometry during spatial acceleration structure construction. The bounding box callback of RTCBoundsFunction type is invoked with a pointer to a structure of type RTCBoundsFunctionArguments which contains various arguments, such as: the user data of the geometry (geometryUserPtr member), the ID of the primitive to calculate the bounds for (primID member), the time step at which to calculate the bounds (timeStep member), and a memory location to write the calculated bound to (bounds_o member).

In a typical usage scenario one would store a pointer to the internal representation of the user geometry object using rtcSetGeometryUserData. The callback function can then read that pointer from the geometryUserPtr field and calculate the proper bounding box for the requested primitive and time, and store that bounding box to the destination structure (bounds_o member).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_USER]


rtcSetGeometryBuffer

package: embree-devel

title: rtcSetGeometryBuffer(4embree4)

text:
# rtcSetGeometryBuffer(4embree4)

### NAME

```
rtcSetGeometryBuffer - assigns a view of a buffer to the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryBuffer(

  RTCGeometry geometry,

  enum RTCBufferType type,

  unsigned int slot,

  enum RTCFormat format,

  RTCBuffer buffer,

  size_t byteOffset,

  size_t byteStride,

  size_t itemCount
);

```

### DESCRIPTION
The rtcSetGeometryBuffer function binds a view of a buffer object (buffer argument) to a geometry buffer type and slot (type and slot argument) of the specified geometry (geometry argument).

One can specify the start of the first buffer element in bytes (byteOffset argument), the byte stride between individual buffer elements (byteStride argument), the format of the buffer elements (format argument), and the number of elements to bind (itemCount).

The start address (byteOffset argument) and stride (byteStride argument) must be both aligned to 4 bytes, otherwise the rtcSetGeometryBuffer function will fail.

After successful completion of this function, the geometry will hold a reference to the buffer object.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetSharedGeometryBuffer], [rtcSetNewGeometryBuffer]


rtcSetGeometryBuildQuality

title: rtcSetGeometryBuildQuality(4embree4)

text:
# rtcSetGeometryBuildQuality(4embree4)

### NAME

```
rtcSetGeometryBuildQuality - sets the build quality for the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryBuildQuality(

  RTCGeometry geometry,

  enum RTCBuildQuality quality
);

```

### DESCRIPTION
The rtcSetGeometryBuildQuality function sets the build quality (quality argument) for the specified geometry (geometry argument). The per-geometry build quality is only a hint and may be ignored. Embree currently uses the per-geometry build quality when the scene build quality is set to RTC_BUILD_QUALITY_LOW. In this mode a two-level acceleration structure is build, and geometries build a separate acceleration structure using the geometry build quality. The per-geometry build quality can be one of:

•

RTC_BUILD_QUALITY_LOW: Creates lower quality data structures, e.g. for dynamic scenes.

•

RTC_BUILD_QUALITY_MEDIUM: Default build quality for most usages. Gives a good compromise between build and render performance.

•

RTC_BUILD_QUALITY_HIGH: Creates higher quality data structures for final-frame rendering. Enables a spatial split builder for certain primitive types.

•

RTC_BUILD_QUALITY_REFIT: Uses a BVH refitting approach when changing only the vertex buffer.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetSceneBuildQuality]


rtcSetGeometryDisplacementFunction

text:
# rtcSetGeometryDisplacementFunction(4embree4)

### NAME

```
rtcSetGeometryDisplacementFunction - sets the displacement function

  for a subdivision geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCDisplacementFunctionNArguments
{

  void* geometryUserPtr;

  RTCGeometry geometry;

  unsigned int primID;

  unsigned int timeStep;

  const float* u;

  const float* v;

  const float* Ng_x;

  const float* Ng_y;

  const float* Ng_z;

  float* P_x;

  float* P_y;

  float* P_z;

  unsigned int N;
};
typedef void (*RTCDisplacementFunctionN)(

   const struct RTCDisplacementFunctionNArguments* args
);
void rtcSetGeometryDisplacementFunction(

  RTCGeometry geometry,

  RTCDisplacementFunctionN displacement
);

```

### DESCRIPTION
The rtcSetGeometryDisplacementFunction function registers a displacement callback function (displacement argument) for the specified subdivision geometry (geometry argument).

Only a single callback function can be registered per geometry, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

The registered displacement callback function is invoked to displace points on the subdivision geometry during spatial acceleration structure construction, during the rtcCommitScene call.

The callback function of type RTCDisplacementFunctionN is invoked with a number of arguments stored inside the RTCDisplacementFunctionNArguments structure. The provided user data pointer of the geometry (geometryUserPtr member) can be used to point to the application’s representation of the subdivision mesh. A number N of points to displace are specified in a structure of array layout. For each point to displace, the local patch UV coordinates (u and v arrays), the normalized geometry normal (Ng_x, Ng_y, and Ng_z arrays), and the position (P_x, P_y, and P_z arrays) are provided. The task of the displacement function is to use this information and change the position data.

The geometry handle (geometry member) and primitive ID (primID member) of the patch to displace are additionally provided as well as the time step timeStep, which can be important if the displacement is time-dependent and motion blur is used.

All passed arrays must be aligned to 64 bytes and properly padded to make wide vector processing inside the displacement function easily possible.

Also see tutorial [Displacement Geometry] for an example of how to use the displacement mapping functions.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_SUBDIVISION]


text:
# rtcSetGeometryEnableFilterFunctionFromArguments(4embree4)

### NAME

```
rtcSetGeometryEnableFilterFunctionFromArguments - enables

  argument filter functions for the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryEnableFilterFunctionFromArguments(

   RTCGeometry geometry, bool enable);

```

### DESCRIPTION
This function enables invokation the filter function passed through RTCIntersectArguments or RTCOccludedArguments to the intersect and occluded queries. If enable is true the argument filter function invokation is enabled for the geometry or disabled otherwise. By default the invokation of the argument filter function is disabled for some geometry.

The argument filter function invokation can also get enforced for each geometry by using the RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER ray query flag that can get passed to rtcIntersect and rtcOccluded functions. See Section [rtcInitIntersectArguments] and [rtcInitOccludedArguments] for more details.

In order to use the argument filter function for some scene, that feature additionally has to get enabled using the RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS scene flag. See Section [rtcSetSceneFlags] for more details.

### EXIT STATUS
On failure an error code is set that can get queried using rtcGetDeviceError.

### SEE ALSO
[rtcInitIntersectArguments], [rtcInitOccludedArguments], [rtcSetSceneFlags]


rtcSetGeometryInstancedScene

title: rtcSetGeometryInstancedScene(4embree4)

text:
# rtcSetGeometryInstancedScene(4embree4)

### NAME

```
rtcSetGeometryInstancedScene - sets the instanced scene of

  an instance geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryInstancedScene(

  RTCGeometry geometry,

  RTCScene scene
);

```

### DESCRIPTION
The rtcSetGeometryInstancedScene function sets the instanced scene (scene argument) of the specified instance geometry (geometry argument).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_INSTANCE], [rtcSetGeometryTransform]


rtcSetGeometryInstancedScenes

title: rtcSetGeometryInstancedScenes(4embree4)

text:
# rtcSetGeometryInstancedScenes(4embree4)

### NAME

```
rtcSetGeometryInstancedScenes - sets an array of scenes that can be
instanced by an instance array geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryInstancedScenes(

  RTCGeometry geometry,

  RTCScene* scene,

  size_t numScenes
);

```

### DESCRIPTION
The rtcSetGeometryInstancedScenes function sets an array of type RTCScene with numScenes elements that the specified instance geometry (geometry argument) can instance. This call also requires setting an index buffer using either rtcSetSharedGeometryBuffer or rtcSetNewGeometryBuffer (similar to index buffers for triangle meshes), that specifies which instance of the instance array instances which scene in the scene array. If only one scene should be instanced the call rtcSetGeometryInstancedScene should be preferred.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_INSTANCE_ARRAY], [rtcSetNewGeometryBuffer], [rtcSetSharedGeometryBuffer], [rtcSetGeometryInstancedScene]


rtcSetGeometryIntersectFilterFunction

text:
# rtcSetGeometryIntersectFilterFunction(4embree4)

### NAME

```
rtcSetGeometryIntersectFilterFunction - sets the intersection filter

  for the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCFilterFunctionNArguments
{

  int* valid;

  void* geometryUserPtr;

  const struct RTCRayQueryContext* context;

  struct RTCRayN* ray;

  struct RTCHitN* hit;

  unsigned int N;
};
typedef void (*RTCFilterFunctionN)(

  const struct RTCFilterFunctionNArguments* args
);
void rtcSetGeometryIntersectFilterFunction(

  RTCGeometry geometry,

  RTCFilterFunctionN filter
);

```

### DESCRIPTION
The rtcSetGeometryIntersectFilterFunction function registers an intersection filter callback function (filter argument) for the specified geometry (geometry argument).

Only a single callback function can be registered per geometry, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

The registered intersection filter function is invoked for every hit encountered during the rtcIntersect-type ray queries and can accept or reject that hit. The feature can be used to define a silhouette for a primitive and reject hits that are outside the silhouette. E.g. a tree leaf could be modeled with an alpha texture that decides whether hit points lie inside or outside the leaf.

If the RTC_BUILD_QUALITY_HIGH mode is set, the filter functions may be called multiple times for the same primitive hit. Further, rays hitting exactly the edge might also report two hits for the same surface. For certain use cases, the application may have to work around this limitation by collecting already reported hits (geomID/primID pairs) and ignoring duplicates.

The filter function callback of type RTCFilterFunctionN gets passed a number of arguments through the RTCFilterFunctionNArguments structure. The valid parameter of that structure points to an integer valid mask (0 means invalid and -1 means valid). The geometryUserPtr member is a user pointer optionally set per geometry through the rtcSetGeometryUserData function. The context member points to the ray query context passed to the ray query function. The ray parameter points to N rays in SOA layout. The hit parameter points to N hits in SOA layout to test. The N parameter is the number of rays and hits in ray and hit. The hit distance is provided as the tfar value of the ray. If the hit geometry is instanced, the instID member of the ray is valid, and the ray and the potential hit are in object space.

The filter callback function has the task to check for each valid ray whether it wants to accept or reject the corresponding hit. To reject a hit, the filter callback function just has to write 0 to the integer valid mask of the corresponding ray. To accept the hit, it just has to leave the valid mask set to -1. When accepting a hit, the filter function is further allowed to change the hit and decrease the tfar value of the ray but it should not modify other ray data nor any inactive components of the ray or hit.

```

```

The implementation of the filter function can choose to implement a single code path that uses the ray access helper functions RTCRay_XXX and hit access helper functions RTCHit_XXX to access ray and hit data. Alternatively the code can branch to optimized implementations for specific sizes of N and cast the ray and hit inputs to the proper packet types.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryOccludedFilterFunction]


rtcSetGeometryIntersectFunction

text:
# rtcSetGeometryIntersectFunction(4embree4)

### NAME

```
rtcSetGeometryIntersectFunction - sets the callback function to

  intersect a user geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCIntersectFunctionNArguments
{

  int* valid;

  void* geometryUserPtr;

  unsigned int primID;

  struct RTCRayQueryContext* context;

  struct RTCRayHitN* rayhit;

  unsigned int N;

  unsigned int geomID;
};
typedef void (*RTCIntersectFunctionN)(

  const struct RTCIntersectFunctionNArguments* args
);
void rtcSetGeometryIntersectFunction(

  RTCGeometry geometry,

  RTCIntersectFunctionN intersect
);

```

### DESCRIPTION
The rtcSetGeometryIntersectFunction function registers a ray/primitive intersection callback function (intersect argument) for the specified user geometry (geometry argument).

Only a single callback function can be registered per geometry and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

The registered callback function is invoked by rtcIntersect-type ray queries to calculate the intersection of a ray packet of variable size with one user-defined primitive. The callback function of type RTCIntersectFunctionN gets passed a number of arguments through the RTCIntersectFunctionNArguments structure. The value N specifies the ray packet size, valid points to an array of integers that specify whether the corresponding ray is valid (-1) or invalid (0), the geometryUserPtr member points to the geometry user data previously set through rtcSetGeometryUserData, the context member points to the ray query context passed to the ray query, the rayhit member points to a ray and hit packet of variable size N, and the geomID and primID member identifies the geometry ID and primitive ID of the primitive to intersect.

The ray component of the rayhit structure contains valid data, in particular the tfar value is the current closest hit distance found. All data inside the hit component of the rayhit structure are undefined and should not be read by the function.

The task of the callback function is to intersect each active ray from the ray packet with the specified user primitive. If the user-defined primitive is missed by a ray of the ray packet, the function should return without modifying the ray or hit. If an intersection of the user-defined primitive with the ray was found in the valid range (from tnear to tfar), it should update the hit distance of the ray (tfar member) and the hit (u, v, Ng, instID, geomID, primID members). In particular, the currently intersected instance is stored in the instID field of the ray query context, which must be deep copied into the instID member of the hit.

As a primitive might have multiple intersections with a ray, the intersection filter function needs to be invoked by the user geometry intersection callback for each encountered intersection, if filtering of intersections is desired. This can be achieved through the rtcInvokeIntersectFilterFromGeometry call.

Within the user geometry intersect function, it is safe to trace new rays and create new scenes and geometries.

```

```

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryOccludedFunction], [rtcSetGeometryUserData], [rtcInvokeIntersectFilterFromGeometry]


rtcSetGeometryMask

title: rtcSetGeometryMask(4embree4)

text:
# rtcSetGeometryMask(4embree4)

### NAME

```
rtcSetGeometryMask - sets the geometry mask

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryMask(

  RTCGeometry geometry,

  unsigned int mask
);

```

### DESCRIPTION
The rtcSetGeometryMask function sets a 32-bit geometry mask (mask argument) for the specified geometry (geometry argument).

This geometry mask is used together with the ray mask stored inside the mask field of the ray. The primitives of the geometry are hit by the ray only if the bitwise and operation of the geometry mask with the ray mask is not 0. This feature can be used to disable selected geometries for specifically tagged rays, e.g. to disable shadow casting for certain geometries.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTCRay], [rtcGetDeviceProperty]


rtcSetGeometryMaxRadiusScale

title: rtcSetGeometryMaxRadiusScale(4embree4)

text:
# rtcSetGeometryMaxRadiusScale(4embree4)

### NAME

```
rtcSetGeometryMaxRadiusScale - assigns a maximal curve radius scale factor for min-width feature

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryMaxRadiusScale(RTCGeometry geometry, float maxRadiusScale);

```

### DESCRIPTION
The rtcSetMaxGeometryScale function specifies a maximal scaling factor for curve radii used by the min-width feature.

The min-width feature can increase the radius of curves and points, in order to reduce aliasing and improve render times. The feature is disabled by default and has to get enabled using the EMBREE_MIN_WIDTH cmake option.

To use the feature, one has to specify a maximal curve radius scaling factor using the [rtcSetGeometryMaxRadiusScale] function. This factor should be a small number (e.g. 4) as the constructed BVH bounds get increased in order to bound the curve in the worst case of maximal radii.

One also has to set the minWidthDistanceFactor in the RTCRayQueryContext when tracing a ray. This factor controls the target radius size of a curve or point at some distance away of the ray origin.

For each control point p with radius r of a curve or point primitive, the primitive intersectors first calculate a target radius r’ as:

```
r' = length(p-ray_org) * minWidthDistanceFactor

```

Typically the minWidthDistanceFactor is set by the application such that the target radius projects to the width of half a pixel (thus primitive diameter is pixel sized).

The target radius r’ is then clamped against the minimal bound r and maximal bound maxRadiusScale*r to obtain the final radius r’’:

```
r'' = max(r, min(r', maxRadiusScale*r))

```

Thus curves or points close to the camera are rendered with a normal radii r, and curves or points far from the camera are not enlarged too much, as this would be very expensive to render.

When rtcSetGeometryMaxRadiusScale function is not invoked for a curve or point geometry (or if the maximal scaling factor is set to 1.0), then the curve or point geometry renders normally, with radii not modified by the min-width feature.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcInitRayQueryContext]


rtcSetGeometryOccludedFilterFunction

text:
# rtcSetGeometryOccludedFilterFunction(4embree4)

### NAME

```
rtcSetGeometryOccludedFilterFunction - sets the occlusion filter

  for the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryOccludedFilterFunction(

  RTCGeometry geometry,

  RTCFilterFunctionN filter
);

```

### DESCRIPTION
The rtcSetGeometryOccludedFilterFunction function registers an occlusion filter callback function (filter argument) for the specified geometry (geometry argument).

Only a single callback function can be registered per geometry, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

The registered occlusion filter function is invoked for every hit encountered during the rtcOccluded-type ray queries and can accept or reject that hit. The feature can be used to define a silhouette for a primitive and reject hits that are outside the silhouette. E.g. a tree leaf could be modeled with an alpha texture that decides whether hit points lie inside or outside the leaf.

Please see the description of the rtcSetGeometryIntersectFilterFunction for a description of the filter callback function.

The rtcOccluded-type functions terminate traversal when a hit got committed. As filter functions can only set the tfar distance of the ray for a committed hit, the occlusion filter cannot influence the tfar value of subsequent traversal, as that directly ends. For that reason rtcOccluded and occlusion filters cannot get used to gather the next n-hits, and rtcIntersect and intersection filters should get used instead.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryIntersectFilterFunction]


rtcSetGeometryOccludedFunction

text:
# rtcSetGeometryOccludedFunction(4embree4)

### NAME

```
rtcSetGeometryOccludedFunction - sets the callback function to

  test a user geometry for occlusion

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCOccludedFunctionNArguments
{

  int* valid;

  void* geometryUserPtr;

  unsigned int primID;

  struct RTCRayQueryContext* context;

  struct RTCRayN* ray;

  unsigned int N;

  unsigned int geomID;
};
typedef void (*RTCOccludedFunctionN)(

  const struct RTCOccludedFunctionNArguments* args
);
void rtcSetGeometryOccludedFunction(

  RTCGeometry geometry,

  RTCOccludedFunctionN filter
);

```

### DESCRIPTION
The rtcSetGeometryOccludedFunction function registers a ray/primitive occlusion callback function (filter argument) for the specified user geometry (geometry argument).

Only a single callback function can be registered per geometry, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

The registered callback function is invoked by rtcOccluded-type ray queries to test whether the rays of a packet of variable size are occluded by a user-defined primitive. The callback function of type RTCOccludedFunctionN gets passed a number of arguments through the RTCOccludedFunctionNArguments structure. The value N specifies the ray packet size, valid points to an array of integers which specify whether the corresponding ray is valid (-1) or invalid (0), the geometryUserPtr member points to the geometry user data previously set through rtcSetGeometryUserData, the context member points to the ray query context passed to the ray query, the ray member points to a ray packet of variable size N, and the geomID and primID member identifies the geometry ID and primitive ID of the primitive to intersect.

The task of the callback function is to intersect each active ray from the ray packet with the specified user primitive. If the user-defined primitive is missed by a ray of the ray packet, the function should return without modifying the ray. If an intersection of the user-defined primitive with the ray was found in the valid range (from tnear to tfar), it should set the tfar member of the ray to -inf.

As a primitive might have multiple intersections with a ray, the occlusion filter function needs to be invoked by the user geometry occlusion callback for each encountered intersection, if filtering of intersections is desired. This can be achieved through the rtcInvokeOccludedFilterFromGeometry call.

Within the user geometry occlusion function, it is safe to trace new rays and create new scenes and geometries.

```

```

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryIntersectFunction], [rtcSetGeometryUserData], [rtcInvokeOccludedFilterFromGeometry]


rtcSetGeometryPointQueryFunction

text:
# rtcSetGeometryPointQueryFunction(4embree4)

### NAME

```
rtcSetGeometryPointQueryFunction - sets the point query callback function

  for a geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCPointQueryFunctionArguments
{

  // the (world space) query object that was passed as an argument of rtcPointQuery.

  struct RTCPointQuery* query;

  // used for user input/output data. Will not be read or modified internally.

  void* userPtr;

  // primitive and geometry ID of primitive

  unsigned int  primID;

  unsigned int  geomID;

  // the context with transformation and instance ID stack

  struct RTCPointQueryContext* context;

  // scaling factor indicating whether the current instance transformation

  // is a similarity transformation.

  float similarityScale;
};
typedef bool (*RTCPointQueryFunction)(

  struct RTCPointQueryFunctionArguments* args
);
void rtcSetGeometryPointQueryFunction(

  RTCGeometry geometry,

  RTCPointQueryFunction queryFunc
);

```

### DESCRIPTION
The rtcSetGeometryPointQueryFunction function registers a point query callback function (queryFunc argument) for the specified geometry (geometry argument).

Only a single callback function can be registered per geometry and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

The registered callback function is invoked by [rtcPointQuery] for every primitive of the geometry that intersects the corresponding point query domain. The callback function of type RTCPointQueryFunction gets passed a number of arguments through the RTCPointQueryFunctionArguments structure. The query object is the original point query object passed into [rtcPointQuery], usrPtr is an arbitrary pointer to pass input into and store results of the callback function. The primID, geomID and context (see [rtcInitPointQueryContext] for details) can be used to identify the geometry data of the primitive.

A RTCPointQueryFunction can also be passed directly as an argument to [rtcPointQuery]. In this case the callback is invoked for all primitives in the scene that intersect the query domain. If a callback function is passed as an argument to [rtcPointQuery] and (a potentially different) callback function is set for a geometry with [rtcSetGeometryPointQueryFunction] both callback functions are invoked and the callback function passed to [rtcPointQuery] will be called before the geometry specific callback function.

If instancing is used, the parameter simliarityScale indicates whether the current instance transform (top element of the stack in context) is a similarity transformation or not. Similarity transformations are composed of translation, rotation and uniform scaling and if a matrix M defines a similarity transformation, there is a scaling factor D such that for all x,y: dist(Mx, My) = D * dist(x, y). In this case the parameter scalingFactor is this scaling factor D and otherwise it is 0. A valid similarity scale (similarityScale > 0) allows to compute distance information in instance space and scale the distances into world space (for example, to update the query radius, see below) by dividing the instance space distance with the similarity scale. If the current instance transform is not a similarity transform (similarityScale is 0), the distance computation has to be performed in world space to ensure correctness. In this case the instance to world transformations given with the context should be used to transform the primitive data into world space. Otherwise, the query location can be transformed into instance space which can be more efficient. If there is no instance transform, the similarity scale is 1.

The callback function will potentially be called for primitives outside the query domain for two reasons: First, the callback is invoked for all primitives inside a BVH leaf node since no geometry data of primitives is determined internally and therefore individual primitives are not culled (only their (aggregated) bounding boxes). Second, in case non similarity transformations are used, the resulting ellipsoidal query domain (in instance space) is approximated by its axis aligned bounding box internally and therefore inner nodes that do not intersect the original domain might intersect the approximative bounding box which results in unnecessary callbacks. In any case, the callbacks are conservative, i.e. if a primitive is inside the query domain a callback will be invoked but the reverse is not necessarily true.

For efficiency, the radius of the query object can be decreased (in world space) inside the callback function to improve culling of geometry during BVH traversal. If the query radius was updated, the callback function should return true to issue an update of internal traversal information. Increasing the radius or modifying the time or position of the query results in undefined behaviour.

Within the callback function, it is safe to call [rtcPointQuery] again, for example when implementing instancing manually. In this case the instance transformation should be pushed onto the stack in context. Embree will internally compute the point query information in instance space using the top element of the stack in context when [rtcPointQuery] is called.

For a reference implementation of a closest point traversal of triangle meshes using instancing and user defined instancing see the tutorial [ClosestPoint].

### SEE ALSO
[rtcPointQuery], [rtcInitPointQueryContext]


rtcSetGeometrySubdivisionMode

title: rtcSetGeometrySubdivisionMode(4embree4)

text:
# rtcSetGeometrySubdivisionMode(4embree4)

### NAME

```
rtcSetGeometrySubdivisionMode - sets the subdivision mode

  of a subdivision geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometrySubdivisionMode(

  RTCGeometry geometry,

  unsigned int topologyID,

  enum RTCSubdivisionMode mode
);

```

### DESCRIPTION
The rtcSetGeometrySubdivisionMode function sets the subdivision mode (mode parameter) for the topology (topologyID parameter) of the specified subdivision geometry (geometry parameter).

The subdivision modes can be used to force linear interpolation for certain parts of the subdivision mesh:

•

RTC_SUBDIVISION_MODE_NO_BOUNDARY: Boundary patches are ignored. This way each rendered patch has a full set of control vertices.

•

RTC_SUBDIVISION_MODE_SMOOTH_BOUNDARY: The sequence of boundary control points are used to generate a smooth B-spline boundary curve (default mode).

•

RTC_SUBDIVISION_MODE_PIN_CORNERS: Corner vertices are pinned to their location during subdivision.

•

RTC_SUBDIVISION_MODE_PIN_BOUNDARY: All vertices at the border are pinned to their location during subdivision. This way the boundary is interpolated linearly. This mode is typically used for texturing to also map texels at the border of the texture to the mesh.

•

RTC_SUBDIVISION_MODE_PIN_ALL: All vertices at the border are pinned to their location during subdivision. This way all patches are linearly interpolated.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_SUBDIVISION]


rtcSetGeometryTessellationRate

text:
# rtcSetGeometryTessellationRate(4embree4)

### NAME

```
rtcSetGeometryTessellationRate - sets the tessellation rate of the

  geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryTessellationRate(

  RTCGeometry geometry,

  float tessellationRate
);

```

### DESCRIPTION
The rtcSetGeometryTessellationRate function sets the tessellation rate (tessellationRate argument) for the specified geometry (geometry argument). The tessellation rate can only be set for flat curves and subdivision geometries. For curves, the tessellation rate specifies the number of ray-facing quads per curve segment. For subdivision surfaces, the tessellation rate specifies the number of quads along each edge.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_CURVE], [RTC_GEOMETRY_TYPE_SUBDIVISION]


rtcSetGeometryTimeRange

title: rtcSetGeometryTimeRange(4embree4)

text:
# rtcSetGeometryTimeRange(4embree4)

### NAME

```
rtcSetGeometryTimeRange - sets the time range for a motion blur geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryTimeRange(

  RTCGeometry geometry,

  float startTime,

  float endTime
);

```

### DESCRIPTION
The rtcSetGeometryTimeRange function sets a time range which defines the start (and end time) of the first (and last) time step of a motion blur geometry. The time range is defined relative to the camera shutter interval [0,1] but it can be arbitrary. Thus the startTime can be smaller, equal, or larger 0, indicating a geometry whose animation definition start before, at, or after the camera shutter opens. Similar the endTime can be smaller, equal, or larger than 1, indicating a geometry whose animation definition ends after, at, or before the camera shutter closes. The startTime has to be smaller or equal to the endTime.

The default time range when this function is not called is the entire camera shutter [0,1]. For best performance at most one time segment of the piece wise linear definition of the motion should fall outside the shutter window to the left and to the right. Thus do not set the startTime or endTime too far outside the [0,1] interval for best performance.

This time range feature will also allow geometries to appear and disappear during the camera shutter time if the specified time range is a sub range of [0,1].

Please also have a look at the rtcSetGeometryTimeStepCount function to see how to define the time steps for the specified time range.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryTimeStepCount]


rtcSetGeometryTimeStepCount

title: rtcSetGeometryTimeStepCount(4embree4)

text:
# rtcSetGeometryTimeStepCount(4embree4)

### NAME

```
rtcSetGeometryTimeStepCount - sets the number of time steps of the

  geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryTimeStepCount(

  RTCGeometry geometry,

  unsigned int timeStepCount
);

```

### DESCRIPTION
The rtcSetGeometryTimeStepCount function sets the number of time steps for multi-segment motion blur (timeStepCount parameter) of the specified geometry (geometry parameter).

For triangle meshes (RTC_GEOMETRY_TYPE_TRIANGLE), quad meshes (RTC_GEOMETRY_TYPE_QUAD), curves (RTC_GEOMETRY_TYPE_CURVE), points (RTC_GEOMETRY_TYPE_POINT), and subdivision geometries (RTC_GEOMETRY_TYPE_SUBDIVISION), the number of time steps directly corresponds to the number of vertex buffer slots available (RTC_BUFFER_TYPE_VERTEX buffer type). For these geometries, one vertex buffer per time step must be specified when creating multi-segment motion blur geometries.

For instance geometries (RTC_GEOMETRY_TYPE_INSTANCE), a transformation must be specified for each time step (see rtcSetGeometryTransform).

For user geometries, the registered bounding callback function must provide a bounding box per primitive and time step, and the intersection and occlusion callback functions should properly intersect the motion-blurred geometry at the ray time.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewGeometry], [rtcSetGeometryTimeRange]


rtcSetGeometryTopologyCount

title: rtcSetGeometryTopologyCount(4embree4)

text:
# rtcSetGeometryTopologyCount(4embree4)

### NAME

```
rtcSetGeometryTopologyCount - sets the number of topologies of

  a subdivision geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryTopologyCount(

  RTCGeometry geometry,

  unsigned int topologyCount
);

```

### DESCRIPTION
The rtcSetGeometryTopologyCount function sets the number of topologies (topologyCount parameter) for the specified subdivision geometry (geometry parameter). The number of topologies of a subdivision geometry must be greater or equal to 1.

To use multiple topologies, first the number of topologies must be specified, then the individual topologies can be configured using rtcSetGeometrySubdivisionMode and by setting an index buffer (RTC_BUFFER_TYPE_INDEX) using the topology ID as the buffer slot.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_SUBDIVISION], [rtcSetGeometrySubdivisionMode]


rtcSetGeometryTransform

title: rtcSetGeometryTransform(4embree4)

text:
# rtcSetGeometryTransform(4embree4)

### NAME

```
rtcSetGeometryTransform - sets the transformation for a particular

  time step of an instance geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryTransform(

  RTCGeometry geometry,

  unsigned int timeStep,

  enum RTCFormat format,

  const float* xfm
);

```

### DESCRIPTION
The rtcSetGeometryTransform function sets the local-to-world affine transformation (xfm parameter) of an instance geometry (geometry parameter) for a particular time step (timeStep parameter). The transformation is specified as a 3×4 matrix (3×3 linear transformation plus translation), for which the following formats (format parameter) are supported:

•

RTC_FORMAT_FLOAT3X4_ROW_MAJOR: The 3×4 float matrix is laid out in row-major form.

•

RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form.

•

RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form as a 4×4 homogeneous matrix with the last row being equal to (0, 0, 0, 1).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_INSTANCE]


rtcSetGeometryTransformQuaternion

text:
# rtcSetGeometryTransformQuaternion(4embree4)

### NAME

```
rtcSetGeometryTransformQuaternion - sets the transformation for a particular

  time step of an instance geometry as a decomposition of the

  transformation matrix using quaternions to represent the rotation.

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryTransformQuaternion(

  RTCGeometry geometry,

  unsigned int timeStep,

  const struct RTCQuaternionDecomposition* qd
);

```

### DESCRIPTION
The rtcSetGeometryTransformQuaternion function sets the local-to-world affine transformation (qd parameter) of an instance geometry (geometry parameter) for a particular time step (timeStep parameter). The transformation is specified as a [RTCQuaternionDecomposition], which is a decomposition of an affine transformation that represents the rotational component of an affine transformation as a quaternion. This allows interpolating rotational transformations exactly using spherical linear interpolation (such as a turning wheel).

For more information about the decomposition see [RTCQuaternionDecomposition]. The quaternion given in the RTCQuaternionDecomposition struct will be normalized internally.

For correct results, the transformation matrices for all time steps must be set either using rtcSetGeometryTransform or rtcSetGeometryTransformQuaternion. Mixing both representations is not allowed. Spherical linear interpolation will be used, iff the transformation matizes are set with rtcSetGeometryTransformQuaternion.

For an example of this feature see the tutorial [Quaternion Motion Blur].

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcInitQuaternionDecomposition], [rtcSetGeometryTransform]


rtcSetGeometryUserData

title: rtcSetGeometryUserData(4embree4)

text:
# rtcSetGeometryUserData(4embree4)

### NAME

```
rtcSetGeometryUserData - sets the user-defined data pointer of the

  geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryUserData(RTCGeometry geometry, void* userPtr);

```

### DESCRIPTION
The rtcSetGeometryUserData function sets the user-defined data pointer (userPtr argument) for a geometry (geometry argument). This user data pointer is intended to be pointing to the application’s representation of the geometry, and is passed to various callback functions. The application can use this pointer inside the callback functions to access its geometry representation.

The rtcGetGeometryUserData function can be used to query an already set user data pointer of a geometry.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetGeometryUserData]


rtcSetGeometryUserPrimitiveCount

text:
# rtcSetGeometryUserPrimitiveCount(4embree4)

### NAME

```
rtcSetGeometryUserPrimitiveCount - sets the number of primitives

  of a user-defined geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryUserPrimitiveCount(

  RTCGeometry geometry,

  unsigned int userPrimitiveCount
);

```

### DESCRIPTION
The rtcSetGeometryUserPrimitiveCount function sets the number of user-defined primitives (userPrimitiveCount parameter) of the specified user-defined geometry (geometry parameter).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_USER]


rtcSetGeometryVertexAttributeCount

text:
# rtcSetGeometryVertexAttributeCount(4embree4)

### NAME

```
rtcSetGeometryVertexAttributeCount - sets the number of vertex

  attributes of the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryVertexAttributeCount(

  RTCGeometry geometry,

  unsigned int vertexAttributeCount
);

```

### DESCRIPTION
The rtcSetGeometryVertexAttributeCount function sets the number of slots (vertexAttributeCount parameter) for vertex attribute buffers (RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE) that can be used for the specified geometry (geometry parameter).

This function is supported only for triangle meshes (RTC_GEOMETRY_TYPE_TRIANGLE), quad meshes (RTC_GEOMETRY_TYPE_QUAD), curves (RTC_GEOMETRY_TYPE_CURVE), points (RTC_GEOMETRY_TYPE_POINT), and subdivision geometries (RTC_GEOMETRY_TYPE_SUBDIVISION).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewGeometry], [RTCBufferType]


rtcSetGeometryVertexAttributeTopology

text:
# rtcSetGeometryVertexAttributeTopology(4embree4)

### NAME

```
rtcSetGeometryVertexAttributeTopology - binds a vertex

  attribute to a topology of the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetGeometryVertexAttributeTopology(

  RTCGeometry geometry,

  unsigned int vertexAttributeID,

  unsigned int topologyID
);

```

### DESCRIPTION
The rtcSetGeometryVertexAttributeTopology function binds a vertex attribute buffer slot (vertexAttributeID argument) to a topology (topologyID argument) for the specified subdivision geometry (geometry argument). Standard vertex buffers are always bound to the default topology (topology 0) and cannot be bound differently. A vertex attribute buffer always uses the topology it is bound to when used in the rtcInterpolate and rtcInterpolateN calls.

A topology with ID i consists of a subdivision mode set through rtcSetGeometrySubdivisionMode and the index buffer bound to the index buffer slot i. This index buffer can assign indices for each face of the subdivision geometry that are different to the indices of the default topology. These new indices can for example be used to introduce additional borders into the subdivision mesh to map multiple textures onto one subdivision geometry.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometrySubdivisionMode], [rtcInterpolate], [rtcInterpolateN]


rtcSetNewGeometryBuffer

title: rtcSetNewGeometryBuffer(4embree4)

text:
# rtcSetNewGeometryBuffer(4embree4)

### NAME

```
rtcSetNewGeometryBuffer - creates and assigns a new data buffer to

  the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void* rtcSetNewGeometryBuffer(

  RTCGeometry geometry,

  enum RTCBufferType type,

  unsigned int slot,

  enum RTCFormat format,

  size_t byteStride,

  size_t itemCount
);

```

### DESCRIPTION
The rtcSetNewGeometryBuffer function creates a new data buffer of specified format (format argument), byte stride (byteStride argument), and number of items (itemCount argument), and assigns it to a geometry buffer slot (type and slot argument) of the specified geometry (geometry argument). The buffer data is managed internally and automatically freed when the geometry is destroyed.

The byte stride (byteStride argument) must be aligned to 4 bytes; otherwise the rtcSetNewGeometryBuffer function will fail.

The allocated buffer will be automatically over-allocated slightly when used as a vertex buffer, where a requirement is that each buffer element should be readable using 16-byte SSE load instructions.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryBuffer], [rtcSetSharedGeometryBuffer]


rtcSetSceneBuildQuality

title: rtcSetSceneBuildQuality(4embree4)

text:
# rtcSetSceneBuildQuality(4embree4)

### NAME

```
rtcSetSceneBuildQuality - sets the build quality for

  the scene

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetSceneBuildQuality(

  RTCScene scene,

  enum RTCBuildQuality quality
);

```

### DESCRIPTION
The rtcSetSceneBuildQuality function sets the build quality (quality argument) for the specified scene (scene argument). Possible values for the build quality are:

•

RTC_BUILD_QUALITY_LOW: Create lower quality data structures, e.g. for dynamic scenes. A two-level spatial index structure is built when enabling this mode, which supports fast partial scene updates, and allows for setting a per-geometry build quality through the rtcSetGeometryBuildQuality function.

•

RTC_BUILD_QUALITY_MEDIUM: Default build quality for most usages. Gives a good compromise between build and render performance.

•

RTC_BUILD_QUALITY_HIGH: Create higher quality data structures for final-frame rendering. For certain geometry types this enables a spatial split BVH. When high quality mode is enabled, filter callbacks may be invoked multiple times for the same geometry.

Selecting a higher build quality results in better rendering performance but slower scene commit times. The default build quality for a scene is RTC_BUILD_QUALITY_MEDIUM.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryBuildQuality]


rtcSetSceneFlags

title: rtcSetSceneFlags(4embree4)

text:
# rtcSetSceneFlags(4embree4)

### NAME

```
rtcSetSceneFlags - sets the flags for the scene

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
enum RTCSceneFlags
{

  RTC_SCENE_FLAG_NONE                    = 0,

  RTC_SCENE_FLAG_DYNAMIC                 = (1 << 0),

  RTC_SCENE_FLAG_COMPACT                 = (1 << 1),

  RTC_SCENE_FLAG_ROBUST                  = (1 << 2),

  RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS = (1 << 3)
};
void rtcSetSceneFlags(RTCScene scene, enum RTCSceneFlags flags);

```

### DESCRIPTION
The rtcSetSceneFlags function sets the scene flags (flags argument) for the specified scene (scene argument). Possible scene flags are:

•

RTC_SCENE_FLAG_NONE: No flags set.

•

RTC_SCENE_FLAG_DYNAMIC: Provides better build performance for dynamic scenes (but also higher memory consumption).

•

RTC_SCENE_FLAG_COMPACT: Uses compact acceleration structures and avoids algorithms that consume much memory.

•

RTC_SCENE_FLAG_ROBUST: Uses acceleration structures that allow for robust traversal, and avoids optimizations that reduce arithmetic accuracy. This mode is typically used for avoiding artifacts caused by rays shooting through edges of neighboring primitives.

•

RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS: Enables scene support for filter functions passed as argument to the traversal functions. See Section [rtcInitIntersectArguments] and [rtcInitOccludedArguments] for more details.

Multiple flags can be enabled using an or operation, e.g. RTC_SCENE_FLAG_COMPACT | RTC_SCENE_FLAG_ROBUST.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetSceneFlags]


rtcSetSceneProgressMonitorFunction

text:
# rtcSetSceneProgressMonitorFunction(4embree4)

### NAME

```
rtcSetSceneProgressMonitorFunction - registers a callback

  to track build progress

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
typedef bool (*RTCProgressMonitorFunction)(

  void* ptr,

  double n
);
void rtcSetSceneProgressMonitorFunction(

  RTCScene scene,

  RTCProgressMonitorFunction progress,

  void* userPtr
);

```

### DESCRIPTION
Embree supports a progress monitor callback mechanism that can be used to report progress of hierarchy build operations and to cancel build operations.

The rtcSetSceneProgressMonitorFunction registers a progress monitor callback function (progress argument) with payload (userPtr argument) for the specified scene (scene argument).

Only a single callback function can be registered per scene, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

Once registered, Embree will invoke the callback function multiple times during hierarchy build operations of the scene, by passing the payload as set at registration time (userPtr argument), and a double in the range [0, 1] which estimates the progress of the operation (n argument). The callback function might be called from multiple threads concurrently.

When returning true from the callback function, Embree will continue the build operation normally. When returning false, Embree will cancel the build operation with the RTC_ERROR_CANCELLED error code. Issuing multiple cancel requests for the same build operation is allowed.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewScene]


rtcSetSharedGeometryBuffer

title: rtcSetSharedGeometryBuffer(4embree4)

text:
# rtcSetSharedGeometryBuffer(4embree4)

### NAME

```
rtcSetSharedGeometryBuffer - assigns a view of a shared data buffer

  to a geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetSharedGeometryBuffer(

  RTCGeometry geometry,

  enum RTCBufferType type,

  unsigned int slot,

  enum RTCFormat format,

  const void* ptr,

  size_t byteOffset,

  size_t byteStride,

  size_t itemCount
);

```

### DESCRIPTION
The rtcSetSharedGeometryBuffer function binds a view of a shared user-managed data buffer (ptr argument) to a geometry buffer type and slot (type and slot argument) of the specified geometry (geometry argument).

One can specify the start of the first buffer element in bytes (byteOffset argument), the byte stride between individual buffer elements (byteStride argument), the format of the buffer elements (format argument), and the number of elements to bind (itemCount).

The start address (byteOffset argument) and stride (byteStride argument) must be both aligned to 4 bytes; otherwise the rtcSetSharedGeometryBuffer function will fail.

```

```

The buffer data must remain valid for as long as the buffer may be used, and the user is responsible for freeing the buffer data when no longer required.

Sharing buffers can significantly reduce the memory required by the application, thus we recommend using this feature. When enabling the RTC_SCENE_FLAG_COMPACT scene flag, the spatial index structures index into the vertex buffer, resulting in even higher memory savings.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryBuffer], [rtcSetNewGeometryBuffer]


rtcUpdateGeometryBuffer

title: rtcUpdateGeometryBuffer(4embree4)

text:
# rtcUpdateGeometryBuffer(4embree4)

### NAME

```
rtcUpdateGeometryBuffer - marks a buffer view bound to the geometry

  as modified

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcUpdateGeometryBuffer(

  RTCGeometry geometry,

  enum RTCBufferType type,

  unsigned int slot
);

```

### DESCRIPTION
The rtcUpdateGeometryBuffer function marks the buffer view bound to the specified buffer type and slot (type and slot argument) of a geometry (geometry argument) as modified.

If a data buffer is changed by the application, the rtcUpdateGeometryBuffer call must be invoked for that buffer. Each buffer view assigned to a buffer slot is initially marked as modified, thus this function needs to be called only when doing buffer modifications after the first rtcCommitScene.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewGeometry], [rtcCommitScene]