waxmorph.render.WarpMovieRenderer#

class waxmorph.render.WarpMovieRenderer(filename, max_particles, *, backend='usd', width=1280, height=720, fps=60, device='cuda', camera_pos=(0.0, 2.0, 10.0), camera_front=(0.0, 0.0, -1.0), camera_up=(0.0, 1.0, 0.0), background_color=(1.0, 1.0, 1.0), draw_grid=False, draw_axis=False, draw_sky=False, render_wireframe=False, codec='libx264', quality=8, pixelformat='yuv420p', usd_up_axis='Y', usd_scaling=1.0, usd_save_every_frame=False, opengl_reset_instancers_each_frame=True, prim_name='cells')[source]#

Bases: object

Context-managed OpenGL video or USD animation from fixed Warp buffers.

NumPy frames provide RGB directly; Warp-state frames derive HSV colors on the selected device before this implementation copies them to NumPy. USD uses usd-core and usd_* options; OpenGL uses camera, scene, encoding, and opengl_* options.

Parameters:
  • filename (str)

  • max_particles (int)

  • backend (Literal['opengl', 'usd'])

  • width (int)

  • height (int)

  • fps (int)

  • device (str)

  • draw_grid (bool)

  • draw_axis (bool)

  • draw_sky (bool)

  • render_wireframe (bool)

  • codec (str)

  • quality (int)

  • pixelformat (str)

  • usd_up_axis (str)

  • usd_scaling (float)

  • usd_save_every_frame (bool)

  • opengl_reset_instancers_each_frame (bool)

  • prim_name (str)

write_frame_from_numpy(*, t, centers, radii, colors, particle_count, mesh_points=None, mesh_indices=None)[source]#

Write clipped RGB from NumPy state.

particle_count is clamped to [0, max_particles] and arrays are sliced to that count, then zero-padded. Centers and colors must have shape [N,3] and radii [N], with N at least the clamped count. OpenGL frames include supplied mesh overlays; USD frames render packed particles.

Parameters:
Return type:

None

write_frame_from_state(*, t, centers_wp, radii_wp, A_wp, I_wp, particle_count, morph='A', morph_scale=1.0, hue=0.8, base_color=None, mesh_points=None, mesh_indices=None)[source]#

Write Warp state with HSV colors derived on the selected device.

The active count is clamped to renderer capacity, inactive slots are zeroed, and packed buffers are copied to NumPy. Centers use wp.vec3f; radii, A, and I use wp.float32 on self.device, each with at least the clamped count. OpenGL frames include supplied mesh overlays; USD frames render packed particles.

Parameters:
Return type:

None