NVIDIA OptiX 6.0 API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
GeometryTriangles functions

Functions

RTresult RTAPI rtGeometryTrianglesCreate (RTcontext context, RTgeometrytriangles *geometrytriangles)
 
RTresult RTAPI rtGeometryTrianglesDestroy (RTgeometrytriangles geometrytriangles)
 
RTresult RTAPI rtGeometryTrianglesValidate (RTgeometrytriangles geometrytriangles)
 
RTresult RTAPI rtGeometryTrianglesGetContext (RTgeometrytriangles geometrytriangles, RTcontext *context)
 
RTresult RTAPI rtGeometryTrianglesSetPrimitiveIndexOffset (RTgeometrytriangles geometrytriangles, unsigned int indexOffset)
 
RTresult RTAPI rtGeometryTrianglesGetPrimitiveIndexOffset (RTgeometrytriangles geometrytriangles, unsigned int *indexOffset)
 
RTresult RTAPI rtGeometryTrianglesSetPreTransformMatrix (RTgeometrytriangles geometrytriangles, int transpose, const float *matrix)
 
RTresult RTAPI rtGeometryTrianglesGetPreTransformMatrix (RTgeometrytriangles geometrytriangles, int transpose, float *matrix)
 
RTresult RTAPI rtGeometryTrianglesSetPrimitiveCount (RTgeometrytriangles geometrytriangles, unsigned int triangleCount)
 
RTresult RTAPI rtGeometryTrianglesGetPrimitiveCount (RTgeometrytriangles geometrytriangles, unsigned int *triangleCount)
 
RTresult RTAPI rtGeometryTrianglesSetTriangleIndices (RTgeometrytriangles geometrytriangles, RTbuffer indexBuffer, RTsize indexBufferByteOffset, RTsize triIndicesByteStride, RTformat triIndicesFormat)
 
RTresult RTAPI rtGeometryTrianglesSetVertices (RTgeometrytriangles geometrytriangles, unsigned int vertexCount, RTbuffer vertexBuffer, RTsize vertexBufferByteOffset, RTsize vertexByteStride, RTformat positionFormat)
 
RTresult RTAPI rtGeometryTrianglesSetMotionVertices (RTgeometrytriangles geometrytriangles, unsigned int vertexCount, RTbuffer vertexBuffer, RTsize vertexBufferByteOffset, RTsize vertexByteStride, RTsize vertexMotionStepByteStride, RTformat positionFormat)
 
RTresult RTAPI rtGeometryTrianglesSetMotionVerticesMultiBuffer (RTgeometrytriangles geometrytriangles, unsigned int vertexCount, RTbuffer *vertexBuffers, unsigned int vertexBufferCount, RTsize vertexBufferByteOffset, RTsize vertexByteStride, RTformat positionFormat)
 
RTresult RTAPI rtGeometryTrianglesSetMotionSteps (RTgeometrytriangles geometrytriangles, unsigned int motionStepCount)
 
RTresult RTAPI rtGeometryTrianglesGetMotionSteps (RTgeometrytriangles geometrytriangles, unsigned int *motionStepCount)
 
RTresult RTAPI rtGeometryTrianglesSetMotionRange (RTgeometrytriangles geometrytriangles, float timeBegin, float timeEnd)
 
RTresult RTAPI rtGeometryTrianglesGetMotionRange (RTgeometrytriangles geometrytriangles, float *timeBegin, float *timeEnd)
 
RTresult RTAPI rtGeometryTrianglesSetMotionBorderMode (RTgeometrytriangles geometrytriangles, RTmotionbordermode beginMode, RTmotionbordermode endMode)
 
RTresult RTAPI rtGeometryTrianglesGetMotionBorderMode (RTgeometrytriangles geometrytriangles, RTmotionbordermode *beginMode, RTmotionbordermode *endMode)
 
RTresult RTAPI rtGeometryTrianglesSetBuildFlags (RTgeometrytriangles geometrytriangles, RTgeometrybuildflags buildFlags)
 
RTresult RTAPI rtGeometryTrianglesGetMaterialCount (RTgeometrytriangles geometrytriangles, unsigned int *numMaterials)
 
RTresult RTAPI rtGeometryTrianglesSetMaterialCount (RTgeometrytriangles geometrytriangles, unsigned int numMaterials)
 
RTresult RTAPI rtGeometryTrianglesSetMaterialIndices (RTgeometrytriangles geometrytriangles, RTbuffer materialIndexBuffer, RTsize materialIndexBufferByteOffset, RTsize materialIndexByteStride, RTformat materialIndexFormat)
 
RTresult RTAPI rtGeometryTrianglesSetFlagsPerMaterial (RTgeometrytriangles geometrytriangles, unsigned int materialIndex, RTgeometryflags flags)
 
RTresult RTAPI rtGeometryTrianglesGetFlagsPerMaterial (RTgeometrytriangles triangles, unsigned int materialIndex, RTgeometryflags *flags)
 
RTresult RTAPI rtGeometryTrianglesSetAttributeProgram (RTgeometrytriangles geometrytriangles, RTprogram program)
 
RTresult RTAPI rtGeometryTrianglesGetAttributeProgram (RTgeometrytriangles geometrytriangles, RTprogram *program)
 
