warp.render.UsdRenderer#
- class warp.render.UsdRenderer(stage, up_axis='Y', fps=60, scaling=1.0)[source]#
USD-based renderer for creating 3D visualizations and animations.
This renderer writes geometric primitives, meshes, and point clouds to Universal Scene Description (USD) files, which can be viewed in USD-compatible applications such as USDView, applications built with the Omniverse Kit SDK, or Blender. It supports time-varying animations by recording geometry at different time codes.
The renderer provides methods to visualize geometric shapes (spheres, boxes, capsules, cylinders, cones), custom meshes, line primitives, and point clouds. All geometry is organized under a root transform that can be scaled uniformly.
Note
Requires USD to be installed. Install
usd-core(pip install usd-core) orusd-exchange(pip install usd-exchange) on Linux aarch64 systems whereusd-coreis not available.- Parameters:
stage (str | Usd.Stage) – A USD stage (either a file path or a
Usd.Stageobject). If a string path is provided, a new USD stage will be created at that location.up_axis (str) – The upfacing axis of the stage. Can be
"X","Y", or"Z".fps (int) – The number of frames per second for animation playback.
scaling (float) – Uniform scaling factor applied to all entities in the scene.
Methods
__init__(stage[, up_axis, fps, scaling])add_shape_instance(name, shape, body, pos, rot)begin_frame(time)register_body(body_name)render_arrow(name, pos, rot, base_radius, ...)render_box(name, pos, rot, extents[, ...])Debug helper to add a box for visualization
render_capsule(name, pos, rot, radius, ...)Debug helper to add a capsule for visualization
render_cone(name, pos, rot, radius, half_height)Debug helper to add a cone for visualization
render_cylinder(name, pos, rot, radius, ...)Debug helper to add a cylinder for visualization
render_ground([size, plane])render_line_list(name, vertices, indices[, ...])Debug helper to add a line list as a set of capsules
render_line_strip(name, vertices[, color, ...])render_mesh(name, points, indices[, colors, ...])render_plane(name, pos, rot, width, length)Render a plane with the given dimensions.
render_points(name, points, radius[, ...])render_ref(name, path, pos, rot, scale[, color])render_sphere(name, pos, rot, radius[, ...])Debug helper to add a sphere for visualization
save()update_body_transforms(body_q)Update body transforms (deprecated).
- add_shape_instance(
- name,
- shape,
- body,
- pos,
- rot,
- scale=(1.0, 1.0, 1.0),
- color1=None,
- color2=None,
- custom_index=-1,
- visible=True,
- render_plane(
- name,
- pos,
- rot,
- width,
- length,
- color=(1.0, 1.0, 1.0),
- color2=None,
- parent_body=None,
- is_template=False,
- u_scaling=1.0,
- v_scaling=1.0,
- visible=True,
Render a plane with the given dimensions.
- Parameters:
name (str) – Name of the plane
pos (tuple) – Position of the plane
rot (tuple) – Rotation of the plane
width (float) – Width of the plane
length (float) – Length of the plane
parent_body (str | None) – Name of the parent body
is_template (bool) – Whether the plane is a template
u_scaling (float)
v_scaling (float)
visible (bool)
- render_sphere(
- name,
- pos,
- rot,
- radius,
- parent_body=None,
- is_template=False,
- color=None,
- visible=True,
Debug helper to add a sphere for visualization
- render_capsule(
- name,
- pos,
- rot,
- radius,
- half_height,
- parent_body=None,
- is_template=False,
- up_axis=1,
- color=None,
- visible=True,
Debug helper to add a capsule for visualization
- Parameters:
pos (tuple) – The position of the capsule
radius (float) – The radius of the capsule
half_height (float) – The half height of the capsule
name (str) – A name for the USD prim on the stage
color (tuple[float, float, float] | None) – The color of the capsule
rot (tuple)
parent_body (str | None)
is_template (bool)
up_axis (int)
visible (bool)
- render_cylinder(
- name,
- pos,
- rot,
- radius,
- half_height,
- parent_body=None,
- is_template=False,
- up_axis=1,
- color=None,
- visible=True,
Debug helper to add a cylinder for visualization
- Parameters:
pos (tuple) – The position of the cylinder
radius (float) – The radius of the cylinder
half_height (float) – The half height of the cylinder
name (str) – A name for the USD prim on the stage
color (tuple[float, float, float] | None) – The color of the cylinder
rot (tuple)
parent_body (str | None)
is_template (bool)
up_axis (int)
visible (bool)
- render_cone(
- name,
- pos,
- rot,
- radius,
- half_height,
- parent_body=None,
- is_template=False,
- up_axis=1,
- color=None,
- visible=True,
Debug helper to add a cone for visualization
- Parameters:
pos (tuple) – The position of the cone
radius (float) – The radius of the cone
half_height (float) – The half height of the cone
name (str) – A name for the USD prim on the stage
color (tuple[float, float, float] | None) – The color of the cone
rot (tuple)
parent_body (str | None)
is_template (bool)
up_axis (int)
visible (bool)
- render_box(
- name,
- pos,
- rot,
- extents,
- parent_body=None,
- is_template=False,
- color=None,
- visible=True,
Debug helper to add a box for visualization
- render_mesh(
- name,
- points,
- indices,
- colors=None,
- pos=(0.0, 0.0, 0.0),
- rot=(0.0, 0.0, 0.0, 1.0),
- scale=(1.0, 1.0, 1.0),
- update_topology=False,
- parent_body=None,
- is_template=False,
- smooth_shading=True,
- visible=True,
- render_arrow(
- name,
- pos,
- rot,
- base_radius,
- base_height,
- cap_radius=None,
- cap_height=None,
- parent_body=None,
- is_template=False,
- up_axis=1,
- color=None,
- visible=True,
- render_line_list(
- name,
- vertices,
- indices,
- color=None,
- radius=0.01,
- visible=True,
Debug helper to add a line list as a set of capsules