newton.viewer.ViewerRerun#
- class newton.viewer.ViewerRerun(server=True, address='127.0.0.1:9876', launch_viewer=True, app_id=None)[source]#
Bases:
ViewerBase
ViewerRerun provides a backend for visualizing Newton simulations using the rerun visualization library.
This viewer logs mesh and instance data to rerun, enabling real-time or offline visualization of simulation geometry and transforms. It supports both server and client modes, and can optionally launch a web viewer. The class manages mesh assets, instanced geometry, and frame/timeline synchronization with rerun.
- __init__(server=True, address='127.0.0.1:9876', launch_viewer=True, app_id=None)#
Initialize the ViewerRerun backend for Newton using the rerun visualization library.
- begin_frame(time)#
Begin a new frame and set the timeline for rerun.
- Parameters:
time (float) – The current simulation time.
- close()#
Close the viewer and clean up resources.
This will terminate any spawned viewer process and disconnect from rerun.
- end_frame()#
End the current frame.
Note
Rerun handles frame finishing automatically.
- is_running()#
Check if the viewer is still running.
- Returns:
True if the viewer is running, False otherwise.
- Return type:
- log_array(name, array)#
Placeholder for logging a generic array to rerun.
- Parameters:
name (str) – Name of the array.
array – The array data.
- log_instances(name, mesh, xforms, scales, colors, materials, hidden=False)#
Log instanced mesh data to rerun using InstancePoses3D.
- Parameters:
name (str) – Entity path for the instances.
mesh (str) – Name of the mesh asset to instance.
xforms (wp.array) – Instance transforms (wp.transform).
scales (wp.array) – Instance scales (wp.vec3).
colors (wp.array) – Instance colors (wp.vec3).
materials (wp.array) – Instance materials (wp.vec4).
hidden (bool) – Whether the instances are hidden. (unused)
- log_lines(name, starts, ends, colors, width=0.01, hidden=False)#
Placeholder for logging lines to rerun.
- log_mesh(name, points, indices, normals=None, uvs=None, hidden=False, backface_culling=True)#
Log a mesh to rerun for visualization.
- Parameters:
name (str) – Entity path for the mesh.
points (wp.array) – Vertex positions (wp.vec3).
indices (wp.array) – Triangle indices (wp.uint32).
normals (wp.array, optional) – Vertex normals (wp.vec3).
uvs (wp.array, optional) – UV coordinates (wp.vec2).
hidden (bool) – Whether the mesh is hidden (unused).
backface_culling (bool) – Whether to enable backface culling (unused).
- log_points(name, points, radii, colors, hidden=False)#
Placeholder for logging points to rerun.