RTresult RTAPI rtGeometryTrianglesDeclareVariable (RTgeometrytriangles geometrytriangles, const char *name, RTvariable *v)
 
RTresult RTAPI rtGeometryTrianglesQueryVariable (RTgeometrytriangles geometrytriangles, const char *name, RTvariable *v)
 
RTresult RTAPI rtGeometryTrianglesRemoveVariable (RTgeometrytriangles geometrytriangles, RTvariable v)
 
RTresult RTAPI rtGeometryTrianglesGetVariableCount (RTgeometrytriangles geometrytriangles, unsigned int *count)
 
RTresult RTAPI rtGeometryTrianglesGetVariable (RTgeometrytriangles geometrytriangles, unsigned int index, RTvariable *v)
 

Detailed Description

Functions related to an OptiX GeometryTriangles node.

Function Documentation

RTresult RTAPI rtGeometryTrianglesCreate ( RTcontext  context,
RTgeometrytriangles geometrytriangles 
)

Creates a new GeometryTriangles node.

Description

rtGeometryTrianglesCreate creates a new GeometryTriangles node within a context. context specifies the target context, and should be a value returned by rtContextCreate. Sets *geometrytriangles to the handle of a newly created GeometryTriangles node within context. Returns RT_ERROR_INVALID_VALUE if geometrytriangles is NULL.

Parameters
[in]contextSpecifies the rendering context of the GeometryTriangles node
[out]geometrytrianglesNew GeometryTriangles node handle

Return values

Relevant return values:

History

rtGeometryTrianglesCreate was introduced in OptiX 6.0.

See also rtGeometryTrianglesDestroy,

RTresult RTAPI rtGeometryTrianglesDeclareVariable ( RTgeometrytriangles  geometrytriangles,
const char *  name,
RTvariable v 
)

Declares a geometry variable for a GeometryTriangles object.

Description

rtGeometryTrianglesDeclareVariable declares a variable attribute of a geometrytriangles object with a specified name.

Parameters
[in]geometrytrianglesA geometry node
[in]nameThe name of the variable
[out]vA pointer to a handle to the variable

Return values

Relevant return values:

History

rtGeometryTrianglesDeclareVariable was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetVariable, rtGeometryTrianglesGetVariableCount, rtGeometryTrianglesQueryVariable, rtGeometryTrianglesRemoveVariable

RTresult RTAPI rtGeometryTrianglesDestroy ( RTgeometrytriangles  geometrytriangles)

Destroys a GeometryTriangles node.

Description

rtGeometryTrianglesDestroy removes geometrytriangles from its context and deletes it. geometrytriangles should be a value returned by rtGeometryTrianglesCreate. After the call, geometrytriangles is no longer a valid handle.

Parameters
[in]geometrytrianglesHandle of the GeometryTriangles node to destroy

Return values

Relevant return values:

History

rtGeometryTrianglesDestroy was introduced in OptiX 6.0.

See also rtGeometryTrianglesCreate, rtGeometryTrianglesSetPrimitiveCount, rtGeometryTrianglesGetPrimitiveCount

RTresult RTAPI rtGeometryTrianglesGetAttributeProgram ( RTgeometrytriangles  geometrytriangles,
RTprogram program 
)

Gets the attribute program of a GeometryTriangles object.

Description

rtGeometryTrianglesGetAttributeProgram gets the attribute program of a given geometrytriangles object. If no program has been set, 0 is returned.

Parameters
[in]geometrytrianglesThe geometrytriangles node for which to set the attribute program
[out]programA pointer to a handle to the attribute program

Return values

Relevant return values:

History

rtGeometryTrianglesGetAttributeProgram was introduced in OptiX 6.0.

See also rtGeometryTrianglesDeclareVariable, rtGeometryTrianglesSetAttributeProgram, rtProgramCreateFromPTXFile, rtProgramCreateFromPTXString

RTresult RTAPI rtGeometryTrianglesGetContext ( RTgeometrytriangles  geometrytriangles,
RTcontext context 
)

Returns the context associated with a GeometryTriangles node.

Description

rtGeometryTrianglesGetContext queries a GeometryTriangles node for its associated context. geometrytriangles specifies the GeometryTriangles node to query, and should be a value returned by rtGeometryTrianglesCreate. Sets *context to the context associated with geometrytriangles.

Parameters
[in]geometrytrianglesSpecifies the GeometryTriangles to query
[out]contextThe context associated with geometrytriangles

Return values

Relevant return values:

History

rtGeometryTrianglesGetContext was introduced in OptiX 6.0.

See also rtGeometryTrianglesCreate

RTresult RTAPI rtGeometryTrianglesGetFlagsPerMaterial ( RTgeometrytriangles  triangles,
unsigned int  materialIndex,
RTgeometryflags flags 
)

Gets geometry flags for triangles.

Description

See rtGeometryTrianglesSetFlagsPerMaterial for details.

Parameters
[in]trianglesThe triangles handle
[in]materialIndexThe index of the material for which to retrieve the flags
[out]flagsFlags for the given geometry group

Return values

Relevant return values:

History

rtGeometryTrianglesGetFlagsPerMaterial was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetFlagsPerMaterial, rtGeometryTrianglesSetMaterialIndices rtTrace

