Result records (Dr.Jit)
Fields of the records returned by rayd.drjit Scene queries - intersections, nearest edges, visibility, sync profiles, and edge and geometry tables.
Every rayd.drjit query returns a record of Dr.Jit arrays with one entry per query lane (or per slot, for multi-result queries). Each record has a detached class and an AD class with the same fields, for example Intersection and IntersectionAD. In the AD class, continuous fields carry gradients and ids do not.
Records returned by queries have no public constructor. Reflection records are on Reflection, diffraction records on Diffraction, and SDF and surfel records on Implicit geometry.
Intersection#
Returned by Scene.intersect and MixedScene.intersect.
| Field | Type | Meaning |
|---|---|---|
t | Float | hit distance in units of the ray direction; inf on a miss |
p | Array3f | world-space hit point |
n | Array3f | shading normal (interpolated vertex normal, or face normal with use_face_normals) |
geo_n | Array3f | geometric face normal |
uv | Array2f | interpolated texture coordinate |
barycentric | Array3f | barycentric coordinates in the hit triangle |
shape_id | Int | mesh or instance id; -1 on a miss |
prim_id, local_prim_id | Int | triangle index within the mesh (equal) |
global_prim_id | Int | scene-global triangle index |
is_valid() -> Bool returns the hit mask. Fields not selected by flags are not meaningful.
NearestPointEdge#
Returned by Scene.nearest_edge(point).
| Field | Type | Meaning |
|---|---|---|
distance | Float | distance from the query to the edge |
point | Array3f | the query point |
edge_point | Array3f | closest point on the edge |
edge_t | Float | parameter of edge_point along the edge, in [0, 1] from its start |
shape_id | Int | mesh id of the edge |
edge_id | Int | edge index within the mesh |
global_edge_id | Int | scene-global edge index |
is_boundary | Bool | the edge has one adjacent face |
is_valid() -> Bool is False for lanes without an edge, for example inactive lanes or a fully masked edge set.
NearestRayEdge#
Returned by Scene.nearest_edge(ray). All fields of NearestPointEdge, where point is the closest point on the ray, plus:
| Field | Type | Meaning |
|---|---|---|
ray_t | Float | ray parameter of the closest approach |
NearestEdgesTopK#
Returned by Scene.nearest_edges(point, k). Arrays have query_count * k entries; entry q * k + j is the j-th nearest edge of query q.
| Field | Type | Meaning |
|---|---|---|
query_count | int | number of queries |
k | int | slots per query |
is_valid | Bool | slot holds an edge |
distances | Float | distance per slot |
points | Array3f | query point per slot |
edge_t, edge_points | Float, Array3f | closest point on the edge |
shape_ids, edge_ids, global_edge_ids | Int | edge ids |
is_boundary | Bool | boundary flag |
Visibility records#
| Record | Returned by | Fields |
|---|---|---|
SegmentVisibility | visible | ray_count, visible |
SegmentPairVisibility | visible_pair | ray_count, visible_a, visible_b |
AxialEdgeVisibility | visible_edge | state_count, any_visible |
SegmentChainVisibility | visible_chain | chain_count, max_segments, all_visible, first_blocked_segment, first_blocked_prim |
first_blocked_segment and first_blocked_prim are -1 for a clear chain.
SceneSyncProfile#
Scene.last_sync_profile after sync().
| Field | Meaning |
|---|---|
mesh_update_ms, triangle_scatter_ms, triangle_eval_ms | time to apply vertex and transform updates to triangles |
edge_scatter_ms, edge_refit_ms | time to update the edge data and refit the edge BVH |
optix_sync_ms, optix_gas_update_ms, optix_ias_update_ms | time spent updating OptiX structures |
total_ms | total sync time |
updated_meshes, updated_vertex_meshes, updated_transform_meshes, updated_edge_meshes | counts of meshes touched |
updated_edges | count of edges touched |
All times are in milliseconds.
SceneEdgeBVHStats#
Scene.edge_bvh_stats(): primitive_count, node_count, internal_node_count, leaf_node_count, min_leaf_size, max_leaf_size, avg_leaf_size, max_height, refit_level_count, root_surface_area, internal_surface_area_sum, sibling_overlap_surface_area_sum, sibling_overlap_surface_area_avg, normalized_sibling_overlap, and leaf_size_histogram (a dict from leaf size to count). With the OptiX edge backend the node fields describe a trivial placeholder tree.
SceneEdgeInfo#
Scene.edge_info(): one entry per scene-global edge. size() returns the edge count.
| Field | Meaning |
|---|---|
start, end | endpoints |
edge | end - start |
length | edge length |
normal0, normal1 | normals of the adjacent faces |
is_boundary | one adjacent face only |
shape_id, local_edge_id, global_edge_id | ids |
SceneEdgeTopology#
Scene.edge_topology(): one entry per scene-global edge. size() returns the edge count.
| Field | Meaning |
|---|---|
v0, v1, v0_global, v1_global | endpoint vertex ids, mesh-local and global |
face0_local, face1_local, face0_global, face1_global | adjacent face ids; -1 for a missing face |
opposite_vertex0, opposite_vertex1, opposite_vertex0_global, opposite_vertex1_global | the vertex opposite the edge in each face |
SceneGeometry#
Scene.global_geometry(): all world-space triangles. Fields vertices, faces, face_normal, shape_id, local_prim_id, global_prim_id; methods vertex_count() and face_count().
SecondaryEdgeInfo#
Mesh.secondary_edges(): per-mesh edge data. Fields start, edge, normal0, normal1, opposite, is_boundary; method size().