Source-linked AI summary
DiffGIPC: Differentiable Mixed-Coordinate Contact Mechanics on GPU
Kemeng Huang, Bowen Ren, Xinyu Lu, Minchen Li, Taku komura
TL;DR
Contact-rich inverse problems need efficient gradients while preserving non-penetration, but full-space FEM can make repeated differentiation costly when nearly rigid objects retain vertex-level motion DoFs. DiffGIPC combines coupled FEM-affine adjoints, affine shape and control derivatives, and GPU computation; full-space FEM benchmarks show faster backward and combined forward-and-backward evaluation than DiffIPC.
Problem
Method
DiffGIPC differentiates coupled FEM-affine IPC simulations with twelve motion DoFs per affine body and derivatives for affine shape, initial states, and joint controls.
Source: §1 · p. 2Results
12.3–34.1× faster complete backward evaluation and 10.6–60.9× faster combined forward-and-backward evaluation than DiffIPC are reported across shared full-space FEM benchmarks.
Source: §7.1 · p. 15Takeaways & Limitations
Affine coordinates provide further savings when near-rigid motion is appropriate, while surface resolution still determines contact and assembly work.
Source: §8 · p. 21A contact pair outside the barrier’s activation range contributes no direct contact gradient, which can limit guidance when the initial trajectory does not establish the desired interaction.
Source: §8 · p. 21
Abstract
from arXiv · showhide
Contact-rich inverse problems require efficient gradients and reliable enforcement of non-penetration. Existing differentiable methods provide fast simulation and rigid-deformable coupling, but contact treatments based on penalties or velocity-level constraints can permit penetration or positional drift. Incremental Potential Contact (IPC) maintains non-penetration through geometric barriers and {continuous collision detection (CCD)}. However, repeated forward and backward evaluations remain costly in full-space finite-element (FEM) implementations, particularly when nearly rigid components retain many vertex {degrees of freedom (DoFs)}. We present DiffGIPC, a GPU-accelerated differentiable IPC framework for optimizing interacting deformable and nearly rigid bodies. Our affine-body derivatives enable {rest-shape} design, initial-state optimization, and articulated control while retaining only twelve motion DoFs per affine body. These gradients account for how changes in geometry, placement, and actuation affect other objects through collision and friction. We preserve these interactions in one coupled FEM-affine adjoint system per frame, reducing the backward-system size without discarding the dependencies that drive the inverse problem. GPU-optimized backward computation further reduces the cost of repeated gradient evaluations. A reusable PyTorch interface connects supported physical parameters to user-defined parameter maps and losses across design, identification, motion, placement, and articulated control. Experiments demonstrate peak speedups over DiffIPC of approximately 150.0x with full-space FEM and 4133.3x with affine bodies for combined forward simulation and backward differentiation.
1 Introduction
DiffGIPC combines compact affine motion coordinates with contact-coupled differentiation and GPU execution for inverse problems involving deformable and nearly rigid bodies. It preserves cross-object and temporal dependencies while supporting shape, state, and control gradients.
1 Introduction
- Each affine body contributes only twelve motion DoFs, while full-space FEM retains local deformation and contact and joint derivatives couple interacting bodies.Inertia and friction also carry dependencies on earlier states into the backward systems.Source: §1 · p. 2
- Affine-body derivatives cover rest shape, initial states, and revolute or prismatic joint controls without enlarging the adjoint system.Shape derivatives include changes to mass, contact positions, point-to-affine force maps, and previous-frame points used for friction.Source: §1 · p. 2
- Conditional CUDA Graphs keep PCG iterations and convergence checks on the GPU, while a PyTorch interface connects physical gradients to user-defined parameter maps and losses.Source: §1 · p. 2
- 12.3–34.1× faster complete backward evaluation and 10.6–60.9× faster combined forward-and-backward evaluation than DiffIPC are reported across full-space FEM benchmarks.The evaluation covers initial motion, rest shape, material, and friction optimization.Source: §1 · p. 2
- The framework is evaluated on cloth design, affine shape optimization, stable placement, and articulated control.Source: §1 · p. 3
2 Related Work
Prior work advances differentiable simulation, contact handling, and reduced motion representations, but leaves trade-offs in contact fidelity, coupling, or cost. DiffGIPC combines IPC with mixed FEM-affine coordinates and GPU computation for coupled design and control.
2 Related Work
- Penalty-based and velocity-level contact approaches have limitations for non-penetration or positional stability, while IPC uses a geometric barrier and continuous collision detection to maintain intersection-free motion from feasible initial configurations.ADD permits finite overlap, and DiffPhD’s velocity-level enforcement can produce position drift under quasi-static support.Source: §2 · p. 3
- DiffIPC supports shape, material, friction, and initial-state optimization with IPC, but its full-space representation and CPU implementation make repeated evaluations costly for stiff near-rigid components.DiffGIPC addresses this cost with coupled FEM-ABD adjoints and GPU backward computation while retaining IPC’s geometric safeguards.Source: §2 · p. 3
- Modal and adaptive subspaces reduce motion coordinates but depend on selected modes capturing load- and contact-induced deformation; ABD instead provides twelve affine DoFs for stiff parts while full-space FEM retains local deformation where needed.DiffGIPC carries both representations into a backward system that retains contact, friction, and joint coupling.Source: §2 · p. 3
- DiffGIPC focuses on mesh-based affine-body design and control with deformable objects under IPC, differentiating rest-shape effects on mass and contact maps as well as joint targets and forces.Additional design parameters do not enlarge the per-frame backward system, but contact processing still depends on surface resolution and parameter-gradient work grows with parameter count.Source: §2 · pp. 3–4
- Because IPC frame Hessians vary with deformation and contact, fixed-factor reuse is unavailable across all adjoint systems; iterative solvers and GPU IPC methods provide alternatives, with StiffGIPC supplying DiffGIPC’s forward foundation.Source: §2 · p. 4
3 A Unified Differentiable IPC Framework
The framework differentiates IPC simulations in mixed FEM and affine coordinates, mapping contact-space derivatives into one coupled adjoint system. Its trajectory formulation carries parameter effects through time while retaining compact affine motion coordinates and cross-object interactions.
3 A Unified Differentiable IPC Framework
- Collision and friction derivatives are evaluated at world-space surface points and mapped into coupled FEM-vertex and affine-body coordinates.Each affine body retains twelve motion DoFs while preserving cross-object derivatives.Source: §3 · p. 4
- Each differentiated trajectory uses fixed mesh connectivity, and each frame is an accepted time step of length h.The forward formulation builds on StiffGIPC [Huang et al. 2025a].Source: §3 · p. 4
3.1 Simulation degrees of freedom and contact points
- Affine surface vertices share twelve body DoFs, so adding vertices can increase contact work without enlarging the affine body’s block in the linear system.Rest coordinates are design parameters rather than simulation DoFs; total motion DoFs are 12N_A + 3N_F.Source: §3.1 · p. 4
3.2 Incremental potential and its energy gradient
- Each time step minimizes an incremental potential whose terms include elastic, affine shape, collision, friction, and joint energies.Friction depends on relative tangential displacement across current and previous configurations, with dependence on previous positions included in differentiation.Source: §3.2 · p. 5
3.3 Parameter gradients from the step equation
- Differentiating the stationarity condition yields parameter gradients through an adjoint solve rather than explicitly forming the derivative of solved DoFs with respect to every parameter.All parameter gradients for a single step share the same coupled FEM-affine adjoint; the formulation extends through time.Source: §3.3 · p. 5
3.4 Collision and friction derivatives across representations
- The squared-log GIPC collision barrier uses continuous collision detection to truncate Newton steps and prevent intersections, followed by line search for decreasing incremental potential.Backward differentiation uses the converged frame state and associated collision and friction data.Source: §3.4 · p. 5
- Collision and friction contribute cross-blocks between affine and FEM coordinates, while joints couple affine bodies, allowing a loss on one object to influence another’s parameters.The compact affine coordinates reduce system size without removing these interaction terms.Source: §3.4 · p. 6
4 Frame-Wise Adjoint
The frame-wise adjoint differentiates a coupled FEM-affine trajectory by solving one system per frame in reverse time. It propagates effects through inertia and friction while accumulating gradients for physical parameters and initial states.
4.1 Equations for the whole trajectory
- Causality makes the trajectory Jacobian block lower triangular, so transposing it yields a reverse-time solve that accounts for later states depending on earlier motion.The algorithm does not form the full trajectory sensitivity matrix.Source: §4.1 · pp. 6–7, §4.2 · p. 7
4.2 Reverse-time adjoint equations
- Each frame’s right-hand side combines its direct loss gradient with contributions propagated from later frames before its adjoint is solved.The adjoint contributes to parameter gradients, while derivatives with respect to earlier states update their right-hand sides.Source: §4.3 · p. 7, §4.2 · p. 7
4.3 Computing one coupled system per frame
- One coupled FEM-affine adjoint solve per reverse frame preserves within-frame interactions and propagates their effects to earlier states and parameters.Only the current frame’s Hessian is retained during the reverse traversal; the trajectory length determines the number of frame solves.Source: §4 · p. 6, §4.3 · p. 7
4.4 Inertia and initial-state dependencies
- Inertia propagates adjoint contributions to earlier predictor states, while optimized initial configuration and velocity contribute directly to parameter gradients.For the dynamic predictor shown, inertia and friction contribute to b_(t−1), and inertia contributes −Mλ_t to b_(t−2).Source: §4.4 · pp. 7–8, Figure 3 · p. 8
4.5 Friction between frames
- Friction creates temporal dependence because its energy uses current displacement and contact quantities computed from the previous configuration.Previous-frame interpolation weights, tangent basis, and normal force are differentiated with respect to previous-frame positions.Source: §4.5 · p. 8
5 Affine-Body Derivatives for Shape, Initial States, and Control
The paper derives affine-body parameter gradients while keeping each body’s motion representation at twelve DoFs. The derivatives cover rest shape, initial states, and joint actuation, including their effects on inertia and contact-mediated motion.
5.1 Rest-dependent mass and inertia
- Affine-body mass and shape derivatives are computed directly from the closed design surface, without an interior tetrahedral discretization.Signed triangle contributions provide the volume integrals used for the mass matrix and its shape derivative.Source: §5.1 · pp. 8–9
5.2 Rest-shape gradients
- Rest-shape gradients include changes to mass and inertia, surface-to-body contact maps, and current- and previous-frame friction geometry.The friction derivative accounts for changes in sliding displacement, interpolation weights, tangent basis, and normal force; surface losses also have a direct geometric contribution.Source: §5.2 · pp. 9–10
5.3 Initial-state gradients
- Initial configuration and velocity gradients include inertial history and, for initial configuration, the first-frame friction dependence.Initial states are simulation inputs, so their contributions enter parameter-gradient updates rather than an earlier-frame right-hand side.Source: §5.3 · p. 10
5.4 Joint targets and forces
- Joint-target and force derivatives use the same coupled adjoint as shape and initial-state parameters.Although the local control derivative involves two joint-connected bodies, the coupled adjoint includes their response through contact with the rest of the scene.Source: §5 · p. 8, §5.4 · p. 11
6 GPU Backward and Reusable Interface
The GPU backward pipeline assembles and solves a coupled adjoint system at each reverse frame, then exposes physical gradients through a reusable PyTorch interface.
6 GPU Backward and Reusable Interface
- A PyTorch interface connects physical gradients to user-defined parameter maps and losses.The backward pipeline parallelizes local derivative products and gradient accumulation on the GPU.Source: §6 · p. 11
6.1 PCG with conditional CUDA Graphs
- The backward pass assembles each frame’s Hessian from its converged FEM and affine states and keeps it fixed during that frame’s PCG solve.Assembly includes element, body, collision, friction, joint, and FEM-affine cross terms.Source: §6 · p. 11
- The same highly parallel GPU PCG solver serves forward and backward computations because the adjoint uses the converged forward frame Hessian.Compact affine coordinates reduce PCG’s numerical workload.Source: §6.1 · p. 11
5. Stop or repeat
Conditional CUDA Graphs keep PCG iteration and convergence checks on the GPU, while the broader pipeline accumulates local gradients and maps them to task-specific optimizer variables.
5. Stop or repeat
- Conditional CUDA Graphs run PCG iterations and convergence checks on the GPU until convergence or the iteration limit, removing per-iteration CPU coordination.Frame restoration, Hessian assembly, and gradient accumulation remain outside the graph; both execution modes use the same recurrence and stopping criterion.Source: §5 · p. 12, Figure 5 · p. 12
6.2 GPU-parallel gradient accumulation
- After each frame solve, independent local derivative products are evaluated in parallel, while reverse frames remain ordered by their temporal dependencies.For a fixed trajectory and scalar loss, selected parameters share the same frame adjoints, so adding parameters requires local derivative computation rather than additional coupled solves.Source: §6.2 · pp. 12–13
6.3 A reusable interface for inverse problems
- The parameter map and output map let task-specific designs and losses change without changing the coupled backward equations.A loss on one object can guide optimization of another object’s parameters through physical interactions.Source: §6.3 · p. 13
7 Evaluation
The evaluation assesses DiffGIPC’s parameter-to-output dependencies and computational costs across full-space FEM benchmarks and affine design and control tasks, including gradient validation and representation studies. It also examines the effects of CUDA Graphs and compares ABD and FEM evaluation costs at fixed surface discretization.
7.1 Comparison with DiffIPC
- On shared full-space FEM benchmarks, complete backward passes are 12.3–34.1× faster; combined forward-and-backward speedups range from 10.6× for friction fitting to 60.9× for material fitting.Forward speedups range from 10.5× to 88.1×.Source: §7.1 · p. 15, Table 1 · p. 16
7.2 Rest-shape design and stable placement
- Rest-shape and placement optimizations use coupled trajectory gradients: cloth fitting matches target drape, hanger design preserves strap support, and seven affine stones form stable contact-supported stacks.The hanger retained both straps in two independent 600-frame checks; the stones use 84 motion DoFs and were tested in separate 1,000-frame simulations.Source: §7.2 · pp. 15–17
7.3 Articulated control
- Articulated control optimizes contact-aware commands for grasp-angle tracking, cup catching through plate motion, and dual-arm towel lifting via a vertical offset tuned to normal force.The grasp target optimized to 0.447843 rad; cup catching jointly optimized 700 joint-target variables, and the towel grasp succeeded after seven updates.Source: §7.3 · pp. 17, 19, 20
7.4 Gradient validation and representation studies
- Analytic gradients were checked against centered finite differences at initial parameters, using the first 10 frames for shared benchmarks and task-specific windows for other checks.Table 2 reports the finite-difference checks for DiffGIPC examples and shared DiffIPC benchmarks.Source: §7.4 · p. 20, Table 2 · p. 20
- DiffGIPC FEM+FEM speedup over DiffIPC grows from 25.4× to 150.0× across resolutions, while ABD+ABD reaches 4133.3× over DiffIPC FEM+FEM at the highest resolution.At the highest resolution, ABD+ABD is about 27× faster than DiffGIPC FEM+FEM in forward-plus-backward time; backward linear solves take 2.3 versus 0.0044 s, and complete backward evaluations take 2.5 versus 0.048 s.Source: §7.4 · p. 20
- At fixed surface discretization, ABD cost 7.1 s versus FEM’s 16 s for forward plus backward evaluation, a 2.2× speedup; backward costs were 0.27 versus 1.0 s.The optimized control-point scales (sx, sy) were (0.8285, 0.8000) for ABD and (0.8301, 0.8000) for FEM. FEM added 902 interior vertices and 18,256 tetrahedra; ABD retained compact motion coordinates and differentiated mass from the surface.Source: §7.4 · p. 20
7.5 GPU execution and optimization cost
- CUDA Graphs provided 1.4–1.8× speedups in forward PCG and 1.3–1.8× in backward PCG over conventional kernel launches, with the PCG recurrence and convergence criterion unchanged.The gains reduce kernel-launch overhead and CPU–GPU synchronization within the iterative solve.Source: §7.5 · p. 20
- 1.2–1.5× speedups in combined forward and backward evaluations were achieved across all reported tasks, including collision detection, Hessian assembly, line search, and derivative accumulation.PCG was the largest contributor to backward time in most tasks, making the adjoint solver a major source of gradient-evaluation savings.Source: §7.5 · p. 20
- CUDA Graphs also accelerate candidate-parameter and verification forward simulations; grasp-angle optimization used 44 forward and 20 backward evaluations.The graph-based forward solver serves both gradient-computation trajectories and additional objective checks and verification runs; compact coordinates and graph-based execution provide complementary benefits.Source: §7.5 · pp. 20–21
8 Conclusion and Discussion
DiffGIPC combines mixed-coordinate trajectory adjoints and GPU execution while preserving contact, friction, and joint coupling. Its efficiency is bounded by surface-resolution work and by the contact information available along a differentiated trajectory.
8 Conclusion and Discussion
- DiffGIPC combines mixed-coordinate trajectory adjoints with GPU execution, and affine coordinates add savings when near-rigid motion is appropriate.Surface resolution still determines contact and assembly work.Source: §8 · p. 21
- Contact pairs and closest-feature choices recorded during forward simulation limit direct contact gradients when objects remain outside the barrier activation range.Rest-shape derivatives also assume fixed connectivity within each differentiated trajectory; remeshing decisions and vertex transfers are not differentiated.Source: §8 · p. 21
- Table 4 reports complete optimization workloads and mean phase times, distinguishing forward evaluations from complete gradient evaluations.Its caption defines Linear as PCG plus Others and Hessian as local plus global assembly.Source: Table 4 · p. 22
- Table 5 compares CUDA Graph-enabled and disabled mean evaluation times, including combined forward and backward totals.Its caption distinguishes the Linear and Other time categories.Source: Table 5 · p. 22
- Adapting alternative contact-gradient approaches to coupled FEM-affine dynamics and evaluating accuracy, convergence, and computational cost remain future work.The discussion names geometric contact potentials, long-range contact potentials, and randomized smoothing as possible directions.Source: §8 · p. 22
A Derivatives for the Coupled FEM–Affine Adjoint
This appendix derives local derivatives for the coupled FEM–affine adjoint, assembling frame Hessians and accumulating parameter and earlier-state gradients across contact, friction, elasticity, inertia, bending, and joints. These derivatives preserve cross-body effects and support gradients for rest shape, mass, elastic response, and joint control.
A.1.1 Smoothed friction energy.
- Smoothed friction uses current-step sliding with contact weights, plane orientation, and barrier normal force determined from previous-frame geometry.The previous-frame normal force is held fixed during the current-position derivative, while smoothing avoids the zero-slip nondifferentiability.Source: §A.1.1 · pp. 24–25
A.1.2 Friction-coefficient and history derivatives.
- Friction-coefficient gradients sum contributions across contacts and frames, while history derivatives propagate changes in contact weights, plane orientation, normal force, and displacement.The temporal coupling carries later friction effects back to earlier motion DoFs and, at the first frame, to initial-state gradients.Source: §A.1.2 · pp. 25–26
A.1.3 Rest-shape derivatives under friction.
- Affine rest-shape friction derivatives include changes to contact points at both current and previous frames, the point-to-DoF map, and the simulated-motion contribution from frame adjoints.The resulting direct geometry and point-map terms are combined across contacts and frames with other physical and direct-loss contributions.Source: §A.1.3 · p. 26
A.2 Volumetric FEM and cloth parameter derivatives
- Volumetric elements use stable Neo-Hookean, while cloth combines Baraff–Witkin with StiffGIPC’s cubic extension penalty.Material and rest-shape derivatives provide local gradient contributions at fixed current positions; the coupled adjoint accounts for deformation and interactions with other objects.Source: §A.2 · p. 26
A.2.1 Tetrahedral elasticity.
- Tetrahedral rest-shape derivatives account for changes in the inverse rest-edge matrix, element rest volume, and deformation-gradient Jacobian, with the adjoint mapping their effects to loss gradients.Material gradients pass through the maps from Young’s modulus and Poisson’s ratio to the energy coefficients.Source: §A.2.1 · p. 27
- Tetrahedral elasticity derivatives include the cubic extension penalty in stress and Hessian, and map constitutive and rest-shape changes through the element reference map and integration weight.Rest-shape changes affect both the constitutive stress and the assembly map.Source: §A.2.2 · pp. 27–28
A.2.3 Cloth bending derivatives.
- Cloth bending derivatives account for rest-area normalization and cotangent-weight changes, while geometry-dependent mass redistribution contributes to inertial parameter gradients accumulated through the coupled adjoint.The inertial contribution includes changes in mass weights and in parameter-dependent predictor positions or velocities.Source: §A.2.3 · p. 28
A.3 Joint geometry and control derivatives
- Joint targets and forces enter the same frame equations as collision and friction, and affine-coordinate derivatives preserve cross-body Hessian blocks linking commands to interacting FEM and affine responses.Joint anchors, reference directions, and stiffnesses are fixed when differentiating control parameters.Source: §A.3 · p. 28
A.3.1 Local maps and geometric constraints.
- Affine maps make point- and direction-matching joint residuals linear in motion coordinates, while prismatic cross-product residuals add cross-body Hessian terms.Revolute joints match two hinge-line points; prismatic joints constrain anchor separation along joint axes and match transverse directions.Source: §A.3.1 · pp. 28–29
A.3.2 Prismatic displacement.
- Prismatic displacement derivatives include motion of both anchors and the moving joint axis, while bilinear revolute-orientation quantities yield explicit gradients and constant cross-body Hessian blocks.For aligned rigid reference frames, the orientation quantities equal the sine and cosine of the relative angle; their affine derivatives also retain changes in transformed-vector lengths.Source: §A.3.2 · p. 29, §A.3.3 · p. 29
A.3.4 Control derivatives and coupled assembly.
The control derivatives differentiate joint energies with respect to targets and forces, then assemble them into shared frame adjoints. Task-specific parameter families contribute local derivatives to that coupled computation.
A.3.4 Control derivatives and coupled assembly
- Prismatic control derivatives with respect to target and force are −k and −1, while revolute target derivatives follow from derivatives of the sine and cosine terms.The resulting state-gradient derivatives are substituted into the product rule for the revolute target Hessian.Source: §A.3.4 · p. 29
- Table 6 lists simulation settings by task, including time step, collision and friction parameters, motion DoFs, solver tolerance, and material parameters.Dual-arm grasp uses friction coefficients of 0.3 for arm–cloth and 0.2 for cloth–table contact.Source: Table 6 · p. 30
- Table 7 summarizes the physical parameter families exposed through the interface, with each family contributing local derivatives to the shared coupled adjoint.Source: Table 7 · p. 30
- Joint-connected bodies couple through off-diagonal Hessian blocks, while contact blocks couple them to the rest of the scene; shared controls accumulate across joints and frames using the same frame adjoints.Selected controls do not require separate coupled solves.Source: §A.3.4 · p. 30
B Experimental Settings and Parameters
The experiments use task-specific losses, observation frames, and stopping events to define differentiated trajectories and assess resulting motion. Settings and parameter families vary by task, while the shared FEM timing benchmarks use aligned convergence tolerances.
B Experimental Settings and Parameters
- Task losses set observation frames and optimization stopping events; where optimization and verification are separate, the full listed horizon assesses the resulting motion.Forward and backward evaluation counts follow the definitions in Section 7.Source: B Experimental Settings and Parameters · p. 30
- The settings define collision activation distance, barrier and affine stiffness coefficients, friction-smoothing scale, and the Newton stopping criterion using scene-scale and time-step quantities.The passage identifies the stopping-criterion setup but does not provide its completed expression.Source: B Experimental Settings and Parameters · p. 30
- Shared FEM benchmarks use the same convergence tolerances, with forward PCG relative residual tolerance 10^-4.Source: B Experimental Settings and Parameters · p. 30
- Task-specific design variables map to material response, geometry, initial motion, and actuation, with affine rest-shape derivatives including coupled contact and active friction effects.FEM rest-shape configurations use free FEM vertex positions.Source: B Experimental Settings and Parameters · p. 30