RTresult RTAPI rtGeometryTrianglesGetMaterialCount ( RTgeometrytriangles  geometrytriangles,
unsigned int *  numMaterials 
)

Sets the number of materials used for the GeometryTriangles.

Description rtGeometryTrianglesGetMaterialCount returns the number of materials that are used with geometrytriangles. As default there is one material slot.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[out]numMaterialsNumber of materials used with this GeometryTriangles node

Return values

Relevant return values:

History

rtGeometryTrianglesGetMaterialCount was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMaterialCount

RTresult RTAPI rtGeometryTrianglesGetMotionBorderMode ( RTgeometrytriangles  geometrytriangles,
RTmotionbordermode beginMode,
RTmotionbordermode endMode 
)

Returns the motion border modes of a GeometryTriangles node.

Description rtGeometryTrianglesGetMotionBorderMode returns the motion border modes for the time range associated with geometrytriangles.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[out]beginModeMotion border mode at motion range begin
[out]endModeMotion border mode at motion range end

Return values

Relevant return values:

History

rtGeometryTrianglesGetMotionBorderMode was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMotionBorderMode rtGeometryTrianglesGetMotionRange rtGeometryTrianglesGetMotionSteps

RTresult RTAPI rtGeometryTrianglesGetMotionRange ( RTgeometrytriangles  geometrytriangles,
float *  timeBegin,
float *  timeEnd 
)

Returns the motion time range associated with a GeometryTriangles node.

Description rtGeometryTrianglesGetMotionRange returns the motion time range associated with geometrytriangles from a previous call to rtGeometryTrianglesSetMotionRange, or the default values of [0.0, 1.0].

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[out]timeBeginBeginning time value of range
[out]timeEndEnding time value of range

Return values

Relevant return values:

History

rtGeometryTrianglesGetMotionRange was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMotionRange rtGeometryTrianglesGetMotionBorderMode rtGeometryTrianglesGetMotionSteps

RTresult RTAPI rtGeometryTrianglesGetMotionSteps ( RTgeometrytriangles  geometrytriangles,
unsigned int *  motionStepCount 
)

Returns the number of motion steps associated with a GeometryTriangles node.

Description rtGeometryTrianglesGetMotionSteps returns in motionStepCount the number of motion steps associated with geometrytriangles. Note that the default value is 1, not 0, for geometry without motion.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[out]motionStepCountNumber of motion steps motionStepCount >= 1

Return values

Relevant return values:

History

rtGeometryTrianglesGetMotionSteps was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMotionSteps rtGeometryTrianglesGetMotionBorderMode rtGeometryTrianglesGetMotionRange

RTresult RTAPI rtGeometryTrianglesGetPreTransformMatrix ( RTgeometrytriangles  geometrytriangles,
int  transpose,
float *  matrix 
)

Gets a pre-transform matrix.

Description

rtGeometryTrianglesGetPreTransformMatrix returns a previously set 3x4 matrix or the 'identity' matrix (with ones in the main diagonal of the 3x3 submatrix) if no matrix is set.

Parameters
[in]geometrytrianglesGeometry node to query from the number of primitives
[in]transposeSet to true if the output matrix is expected to be column-major rather than row-major
[out]matrixThe 3x4 matrix that is used to transform the vertices

Return values

Relevant return values:

History

rtGeometryTrianglesGetPreTransformMatrix was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetPreTransformMatrix

RTresult RTAPI rtGeometryTrianglesGetPrimitiveCount ( RTgeometrytriangles  geometrytriangles,
unsigned int *  triangleCount 
)

Returns the number of triangles.

Description

rtGeometryTrianglesGetPrimitiveCount returns the number of set triangles for geometrytriangles. The number of primitives can be set with rtGeometryTrianglesSetPrimitiveCount.

Parameters
[in]geometrytrianglesGeometryTriangles node to query from the number of primitives
[out]triangleCountNumber of triangles

Return values

Relevant return values:

History

rtGeometryTrianglesGetPrimitiveCount was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetPrimitiveCount rtGeometryGetPrimitiveCount

RTresult RTAPI rtGeometryTrianglesGetPrimitiveIndexOffset ( RTgeometrytriangles  geometrytriangles,
unsigned int *  indexOffset 
)

Returns the current primitive index offset.

Description

rtGeometryTrianglesGetPrimitiveIndexOffset returns for geometrytriangles the primitive index offset. The primitive index offset can be set with rtGeometryTrianglesSetPrimitiveIndexOffset.

Parameters
[in]geometrytrianglesGeometryTriangles node to query for the primitive index offset
[out]indexOffsetPrimitive index offset

Return values

Relevant return values:

History

rtGeometryTrianglesGetPrimitiveIndexOffset was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetPrimitiveIndexOffset

RTresult RTAPI rtGeometryTrianglesGetVariable ( RTgeometrytriangles  geometrytriangles,
unsigned int  index,
RTvariable v 
)

Get a variable attached to a GeometryTriangles object at a specified index.

Description

rtGeometryTrianglesGetVariable returns the variable attached at a given index to the specified GeometryTriangles object.

Parameters
[in]geometrytrianglesA geometry node
[in]indexThe index of the variable
[out]vA pointer to a variable handle

Return values

Relevant return values:

History

