newton.geometry.DeformableVisualMesh#
- class newton.geometry.DeformableVisualMesh(kind, rest_vertices, indices, parent, *, weights=None, local_offsets=None, uvs=None, texture=None, world=-1, label='', index=-1)[source]#
Bases:
objectFixed visual geometry attached to simulation elements.
Created by
newton.ModelBuilder.finalize()and stored innewton.Model.deformable_visual_meshes. This data adds no mass or collision. Particle, triangle, tetrahedron and body bindings are supported. Evaluate positions withDeformableVisuals.Properties are read-only; do not edit their arrays in place. Meshes with equal rest vertices and triangle indices share device storage, while bindings stay per mesh. The label can be changed for display, and the texture can be replaced. For USD graphics prim paths, use the
path_deformable_visual_mapresult fromnewton.ModelBuilder.add_usd().Experimental
Experimental feature. API, behavior, defaults, and supported use cases may change without prior notice.
- class Kind(*values)#
Bases:
IntEnumHow visual samples are bound to simulation elements.
- BODY = 3#
Each vertex follows one rigid body; separate body bindings may show seams.
- PARTICLE = 0#
Each visual vertex follows one simulation particle.
- TETRAHEDRON = 2#
Each visual vertex is a weighted sum of four tetrahedron particles.
- TRIANGLE = 1#
Each visual vertex is a weighted sum of three triangle particles.
- __init__(kind, rest_vertices, indices, parent, *, weights=None, local_offsets=None, uvs=None, texture=None, world=-1, label='', index=-1)#
Store a visual mesh and its simulation binding.
- Parameters:
kind (Kind) – Simulation element kind driving the visual vertices.
rest_vertices (wp.array[wp.vec3]) – Bind-pose visual positions [m], shape [vertex_count, 3].
indices (wp.array[wp.int32]) – Flattened triangle vertex indices.
parent (wp.array[wp.int32]) – Simulation driver index for each visual vertex.
weights (wp.array[wp.vec4] | wp.array[wp.vec3] | None) – Barycentric weights for triangle or tetrahedron bindings.
local_offsets (wp.array[wp.vec3] | None) – Body-local offsets [m] for body bindings.
uvs (wp.array[wp.vec2] | None) – Per-vertex texture coordinates, or None.
texture (np.ndarray | str | None) – Albedo image array or image path, or None.
world (int) – Owning model world, or
-1for global geometry.label (str) – Display label.
index (int) – Index in
newton.Model.deformable_visual_meshes.
- property index: int#
Invariant index of this mesh in
newton.Model.deformable_visual_meshes. Read-only.
- property indices: wp.array[wp.int32]#
Flattened triangle indices into the visual vertices, shape [tri_count*3]. Read-only.
- property kind: Kind#
Embedding kind (see
DeformableVisualMesh.Kind). Read-only.
- property local_offsets: wp.array[wp.vec3f] | None#
Per-vertex offsets [m] in the parent body frame, shape [vertex_count, 3]; world positions where
parentis -1 after fixed-joint collapse. None for other binding kinds. Read-only.
- property parent: wp.array[wp.int32]#
Simulation element index per visual vertex, shape [vertex_count]. Read-only.
Indices refer to particles, triangles, tetrahedra or bodies according to
kind. A body parent of -1 fixes the vertex in world space after fixed-joint collapse.
- property rest_vertices: wp.array[wp.vec3f]#
Authored bind-pose visual vertices [m], shape [vertex_count, 3]. Read-only.
Particle bindings do not read them: each vertex is placed at its particle. Builder copies keep the authored frame, and equal arrays may be shared between meshes.
- texture#
Albedo image or path. Replace this value rather than editing image pixels in place; viewers may cache the immutable asset.
- property uvs: wp.array[wp.vec2f] | None#
Texture coordinates per visual vertex, shape [vertex_count, 2], or None. Read-only.