newton.solvers.VBDSolver#

class newton.solvers.VBDSolver(model, iterations=10, handle_self_contact=False, self_contact_radius=0.2, self_contact_margin=0.2, integrate_with_external_rigid_solver=False, penetration_free_conservative_bound_relaxation=0.42, friction_epsilon=1e-2, vertex_collision_buffer_pre_alloc=32, edge_collision_buffer_pre_alloc=64, collision_detection_interval=0, edge_edge_parallel_epsilon=1e-5, use_tile_solve=True)[source]#

Bases: SolverBase

An implicit solver using Vertex Block Descent (VBD) for cloth simulation.

References

  • Anka He Chen, Ziheng Liu, Yin Yang, and Cem Yuksel. 2024. Vertex Block Descent. ACM Trans. Graph. 43, 4, Article 116 (July 2024), 16 pages. https://doi.org/10.1145/3658179

Note

VBDSolver requires particle coloring information through newton.Model.particle_color_groups. You may call newton.ModelBuilder.color() to color particles or use newton.ModelBuilder.set_coloring() to provide you own particle coloring.

Example

# color particles
builder.color()
# or you can use your custom coloring
builder.set_coloring(user_provided_particle_coloring)

model = builder.finalize()

solver = newton.solvers.VBDSolver(model)

# simulation loop
for i in range(100):
    solver.step(state_in, state_out, control, contacts, dt)
    state_in, state_out = state_out, state_in
__init__(model, iterations=10, handle_self_contact=False, self_contact_radius=0.2, self_contact_margin=0.2, integrate_with_external_rigid_solver=False, penetration_free_conservative_bound_relaxation=0.42, friction_epsilon=1e-2, vertex_collision_buffer_pre_alloc=32, edge_collision_buffer_pre_alloc=64, collision_detection_interval=0, edge_edge_parallel_epsilon=1e-5, use_tile_solve=True)#
Parameters:
  • model (Model) – The Model object used to initialize the integrator. Must be identical to the Model object passed to the step function.

  • iterations (int) – Number of VBD iterations per step.

  • handle_self_contact (bool) – whether to self-contact.

  • self_contact_radius (float) – The radius used for self-contact detection. This is the distance at which vertex-triangle pairs and edge-edge pairs will start to interact with each other.

  • self_contact_margin (float) – The margin used for self-contact detection. This is the distance at which vertex-triangle pairs and edge-edge will be considered in contact generation. It should be larger than self_contact_radius to avoid missing contacts.

  • integrate_with_external_rigid_solver (bool) – an indicator of coupled rigid body - cloth simulation. When set to True, the solver assumes the rigid body solve is handled externally.

  • penetration_free_conservative_bound_relaxation (float) – Relaxation factor for conservative penetration-free projection.

  • friction_epsilon (float) – Threshold to smooth small relative velocities in friction computation.

  • vertex_collision_buffer_pre_alloc (int) – Preallocation size for each vertex’s vertex-triangle collision buffer.

  • edge_collision_buffer_pre_alloc (int) – Preallocation size for edge’s edge-edge collision buffer.

  • edge_edge_parallel_epsilon (float) – Threshold to detect near-parallel edges in edge-edge collision handling.

  • collision_detection_interval (int) – Controls how frequently collision detection is applied during the simulation. If set to a value < 0, collision detection is only performed once before the initialization step. If set to 0, collision detection is applied twice: once before and once immediately after initialization. If set to a value k >= 1, collision detection is applied before every k VBD iterations.

  • use_tile_solve (bool) – whether to accelerate the solver using tile API

Note

  • The integrate_with_external_rigid_solver argument is an indicator of one-way coupling between rigid body and soft body solvers. If set to True, the rigid states should be integrated externally, with state_in passed to step function representing the previous rigid state and state_out representing the current one. Frictional forces are computed accordingly.

  • vertex_collision_buffer_pre_alloc` and edge_collision_buffer_pre_alloc are fixed and will not be dynamically resized during runtime. Setting them too small may result in undetected collisions. Setting them excessively large may increase memory usage and degrade performance.

rebuild_bvh(state)#

This function will rebuild the BVHs used for detecting self-contacts using the input state.

When the simulated object deforms significantly, simply refitting the BVH can lead to deterioration of the BVH’s quality. In these cases, rebuilding the entire tree is necessary to achieve better querying efficiency.

Parameters:

state (newton.State) – The state whose particle positions (State.particle_q) will be used for rebuilding the BVHs.

step(state_in, state_out, control, contacts, dt)#