rtGeometryTrianglesGetVariable was introduced in OptiX 6.0.

See also rtGeometryTrianglesDeclareVariable, rtGeometryTrianglesGetVariableCount, rtGeometryTrianglesQueryVariable, rtGeometryTrianglesRemoveVariable

RTresult RTAPI rtGeometryTrianglesGetVariableCount ( RTgeometrytriangles  geometrytriangles,
unsigned int *  count 
)

Get the number of variables attached to a GeometryTriangles object.

Description

rtGeometryTrianglesGetVariableCount returns a count of the number of variables attached to a geometrytriangles object.

Parameters
[in]geometrytrianglesA geometrytriangles node
[out]countA pointer to an unsigned int

Return values

Relevant return values:

History

rtGeometryTrianglesGetVariableCount was introduced in OptiX 6.0.

See also rtGeometryTrianglesDeclareVariable, rtGeometryTrianglesGetVariable, rtGeometryTrianglesQueryVariable, rtGeometryTrianglesRemoveVariable

RTresult RTAPI rtGeometryTrianglesQueryVariable ( RTgeometrytriangles  geometrytriangles,
const char *  name,
RTvariable v 
)

Queries a variable attached to a GeometryTriangles object.

Description

rtGeometryTrianglesQueryVariable gets a variable with a given name from a geometrytriangles object.

Parameters
[in]geometrytrianglesA geometrytriangles object
[in]nameThee name of the variable
[out]vA pointer to a handle to the variable

Return values

Relevant return values:

History

rtGeometryTrianglesQueryVariable was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetVariable, rtGeometryTrianglesGetVariableCount, rtGeometryTrianglesQueryVariable, rtGeometryTrianglesRemoveVariable

RTresult RTAPI rtGeometryTrianglesRemoveVariable ( RTgeometrytriangles  geometrytriangles,
RTvariable  v 
)

Removes a variable from GeometryTriangles object.

Description

rtGeometryTrianglesRemoveVariable removes a variable from a geometrytriangles object.

Parameters
[in]geometrytrianglesA geometrytriangles object
[in]vA pointer to a handle to the variable

Return values

Relevant return values:

History

rtGeometryTrianglesRemoveVariable was introduced in OptiX 6.0.

See also rtGeometryTrianglesDeclareVariable, rtGeometryTrianglesGetVariable, rtGeometryTrianglesGetVariableCount, rtGeometryTrianglesQueryVariable

RTresult RTAPI rtGeometryTrianglesSetAttributeProgram ( RTgeometrytriangles  geometrytriangles,
RTprogram  program 
)

Sets the attribute program on a GeometryTriangles object.

Description

rtGeometryTrianglesSetAttributeProgram sets for geometrytriangles the program that performs attribute computation. RTprograms can be either generated with rtProgramCreateFromPTXFile or rtProgramCreateFromPTXString. An attribute program is optional. If no attribute program is specified, a default attribute program will be provided. Attributes are computed after intersection and before any hit or closest hit programs that require those attributes. No assumptions about the precise invocation time should be made.

The default attribute program will provide the following attributes: float2 barycentrics; unsigned int instanceid;

Names are case sensitive and types must match. To use the attributes, declare the following rtDeclareVariable( float2, barycentrics, attribute barycentrics, ); rtDeclareVariable( unsigned int, instanceid, attribute instanceid, );

If you provide an attribute program, the following device side functions will be available. float2 rtGetTriangleBarycentrics();

These device functions are only available in attribute programs.

Parameters
[in]geometrytrianglesThe geometrytriangles node for which to set the attribute program
[in]programA handle to the attribute program

Return values

Relevant return values:

History

rtGeometryTrianglesSetAttributeProgram was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetAttributeProgram, rtProgramCreateFromPTXFile, rtProgramCreateFromPTXString, rtGetTriangleBarycentrics,

RTresult RTAPI rtGeometryTrianglesSetBuildFlags ( RTgeometrytriangles  geometrytriangles,
RTgeometrybuildflags  buildFlags 
)

Sets flags that influence the behavior of traversal.

Description rtGeometryTrianglesSetBuildFlags can be used to set object-specific flags that affect the acceleration-structure-build behavior. If parameter buildFlags contains the RT_GEOMETRY_BUILD_FLAG_RELEASE_BUFFERS flag, all buffers (including the vertex, index, and materialIndex buffer) holding information that is evaluated at acceleration-structure-build time will be released after the build. OptiX does not take ownership over the buffers, but simply frees the corresponding device memory. Sharing buffers with other GeometryTriangles nodes is possible if all of them are built within one OptiX launch. Note that it is the users responsibility that the buffers hold data for the next acceleration structure build if the acceleration structure is marked dirty. E.g., if the flag is set, an OptiX launch will cause the acceleration structure build and release the memory afterwards. If the acceleration structure is marked dirty before the next launch (e.g., due to refitting), the user needs to map the buffers before the launch to fill them with data. Further, there are certain configurations with motion when the buffers cannot be released in which case the flag is ignored and the data is not freed. The buffers can only be released if all GeometryTriangles belonging to a GeometryGroup have the same number of motion steps and equal motion begin / end times.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[in]buildFlagsThe flags to set

Return values

Relevant return values:

History

rtGeometryTrianglesSetBuildFlags was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetBuildFlags

