Simulate Cloth with Visual Thickness in Isaac Sim

Hello,

I am using Isaac Sim to simulate cloth, but I want to have cloth that has a visual thickness as shown in the picture below:

So far I’ve been able to create cloth that has thickness from a Cube mesh like the picture above. The issue is that this cloth acts like an inflatable, which I don’t want.

Is there any way to have visually thick cloth in Issac Sim currently?

I am using the code below to create the cloth:

scene_path = Sdf.Path("/physicsScene")
stage = get_current_stage()
default_prim_path = Sdf.Path("/World")

x_scale = 1.0
y_scale = 1.0
z_scale = 0.03
x_resolution = 25
y_resolution = int((x_resolution/x_scale) * y_scale)
z_resolution = 1

success, tmp_path = omni.kit.commands.execute(
    "CreateMeshPrimWithDefaultXform",
    prim_type="Cube",
    u_patches=x_resolution,
    v_patches=y_resolution,
    w_patches=z_resolution,
    u_verts_scale=1,
    v_verts_scale=1,
    w_verts_scale=1,
)

if not success:
    raise SystemExit("Error")

cloth_mesh_path = Sdf.Path(omni.usd.get_stage_next_free_path(stage, "/Cloth", True))
omni.kit.commands.execute("MovePrim", path_from=tmp_path, path_to=cloth_mesh_path)

cloth_mesh = UsdGeom.Mesh.Define(stage, cloth_mesh_path)
physicsUtils.setup_transform_as_scale_orient_translate(cloth_mesh)
physicsUtils.set_or_add_translate_op(cloth_mesh, Gf.Vec3f(0.0, 0.0, 10.0))
physicsUtils.set_or_add_orient_op(cloth_mesh, Gf.Quatf(1, Gf.Vec3f(0.0, 0.0, 0)))
physicsUtils.set_or_add_scale_op(cloth_mesh, Gf.Vec3f(x_scale, y_scale, z_scale))

# configure and create particle system
# we use all defaults, so the particle contact offset will be 5cm / 0.05m
# so the simulation determines the other offsets from the particle contact offset
particle_system_path = default_prim_path.AppendChild("particleSystem")

# size rest offset according to plane resolution and width so that particles are just touching at rest
radius = 0.5 * (z_scale / z_resolution / 2)
restOffset = radius
contactOffset = restOffset * 1.5

particleUtils.add_physx_particle_system(
    stage=stage,
    particle_system_path=particle_system_path,
    contact_offset=contactOffset,
    rest_offset=restOffset,
    particle_contact_offset=contactOffset,
    solid_rest_offset=restOffset,
    fluid_rest_offset=0.0,
    solver_position_iterations=16,
    simulation_owner=scene_path,
)

# create material and assign it to the system:
particle_material_path = default_prim_path.AppendChild("particleMaterial")
particleUtils.add_pbd_particle_material(stage, particle_material_path)
# add some drag and lift to get aerodynamic effects
particleUtils.add_pbd_particle_material(stage, particle_material_path, drag=0.1, lift=0.3, friction=0.6)
physicsUtils.add_physics_material_to_prim(
    stage, stage.GetPrimAtPath(particle_system_path), particle_material_path
)

# configure as cloth
stretchStiffness = 10000.0
bendStiffness = 200.0
shearStiffness = 100.0
damping = 0.2
particleUtils.add_physx_particle_cloth(
    stage=stage,
    path=cloth_mesh_path,
    dynamic_mesh_path=None,
    particle_system_path=particle_system_path,
    spring_stretch_stiffness=stretchStiffness,
    spring_bend_stiffness=bendStiffness,
    spring_shear_stiffness=shearStiffness,
    spring_damping=damping,
    self_collision=True,
    self_collision_filter=True,
)

# configure mass:
cloth_density = 1000
mass = (x_scale * y_scale * z_scale) * cloth_density
num_verts = len(cloth_mesh.GetPointsAttr().Get())
massApi = UsdPhysics.MassAPI.Apply(cloth_mesh.GetPrim())
massApi.GetMassAttr().Set(mass)

def create_pbd_material(mat_name: str, color_rgb: Gf.Vec3f = Gf.Vec3f(0.2, 0.2, 0.8)) -> Sdf.Path:
    # create material for extras
    create_list = []
    omni.kit.commands.execute(
        "CreateAndBindMdlMaterialFromLibrary",
        mdl_name="OmniPBR.mdl",
        mtl_name="OmniPBR",
        mtl_created_list=create_list,
        bind_selected_prims=False,
    )
    target_path = "/World/Looks/" + mat_name
    if create_list[0] != target_path:
        omni.kit.commands.execute("MovePrims", paths_to_move={create_list[0]: target_path})
    shader = UsdShade.Shader.Get(get_current_stage(), target_path + "/Shader")
    shader.CreateInput("diffuse_color_constant", Sdf.ValueTypeNames.Color3f).Set(color_rgb)
    return Sdf.Path(target_path)

# add render material:
material_path = create_pbd_material("OmniPBR")
omni.kit.commands.execute(
    "BindMaterialCommand", prim_path=cloth_mesh_path, material_path=material_path, strength=None
)

world.render()

Hi @itchuang,

Sorry for the late answer. There is no support for skinning meshes to cloth right now. You will have to implement that yourself.

Cheers,
Simon

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.