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.

FieldTypeMeaning
tFloathit distance in units of the ray direction; inf on a miss
pArray3fworld-space hit point
nArray3fshading normal (interpolated vertex normal, or face normal with use_face_normals)
geo_nArray3fgeometric face normal
uvArray2finterpolated texture coordinate
barycentricArray3fbarycentric coordinates in the hit triangle
shape_idIntmesh or instance id; -1 on a miss
prim_id, local_prim_idInttriangle index within the mesh (equal)
global_prim_idIntscene-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).

FieldTypeMeaning
distanceFloatdistance from the query to the edge
pointArray3fthe query point
edge_pointArray3fclosest point on the edge
edge_tFloatparameter of edge_point along the edge, in [0, 1] from its start
shape_idIntmesh id of the edge
edge_idIntedge index within the mesh
global_edge_idIntscene-global edge index
is_boundaryBoolthe 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:

FieldTypeMeaning
ray_tFloatray 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.

FieldTypeMeaning
query_countintnumber of queries
kintslots per query
is_validBoolslot holds an edge
distancesFloatdistance per slot
pointsArray3fquery point per slot
edge_t, edge_pointsFloat, Array3fclosest point on the edge
shape_ids, edge_ids, global_edge_idsIntedge ids
is_boundaryBoolboundary flag

Visibility records#

RecordReturned byFields
SegmentVisibilityvisibleray_count, visible
SegmentPairVisibilityvisible_pairray_count, visible_a, visible_b
AxialEdgeVisibilityvisible_edgestate_count, any_visible
SegmentChainVisibilityvisible_chainchain_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().

FieldMeaning
mesh_update_ms, triangle_scatter_ms, triangle_eval_mstime to apply vertex and transform updates to triangles
edge_scatter_ms, edge_refit_mstime to update the edge data and refit the edge BVH
optix_sync_ms, optix_gas_update_ms, optix_ias_update_mstime spent updating OptiX structures
total_mstotal sync time
updated_meshes, updated_vertex_meshes, updated_transform_meshes, updated_edge_meshescounts of meshes touched
updated_edgescount 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.

FieldMeaning
start, endendpoints
edgeend - start
lengthedge length
normal0, normal1normals of the adjacent faces
is_boundaryone adjacent face only
shape_id, local_edge_id, global_edge_idids

SceneEdgeTopology#

Scene.edge_topology(): one entry per scene-global edge. size() returns the edge count.

FieldMeaning
v0, v1, v0_global, v1_globalendpoint vertex ids, mesh-local and global
face0_local, face1_local, face0_global, face1_globaladjacent face ids; -1 for a missing face
opposite_vertex0, opposite_vertex1, opposite_vertex0_global, opposite_vertex1_globalthe 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().