RTresult RTAPI rtGeometryTrianglesSetFlagsPerMaterial ( RTgeometrytriangles  geometrytriangles,
unsigned int  materialIndex,
RTgeometryflags  flags 
)

Sets geometry-specific flags that influence the behavior of traversal.

Description rtGeometryTrianglesSetFlagsPerMaterial can be used to set geometry-specific flags that will eventually change the behavior of traversal when intersecting the geometry. Note that the flags are evaluated at acceleration-structure-build time. An acceleration must be marked dirty for changes to the flags to take effect. Setting the flags RT_GEOMETRY_FLAG_NO_SPLITTING and/or RT_GEOMETRY_FLAG_DISABLE_ANYHIT should be dependent on the material that is used for the intersection. Therefore, the flags are set per material slot (with the actual material binding begin set at the GeomteryInstance). If the geometry is instanced and different instances apply different materials to the geometry, the per-material geometry-specific flags need to apply to the materials of all instances. Example with two instances with each having two materials, node graph: G / \ / \ T0 T1 | | GG0-A-GG1 | | M0-GI0 GI1-M2 / \ / \ M1 GT M3 with: G-Group, GG-GeometryGroup, T-Transform, A-Acceleration, GI-GeometryInstance, M-Material, GT-GeometryTriangles RT_GEOMETRY_FLAG_NO_SPLITTING needs to be set for material index 0, if M0 or M2 require it. RT_GEOMETRY_FLAG_DISABLE_ANYHIT should be set for material index 0, if M0 and M2 allow it. RT_GEOMETRY_FLAG_NO_SPLITTING needs to be set for material index 1, if M1 or M3 require it. RT_GEOMETRY_FLAG_DISABLE_ANYHIT should be set for material index 1, if M1 and M3 allow it.

Setting RT_GEOMETRY_FLAG_NO_SPLITTING prevents splitting the primitive during the bvh build. Splitting is done to increase performance, but as a side-effect may result in multiple executions of the any hit program for a single intersection. To avoid further side effects (e.g., multiple accumulations of a value) that may result of a multiple execution, RT_GEOMETRY_FLAG_NO_SPLITTING needs to be set. RT_GEOMETRY_FLAG_DISABLE_ANYHIT is an optimization due to which the execution of the any hit program is skipped. If possible, the flag should be set. Note that even if no any hit program is set on a material, this flag needs to be set to skip the any hit program. This requirement is because the information whether or not to skip the any hit program needs to be available at bvh build time (while materials can change afterwards without a bvh rebuild). Note that the final decision whether or not to execute the any hit program at run time also depends on the flags set on the ray as well as the geometry group that this geometry is part of.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[in]materialIndexThe material index for which to set the flags
[in]flagsThe flags to set.

Return values

Relevant return values:

History

rtGeometryTrianglesSetFlagsPerMaterial was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMaterialCount rtGeometryTrianglesSetMaterialIndices rtGeometryTrianglesSetBuildFlags

RTresult RTAPI rtGeometryTrianglesSetMaterialCount ( RTgeometrytriangles  geometrytriangles,
unsigned int  numMaterials 
)

Sets the number of materials used for the GeometryTriangles.

Description rtGeometryTrianglesSetMaterialCount sets the number of materials that are used with geometrytriangles. As default, there is one material slot. This number must be equal to the number of materials that is set at the GeometryInstance where geometrytriangles is attached to. Multi-material support for GeometryTriangles is limited to a fixed partition of the geometry into sets of triangles. Each triangle set maps to one material slot (within range [0;numMaterials]). The mapping is set via rtGeometryTrianglesSetMaterialIndices. The actual materials are set at the GeometryInstance. The geometry can be instanced when attached to multiple GeometryInstances. In that case, the materials attached to each GeometryInstance can differ (effectively causing different materials per instance of the geometry). numMaterials must be >=1 and <= 2^16.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[in]numMaterialsNumber of materials used with this geometry

Return values

Relevant return values:

History

rtGeometryTrianglesSetMaterialCount was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetMaterialCount rtGeometryTrianglesSetMaterialIndices rtGeometryTrianglesSetFlagsPerMaterial

RTresult RTAPI rtGeometryTrianglesSetMaterialIndices ( RTgeometrytriangles  geometrytriangles,
RTbuffer  materialIndexBuffer,
RTsize  materialIndexBufferByteOffset,
RTsize  materialIndexByteStride,
RTformat  materialIndexFormat 
)

Sets the index buffer of indexed triangles.

Description

rtGeometryTrianglesSetMaterialIndices set the material slot per triangle of geometrytriangles. Hence, buffer materialIndexBuffer must hold triangleCount entries. Every material index must be in range see 0; numMaterials-1. Parameter materialIndexBufferByteOffset can be used to specify a byte offset to the first index in buffer materialIndexBuffer. Parameter materialIndexByteStride sets the stride in bytes between indices. Parameter materialIndexFormat must be one of the following: RT_FORMAT_UNSIGNED_INT, RT_FORMAT_UNSIGNED_SHORT, RT_FORMAT_UNSIGNED_BYTE. The buffer is only used if the number of materials as set via rtGeometryTrianglesSetMaterialCount is larger than one.

