SceneTracer
The SceneTracer class provides an interface for performing ray intersection operations within a Scene using GPU shaders. To perform intersection, a new ray index must be obtained by atomically incrementing the indirect buffer, and input ray parameters must be written to the input buffer. The intersection result is then available in the output buffer at the same index on the next frame or after manually executing the dispatch() method. The SceneManager class offers a simpler interface to SceneTracer for CPU-initiated ray intersection queries, with results reported via callbacks.
The SceneTracer is available for GraphVarying shaders.
#include <scene/TellusimSceneTracer.h>
Constructors
SceneTracer()
Methods
Tracer parameters.
uint32_t getMaxRays() const
Output buffer offset.
size_t getOutputOffset() const
Tracer buffers.
Buffer getInputBuffer() const
Buffer getOutputBuffer() const
Buffer getIndirectBuffer() const
Tracer queries.
Query getQuery(QueryType type) const
static const char *getQueryName(QueryType type)
Dispatch tracer.
void dispatch(Compute compute, Flags flags = FlagNone)
Enums
Flags
Tracer flags.
Name | Value | Description |
---|---|---|
FlagNone | 0 | |
FlagQuery | (1 << 0) | Time query profiler. |
DefaultFlags | FlagNone | |
NumFlags | 1 |
RayFlags
Ray flags.
Name | Value | Description |
---|---|---|
RayFlagNone | 0 | |
RayFlagAll | (1 << 27) | Skip visibility distance test. |
RayFlagAny | (1 << 28) | Stop on any object intersection. |
RayFlagInstance | (1 << 29) | Stop on node instance intersection. |
RayFlagDoubleSided | (1 << 30) | Perform double-sided intersection. |
QueryType
Query types.
Name | Value | Description |
---|---|---|
QueryGraph | 0 | Graph tracing time. |
QueryNode | 1 | Node tracing time. |
QueryObject | 2 | Object tracing time. |
QueryMesh | 3 | Mesh tracing time. |
QueryBrep | 4 | Brep tracing time. |
QueryMerge | 5 | Tracing merge time. |
NumQueries | 6 |
Structs
Ray
Tracer ray.
Variables
Type | Name | Value | Description |
---|---|---|---|
Matrix4x3d | transform | Global transform. | |
Vector3d | position | Ray position. | |
Vector3d | target | Ray target. | |
float32_t | k | 1e8f | Intersection point. |
uint32_t | mask | ~0u | Intersection mask. |
uint32_t | flags | RayFlagNone | Ray flags and ray index. |
uint32_t | graph_index | Intersection graph index. | |
uint32_t | node_index | Intersection node index. | |
uint32_t | object_index | Intersection object index. | |
uint32_t | object_node_index | Intersection object node index. | |
uint32_t | geometry_index | Intersection object geometry index. | |
uint32_t | geometry_batch | Intersection object geometry batch. | |
uint32_t | geometry_primitive | Intersection object geometry primitive. | |
Vector2f | texcoord | Intersection texcoord. | |
Vector3f | normal | Intersection normal. | |
uint32_t | payload | Ray payload data. |