Parameters
[in]geometrytrianglesGeometryTriangles node to query for the primitive index offset
[in]materialIndexBufferBuffer that holds the indices into the vertex buffer of the triangles
[in]materialIndexBufferByteOffsetOffset to first index in buffer indexBuffer
[in]materialIndexByteStrideStride in bytes between triplets of indices
[in]materialIndexFormatFormat of the triplet of indices to index the vertices of a triangle

Return values

Relevant return values:

History

rtGeometryTrianglesSetMaterialIndices was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMaterialCount rtGeometryTrianglesSetFlagsPerMaterial

RTresult RTAPI rtGeometryTrianglesSetMotionBorderMode ( RTgeometrytriangles  geometrytriangles,
RTmotionbordermode  beginMode,
RTmotionbordermode  endMode 
)

Sets the motion border modes of a GeometryTriangles node.

Description rtGeometryTrianglesSetMotionBorderMode sets the behavior of geometrytriangles outside its motion time range. Options are RT_MOTIONBORDERMODE_CLAMP or RT_MOTIONBORDERMODE_VANISH. See rtTransformSetMotionBorderMode for details.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[in]beginModeMotion border mode at motion range begin
[in]endModeMotion border mode at motion range end

Return values

Relevant return values:

History

rtGeometryTrianglesSetMotionBorderMode was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetMotionBorderMode rtGeometryTrianglesSetMotionRange rtGeometryTrianglesGetMotionSteps

RTresult RTAPI rtGeometryTrianglesSetMotionRange ( RTgeometrytriangles  geometrytriangles,
float  timeBegin,
float  timeEnd 
)

Sets the motion time range for a GeometryTriangles node.

Description Sets the inclusive motion time range [timeBegin, timeEnd] for geometrytriangles, where timeBegin <= timeEnd. The default time range is [0.0, 1.0]. The time range has no effect unless rtGeometryTrianglesSetMotionVertices or rtGeometryTrianglesSetMotionVerticesMultiBuffer with motionStepCount > 1 is called, in which case the time steps uniformly divide the time range.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[out]timeBeginBeginning time value of range
[out]timeEndEnding time value of range

Return values

Relevant return values:

History

rtGeometryTrianglesSetMotionRange was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetMotionRange rtGeometryTrianglesSetMotionBorderMode rtGeometryTrianglesGetMotionSteps

RTresult RTAPI rtGeometryTrianglesSetMotionSteps ( RTgeometrytriangles  geometrytriangles,
unsigned int  motionStepCount 
)

Sets the number of motion steps associated with a GeometryTriangles node.

Description rtGeometryTrianglesSetMotionSteps sets the number of motion steps as specified in motionStepCount associated with geometrytriangles. Note that the default value is 1, not 0, for geometry without motion.

Parameters
[in]geometrytrianglesGeometryTriangles node handle
[in]motionStepCountNumber of motion steps, motionStepCount >= 1

Return values

Relevant return values:

History

rtGeometryTrianglesGetMotionSteps was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetMotionVertices rtGeometryTrianglesSetMotionVerticesMultiBuffer rtGeometryTrianglesGetMotionSteps rtGeometryTrianglesSetMotionBorderMode rtGeometryTrianglesSetMotionRange

RTresult RTAPI rtGeometryTrianglesSetMotionVertices ( RTgeometrytriangles  geometrytriangles,
unsigned int  vertexCount,
RTbuffer  vertexBuffer,
RTsize  vertexBufferByteOffset,
RTsize  vertexByteStride,
RTsize  vertexMotionStepByteStride,
RTformat  positionFormat 
)

Sets the vertex buffer of motion triangles.

Description

rtGeometryTrianglesSetMotionVertices interprets the buffer vertexBuffer as the vertices of triangles of the GeometryTriangles geometrytriangles. The number of triangles for one motion step is set as vertexCount. Similar to it's non-motion counterpart, vertexCount must be 3 times triangleCount if no index buffer is set. The total number of vertices stored in vertexBuffer is vertexCount times motionStepCount (see rtGeometryTrianglesSetMotionSteps). Triangles are linearly interpolated between motion steps. Parameter vertexBufferByteOffset can be used to specify a byte offset to the position of the first vertex of the first motion step in buffer vertexBuffer. Parameter vertexByteStride sets the stride in bytes between vertices within a motion step. Parameter vertexMotionStepByteStride sets the stride in bytes between motion steps for a single vertex. The stride parameters allow for two types of layouts of the motion data: a) serialized: vertexByteStride = sizeof(Vertex), vertexMotionStepByteStride = vertexCount * vertexByteStride b) interleaved: motion_step_byte_stride = sizeof(Vertex), vertexByteStride = sizeof(Vertex) * motion_steps Vertex N at time step i is at: vertexBuffer[N * vertexByteStride + i * vertexMotionStepByteStride + vertexBufferByteOffset] Parameter positionFormat must be one of the following: RT_FORMAT_FLOAT3, RT_FORMAT_HALF3, RT_FORMAT_FLOAT2, RT_FORMAT_HALF2. In case of formats RT_FORMAT_FLOAT2 or RT_FORMAT_HALF2 the third component is assumed to be zero, which can be useful for planar geometry. Calling this function overrides any previous call to anyone of the set(Motion)Vertices functions.

Parameters
[in]geometrytrianglesGeometryTriangles node to query for the primitive index offset
[in]vertexCountNumber of vertices for one motion step
[in]vertexBufferBuffer that holds the vertices of the triangles for all motion steps
[in]vertexBufferByteOffsetOffset in bytes to the first vertex of the first motion step in buffer vertexBuffer
[in]vertexByteStrideStride in bytes between vertices, belonging to the same motion step
[in]vertexMotionStepByteStrideStride in bytes between vertices of the same triangle, but neighboring motion step
[in]positionFormatFormat of the position attribute of a vertex

Return values

Relevant return values:

History

rtGeometryTrianglesSetMotionVertices was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetVertices rtGeometryTrianglesSetMotionVerticesMultiBuffer

RTresult RTAPI rtGeometryTrianglesSetMotionVerticesMultiBuffer ( RTgeometrytriangles  geometrytriangles,
unsigned int  vertexCount,
RTbuffer vertexBuffers,
unsigned int  vertexBufferCount,
RTsize  vertexBufferByteOffset,
RTsize  vertexByteStride,
RTformat  positionFormat 
)

Sets the vertex buffer of motion triangles.

Description

rtGeometryTrianglesSetMotionVerticesMultiBuffer can be used instead of rtGeometryTrianglesSetMotionVertices if the vertices for the different motion steps are stored in separate buffers. Parameter vertexBuffers must point to an array of buffers of minimal size motionStepCount (see rtGeometryTrianglesSetMotionSteps). All buffers must, however, share the same byte offset as well as vertex stride and position format. Calling this function overrides any previous call to any of the set(Motion)Vertices functions.

Parameters
[in]geometrytrianglesGeometryTriangles node to query for the primitive index offset
[in]vertexCountNumber of vertices for one motion step
[in]vertexBuffersBuffers that hold the vertices of the triangles per motion step
[in]vertexBufferCountNumber of buffers passed, must match the number of motion steps before a launch call
[in]vertexBufferByteOffsetOffset in bytes to the first vertex in every buffer vertexBuffers
[in]vertexByteStrideStride in bytes between vertices, belonging to the same motion step
[in]positionFormatFormat of the position attribute of a vertex

Return values

Relevant return values:

History

rtGeometryTrianglesSetMotionVertices was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetVertices rtGeometryTrianglesSetMotionVertices

RTresult RTAPI rtGeometryTrianglesSetPreTransformMatrix ( RTgeometrytriangles  geometrytriangles,
int  transpose,
const float *  matrix 
)

Sets a pre-transform matrix.

Description

rtGeometryTrianglesSetPreTransformMatrix can be used to bake a transformation for a mesh. Vertices of triangles are multiplied by the user-specified 3x4 matrix before the acceleration build. Note that the input triangle data stays untouched (set via rtGeometryTrianglesSetVertices). Triangle intersection uses transformed triangles. The 3x4 matrix is expected to be in a row-major data layout, use the transpose option if matrix is in a column-major data layout. Use rtGeometryTrianglesSetPreTransformMatrix(geometrytriangles, false, 0); to unset a previously set matrix.

Parameters
[in]geometrytrianglesGeometry node to query from the number of primitives
[in]transposeIf the input matrix is column-major and needs to be transposed before usage
[in]matrixThe 3x4 matrix that is used to transform the vertices

Return values

Relevant return values:

History

rtGeometryTrianglesSetPreTransformMatrix was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetPreTransformMatrix

RTresult RTAPI rtGeometryTrianglesSetPrimitiveCount ( RTgeometrytriangles  geometrytriangles,
unsigned int  triangleCount 
)

Sets the number of triangles.

Description

rtGeometryTrianglesSetPrimitiveCount sets the number of triangles triangleCount in geometrytriangles. A triangle geometry is either a triangle soup for which every three vertices stored in the vertex buffer form a triangle, or indexed triangles are used for which three indices reference different vertices. In the latter case, an index buffer must be set (rtGeometryTrianglesSetTriangleIndices). The vertices of the triangles are specified via one of the SetVertices functions.

Parameters
[in]geometrytrianglesGeometryTriangles node for which to set the number of triangles
[in]triangleCountNumber of triangles

Return values

Relevant return values:

History

rtGeometryTrianglesSetPrimitiveCount was introduced in OptiX 6.0.

See also rtGeometryTrianglesGetPrimitiveCount rtGeometrySetPrimitiveCount

RTresult RTAPI rtGeometryTrianglesSetPrimitiveIndexOffset ( RTgeometrytriangles  geometrytriangles,
unsigned int  indexOffset 
)

Sets the primitive index offset.

Description

rtGeometryTrianglesSetPrimitiveIndexOffset sets the primitive index offset indexOffset in geometrytriangles. With an offset of zero, a GeometryTriangles with N triangles has a primitive index range of [0,N-1]. The index offset is used to allow GeometryTriangles objects to have primitive index ranges starting at non-zero positions (i.e., a GeometryTriangles with N triangles and an index offset of M has a primitive index range of [M,M+N-1]). Note that this offset only affects the primitive index that is reported in case of an intersection and does not affect the input data that is specified via rtGeometryTrianglesSetVertices or rtGeometryTrianglesSetTriangleIndices. This feature enables the packing of multiple Geometries or GeometryTriangles into a single buffer. While the same effect could be reached via a user variable, it is recommended to specify the offset via rtGeometryTrianglesSetPrimitiveIndexOffset.

Parameters
[in]geometrytrianglesThe GeometryTriangles node for which to set the primitive index offset
[in]indexOffsetThe primitive index offset

Return values

Relevant return values:

History

rtGeometryTrianglesSetPrimitiveIndexOffset was introduced in OptiX 6.0.

See also rtGeometrySetPrimitiveIndexOffset rtGeometryTrianglesGetPrimitiveIndexOffset

RTresult RTAPI rtGeometryTrianglesSetTriangleIndices ( RTgeometrytriangles  geometrytriangles,
RTbuffer  indexBuffer,
RTsize  indexBufferByteOffset,
RTsize  triIndicesByteStride,
RTformat  triIndicesFormat 
)

Sets the index buffer of indexed triangles.

Description

rtGeometryTrianglesSetTriangleIndices is used to set the index buffer for indexed triangles. Triplets of indices from buffer indexBuffer index vertices to form triangles. If the buffer is set, it is assumed that the geometry is given as indexed triangles. If the index buffer is not set, it is assumed that the geometry is given as a triangle soup. A previously set index buffer can be unset by passing NULL as indexBuffer parameter, e.g., rtGeometryTrianglesSetTriangleIndices( geometrytriangles, NULL, 0, 0, RT_FORMAT_UNSIGNED_INT3); Buffer indexBuffer is expected to hold 3 times triangleCount indices (see rtGeometryTrianglesSetPrimitiveCount). Parameter indexBufferByteOffset can be used to specify a byte offset to the first index in buffer indexBuffer. Parameter triIndicesByteStride sets the stride in bytes between triplets of indices. There mustn't be any spacing between indices within a triplet, spacing is only supported between triplets. Parameter triIndicesFormat must be one of the following: RT_FORMAT_UNSIGNED_INT3, RT_FORMAT_UNSIGNED_SHORT3.

Parameters
[in]geometrytrianglesGeometryTriangles node to query for the primitive index offset
[in]indexBufferBuffer that holds the indices into the vertex buffer of the triangles
[in]indexBufferByteOffsetOffset in bytes to the first index in buffer indexBuffer
[in]triIndicesByteStrideStride in bytes between triplets of indices
[in]triIndicesFormatFormat of the triplet of indices to index the vertices of a triangle

Return values

Relevant return values:

History

rtGeometryTrianglesSetTriangleIndices was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetVertices

RTresult RTAPI rtGeometryTrianglesSetVertices ( RTgeometrytriangles  geometrytriangles,
unsigned int  vertexCount,
RTbuffer  vertexBuffer,
RTsize  vertexBufferByteOffset,
RTsize  vertexByteStride,
RTformat  positionFormat 
)

Sets the vertex buffer of a triangle soup.

Description

rtGeometryTrianglesSetVertices interprets the buffer vertexBuffer as the vertices of triangles of the GeometryTriangles geometrytriangles. The number of vertices is set as vertexCount. If an index buffer is set, it is assumed that the geometry is given as indexed triangles. If the index buffer is not set, it is assumed that the geometry is given as a triangle soup and vertexCount must be 3 times triangleCount (see rtGeometryTrianglesSetPrimitiveCount). Buffer vertexBuffer is expected to hold vertexCount vertices. Parameter vertexBufferByteOffset can be used to specify a byte offset to the position of the first vertex in buffer vertexBuffer. Parameter vertexByteStride sets the stride in bytes between vertices. Parameter positionFormat must be one of the following: RT_FORMAT_FLOAT3, RT_FORMAT_HALF3, RT_FORMAT_FLOAT2, RT_FORMAT_HALF2. In case of formats RT_FORMAT_FLOAT2 or RT_FORMAT_HALF2 the third component is assumed to be zero, which can be useful for planar geometry. Calling this function overrides any previous call to anyone of the set(Motion)Vertices functions.

Parameters
[in]geometrytrianglesGeometryTriangles node to query for the primitive index offset
[in]vertexCountNumber of vertices of the geometry
[in]vertexBufferBuffer that holds the vertices of the triangles
[in]vertexByteStrideStride in bytes between vertices
[in]vertexBufferByteOffsetOffset in bytes to the first vertex in buffer vertexBuffer
[in]positionFormatFormat of the position attribute of a vertex

Return values

Relevant return values:

History

rtGeometryTrianglesSetVertices was introduced in OptiX 6.0.

See also rtGeometryTrianglesSetTriangleIndices rtGeometryTrianglesSetMotionVertices

RTresult RTAPI rtGeometryTrianglesValidate ( RTgeometrytriangles  geometrytriangles)

Validates the GeometryTriangles nodes integrity.

Description

rtGeometryTrianglesValidate checks geometrytriangles for completeness. If geometrytriangles or any of the objects attached to geometrytriangles are not valid, returns RT_ERROR_INVALID_VALUE.

Parameters
[in]geometrytrianglesThe GeometryTriangles node to be validated

Return values

Relevant return values:

History

rtGeometryTrianglesValidate was introduced in OptiX 6.0.

See also rtContextValidate