Manuscript Offprint
arXiv:2610.19091DiffGIPC: Differentiable Mixed-Coordinate Contact Dynamics on GPU
KEMENG HUANG, The University of Hong Kong, Hong Kong SAR, China
BOWEN REN, The University of Hong Kong, Hong Kong SAR, China
XINYU LU, TransGP, Hong Kong SAR, China
MINCHEN LI, Carnegie Mellon University, USA
TAKU KOMURA, The University of Hong Kong, Hong Kong SAR, China

(a) Initial placement

(b) Iteration 10

(c) Iteration 50

(d) Iteration 78
Fig. 1. Optimizing the placement of seven affine bodies. Keeping their shapes fixed, DiffGIPC adjusts only the horizontal initial positions to form a stable stack. The panels show the unoptimized configuration and the simulated results after 10, 50, and 78 iterations.
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 with full-space FEM and with affine bodies for combined forward simulation and backward differentiation.
CCS Concepts: • Computing methodologies → Physical simulation; Parallel algorithms.
Additional Key Words and Phrases: differentiable simulation, contact, affine body dynamics, finite elements, GPU simulation, articulated control, inverse design
1 Introduction
Gradient-based design, system identification, and control often optimize one object's parameters for their effect on another object. A hanger's shape determines whether a garment remains supported. An initial velocity determines where another body moves after collision, and a robot command changes the motion of a grasped deformable object. In each case, the gradient must follow forces transmitted through contact and the subsequent motion. Computing these derivatives efficiently is particularly challenging when a scene combines deformable objects with detailed, nearly rigid components: the representation must resolve the interactions without making every stiff component expensive to differentiate.
Existing methods address different parts of this problem. Differentiable projective-dynamics methods, including DiffPD and DiffCloth [Du et al. 2021; Li et al. 2022], accelerate repeated solves through local-global iterations and matrix prefactorization. Representing nearly rigid components as stiff deformable meshes nevertheless retains vertex-level motion DoFs, increasing simulation
Authors' Contact Information: Kemeng Huang, kmhuang@connect.hku.hk, kmhuang819@gmail.com, The University of Hong Kong, Hong Kong, Hong Kong SAR, China; Bowen Ren, boweyna@gmail.com, The University of Hong Kong, Hong Kong, Hong Kong SAR, China; Xinyu Lu, lxy819469559@gmail.com, TransGP, Hong Kong, Hong Kong SAR, China; Minchen Li, minchernl@gmail.com, Carnegie Mellon University, Pittsburgh, USA; Taku Komura, taku@cs.hku.hk, The University of Hong Kong, Hong Kong, Hong Kong SAR, China.
Huang et al.

Fig. 2. DiffGIPC's backward pipeline. Each reverse frame assembles one coupled FEM-ABD adjoint system, retaining collision, friction, and joint interactions with twelve DoFs per affine body. The GPU solve and local accumulation propagate gradients to earlier states and physical parameters for optimization through PyTorch.
and differentiation costs even when only near-rigid motion is required [Lai et al. 2026]. ADD [Geilinger et al. 2020] provides fully implicit, two-way coupled rigid and deformable dynamics with analytic adjoints, but uses penalty-based normal contact, which does not strictly prevent interpenetration. DiffIPC [Huang et al. 2024c] differentiates fully implicit FEM dynamics with friction, using IPC barriers and continuous collision detection to maintain non-penetration. Its full-space representation, however, carries the motion DoFs of every stiff component into the backward solve, making repeated evaluations costly in its CPU implementation. The resulting opportunity is to combine contact-coupled differentiation with compact motion coordinates and efficient GPU execution.
We present DiffGIPC, a GPU-accelerated framework for differentiating coupled FEM-affine IPC simulations (Figure 2). Building on the forward formulation of StiffGIPC [Huang et al. 2025a], we derive frame-wise adjoints directly in the mixed motion coordinates. Full-space FEM retains the freedom needed for local deformation, while each affine body contributes only twelve motion DoFs regardless of its surface resolution. Contact and joint derivatives couple interacting bodies within each frame. Inertia and friction make the time integration equations depend on earlier states. The backward systems therefore remain compact while preserving cross-object coupling and the temporal dependencies required for coupled inverse problems.
Compact motion coordinates alone do not provide shape or control gradients. Changing an affine rest surface changes its mass, the positions at which contact is evaluated, and the maps that convert point-space forces to affine coordinates. Under friction, the same rest change also moves the previous-frame points used to define sliding and the lagged contact quantities. We differentiate these dependencies explicitly, together with initial states and revolute or prismatic joint controls, and accumulate them in parallel without enlarging the adjoint system. To retain the advantage of compact systems, conditional CUDA Graphs are employed to keep preconditioned conjugate gradient (PCG) iterations and convergence checks on the GPU, thereby reducing the overhead of repeated kernel launches and CPU-GPU synchronization. A PyTorch interface connects these physical gradients to user-defined parameter maps and losses.
In summary, our contributions are:
• Coupled FEM-affine adjoints for differentiable IPC. We derive trajectory adjoints in mixed FEM and affine coordinates, preserving contact, friction, and joint coupling while using only twelve motion DoFs per affine body.
• Affine-body derivatives for shape design and articulated control. We derive gradients for affine rest shapes, initial states, and joint controls, including shape-dependent inertia and frictional contact.
• A reusable GPU optimization pipeline. We develop a GPU-parallel adjoint and gradient-accumulation pipeline with conditional CUDA Graphs and a PyTorch interface for design, system identification, and control.
• Fully GPU-parallel differentiable IPC. We present the first fully GPU-parallel differentiable IPC framework for coupled nearly rigid and deformable bodies, with substantial speedups demonstrated across contact-rich inverse problems.
Our evaluation examines the benefits of GPU execution and compact motion representations across contact-rich inverse problems. For comparison with DiffIPC, we retain full-space FEM in both systems and use relatively low-resolution benchmarks to keep evaluation times manageable for the CPU-based baseline. Even at these resolutions, DiffGIPC achieves 12.3–34.1× speedups in complete backward evaluation and 10.6–60.9× speedups in combined forward and backward evaluation, covering initial motion, rest shape, material, and friction optimization. A separate resolution study examines how performance scales with geometric detail and the additional benefit of affine coordinates. Further experiments demonstrate cloth design, affine shape optimization, stable placement, and articulated control. The source code of our framework will be released.
For contact-rich inverse problems, these computational benefits must also be considered alongside the contact response being differentiated. DiffPD's penalty formulation supports frictional sliding but permits interpenetration, whereas its complementarity formulation enforces non-penetration under a sticky-contact assumption [Du et al. 2021]. DiffCloth differentiates the dry-friction PD formulation of Ly et al. [2020], supporting sliding cloth contact [Li et al. 2022]. However, its self-collision treatment considers only vertex-vertex pairs and does not handle vertex-face or edge-edge self-collisions. DiffPhD supports Signorini-Coulomb contact on the GPU, but its velocity-level enforcement can produce position drift under quasi-static support [Lai et al. 2026]. These limitations are particularly relevant when the optimized behavior depends on sustained support, sliding, or contact between thin surfaces. They motivate efficient differentiation of contact models that preserve geometric non-penetration throughout the simulated motion.
Differentiable contact and coupled dynamics. Qiao et al. [2020] enable differentiable two-way coupling between rigid bodies and cloth, using local impact zones to reduce the cost of collision handling and differentiation. ADD provides fully implicit rigid-deformable coupling with analytic adjoints [Geilinger et al. 2020]. Its normal penalty makes contact differentiable while allowing finite overlap. Increasing the penalty stiffness reduces overlap at the cost of poorer conditioning. IPC instead combines a geometric barrier with continuous collision detection to maintain intersection-free motion from feasible initial configurations [Li et al. 2020]. DiffIPC brings this contact model to differentiable FEM simulation and supports shape, material, friction, and initial-state optimization [Huang et al. 2024c]. It therefore provides a strong basis for inverse problems in which penetration would change the intended interaction. However, representing nearly rigid components with highly stiff, full-space FEM retains vertex-level motion DoFs even when their local deformation is negligible. In its CPU-based implementation, repeated simulation and differentiation of these large systems remain costly. DiffGIPC addresses this cost with coupled FEM-ABD adjoints and GPU backward computation while retaining IPC's geometric contact safeguards.
Compact coordinates for coupled design and control. Reducing motion DoFs addresses a cost that faster linear algebra alone does not remove. Modal and adaptive subspaces reduce deformable motion to a smaller set of directions [Barbič and James 2005; Trusty et al. 2024]. Their accuracy depends on whether those directions capture the deformation induced by loads and contact. Hyper-reduced PD also approximates local constraint projections [Brandt et al. 2018], while subspace mixed FEM combines reduced positions with stretch variables to handle heterogeneous materials [Trusty et al. 2023]. These approaches retain selected deformation modes and reduce their evaluation cost. For components whose internal deformation is negligible, rigid-body coordinates avoid resolving these modes altogether. Rigid IPC preserves non-penetration in this representation by accounting for curved rotational trajectories in collision detection [Ferguson et al. 2021]. ABD relaxes exact rigidity through a stiff orthogonality energy and uses twelve affine DoFs per body [Lan et al. 2022]. Its surface positions are linear in these DoFs, allowing piecewise-linear collision trajectories and a pose-independent mass matrix at fixed rest geometry. This offers a compact representation for stiff parts, while full-space FEM retains local deformation where it is needed. DiffGIPC carries both representations into the same backward system, retaining contact, friction, and joint coupling between bodies.
Compact rigid-body states have supported differentiable learning and control [Belbute-Peres et al. 2018; Degrave et al. 2019], including articulated dynamics in Nimble [Werling et al. 2021]. Shape optimization requires an additional distinction between the motion representation and the geometry being designed. Contact-based assemblies and shock-protecting microstructures [Huang et al. 2024b; Tozoni et al. 2021] use geometric changes to alter load transfer and contact-dependent mechanical response. Pneumatic actuator design and garment reconstruction [Gjoka et al. 2024; Li et al. 2025] likewise optimize rest geometry through its effect on deformation. These applications motivate retaining a rich design space even when the motion state can be compact.
SDRS uses convex polyhedra and auxiliary separating planes to maintain differentiability under large shape changes [Ye et al. 2025]. Our focus is mesh-based design and control of affine bodies interacting with deformable objects under IPC. Affine rest-shape changes affect both the mass matrix and the maps from affine DoFs to surface points. Differentiating these dependencies allows a body's shape to be optimized for its frictional interactions with other objects. Derivatives of joint targets and forces likewise account for the coupled response of articulated and deformable bodies. For a fixed motion representation, additional design parameters do not enlarge the
Huang et al.
per-frame backward system. Each affine body therefore contributes only twelve motion DoFs, even when its rest shape is described by many design parameters. Contact processing still depends on surface resolution, while parameter-gradient evaluation requires additional work as the number of design parameters grows.
GPU computation for trajectory adjoints. Compact coordinates reduce adjoint system size, while efficient linear solvers further reduce the cost of trajectory differentiation. PD-based local-global methods exploit a fixed global matrix to reuse precomputed factors. Zeng et al. [2025] use a sparse representation of its inverse to accelerate GPU forward simulation. DiffPhD adopts this strategy for differentiable simulation, reusing an inverse factor across forward, backward, and frictional-contact computations [Lai et al. 2026]. In IPC, however, the frame Hessian varies with deformation and contact, so a fixed factorization cannot be reused across all adjoint systems along a trajectory. Preconditioned iterative solvers provide an alternative, with effective preconditioning reducing the number of iterations [Chen et al. 2021; Wu et al. 2022]. GIPC parallelizes IPC computation [Huang et al. 2024a], while StiffGIPC provides efficient FEM-ABD coupling and GPU solvers across a wide range of stiffnesses [Huang et al. 2025a], and AGIPC further reduces GPU linear-solve costs through adaptive in-solve algebraic coarsening [Wang et al. 2026]. These methods advance GPU IPC efficiency, with StiffGIPC supplying the forward simulation foundation for our work.
DiffGIPC combines coupled frame-wise adjoint solves with parallel gradient accumulation on the GPU. Compact affine coordinates reduce PCG's numerical workload, making repeated CPU kernel launches and convergence synchronization more prominent. Conditional CUDA Graphs reduce this overhead by keeping iteration control and convergence checks on the GPU, with compatible graphs reused across frames as the Hessian changes. After each solve, local derivative products are accumulated in parallel to compute physical-parameter gradients and update earlier-frame adjoint right-hand sides.
3 A Unified Differentiable IPC Framework
The framework separates the coordinates needed to describe contact geometry from those needed to solve motion. Collision and friction derivatives are evaluated at world-space surface points and mapped into a coupled system of FEM vertex positions and affine body coordinates. This preserves cross-object derivatives while assigning twelve motion DoFs to each affine body.
The forward formulation builds on StiffGIPC [Huang et al. 2025a]. Simulation DoFs describe solved motion, whereas physical parameters are inputs changed by the optimizer. One frame is an accepted time step of length h, and mesh connectivity is fixed within each differentiated trajectory. The state and incremental potential below define the single-step adjoint. Section 4 extends it through time, Section 5 supplies affine design and control derivatives, and Section 6 develops their GPU computation and task interface.
3.1 Simulation degrees of freedom and contact points
A free FEM vertex is represented by its world-space position at frame . An affine body is represented by its translation and affine transformation . Let , and be the rows of . Stacking these vectors with the translation defines the body's twelve DoFs:
For a surface vertex with rest position , the world-space position is
Let denote the identity matrix and , , and the Cartesian unit vectors. With rest position fixed, the Jacobian of this position with respect to is the matrix
(3)
All surface vertices on body share the same , but each has its own rest-dependent map .
For free affine bodies and free FEM vertices, we collect the simulation DoFs in
The total number of simulation DoFs is . The set and ordering of free DoFs do not change throughout each trajectory. Adding surface vertices to an affine body can increase contact work, but does not enlarge its block in the linear system. Rest coordinates are design parameters, not additional simulation DoFs.
For contact , we collect the world-space positions of its surface points into . Let contain the free simulation DoFs. The Jacobian describes how changes in these DoFs affect the contact-point positions:
(5)
Each group of three rows corresponds to one contact point. For a free FEM vertex, its three positional DoFs appear directly in , so these rows contain an identity block in the corresponding columns. For a point on a free affine body, its position depends on the body's twelve affine DoFs through , so these rows contain in that body's columns. For each free point, columns outside its associated vertex or body block are zero. A fixed point contributes three zero rows. When differentiating with respect to the free motion DoFs, we hold the rest geometry and prescribed motion fixed. When differentiating with respect to the rest shape, we also differentiate the dependence of the affine point maps , and hence , on the rest positions (Section 5.2).
3.2 Incremental potential and its energy gradient
Let collect the physical parameters selected for optimization, such as material and friction coefficients, rest coordinates, initial states, and joint controls. Here is the number of selected scalar parameters. These parameters are held fixed during one forward simulation. A joint-control schedule can still contain different prescribed values for different frames. For a given , each time step of length h computes the simulation DoFs by minimizing the incremental potential
(6)
The first term accounts for inertia, with . The mass matrix is expressed in the simulation coordinates: it contains vertex-mass blocks for FEM and a block for each affine body. Section 5 gives the affine mass matrix and its rest-shape derivatives. The predictor is computed from earlier states and prescribed accelerations . For dynamic bodies, backward Euler (BDF1) gives
At the first step, the predictor is , where specifies the initial configuration and contains the initial FEM vertex velocities and the initial velocities of the affine coordinates.
The second term in Equation (6) sums the contributions from FEM elastic energy, affine shape energy, collision, friction, and joints. Each contribution is indexed by and written as , with energy function and scalar weight . The collision energy is the non-penetration barrier, distinct from the friction energy for tangential resistance. IPC's friction energy depends on the relative tangential displacement of the two configurations, determined by and . Its tangent bases and normal forces are held fixed from the previous-frame positions when solving for , and their dependence on those positions is included in the derivative with respect to .
At a minimum of the incremental potential, its gradient with respect to the free simulation DoFs satisfies the stationarity equation
(8)
The energy gradient is also the nonlinear residual of this equation. For each parameter choice, the forward solver finds DoFs that satisfy this stationarity condition. Differentiating the condition determines how a parameter change affects the solved DoFs and the loss evaluated on them.
3.3 Parameter gradients from the step equation
Consider first a single time step from a prescribed initial state, omitting the frame index. The solved DoFs satisfy . A parameter change affects this equation both directly and through the resulting change in y. Differentiating the stationarity equation gives
Here, G is the partial derivative of the energy gradient with respect to the physical parameters. The derivative H with respect to the DoFs is the Hessian of the incremental potential:
Both matrices are evaluated at the converged DoFs satisfying . Rather than forming explicitly, we use the adjoint below. Restoring the frame index, we denote these matrices by and .
For a scalar loss , let and denote its partial gradients with respect to the DoFs and physical parameters, respectively. The chain rule gives
Explicitly computing dy/dθ becomes costly as the number of optimized parameters grows. We avoid forming this matrix and compute the loss gradient by solving the adjoint system:
The solution is the adjoint vector. Combining this solve with Equation (9) gives the parameter gradient
For a single time step, all parameter gradients share the same coupled FEM-affine adjoint. Section 4 extends this formulation through time.
3.4 Collision and friction derivatives across representations
Collision and friction energies are evaluated at world-space surface points, whereas the adjoint in Equation (12) acts on simulation DoFs. The map from Equation (5) converts the point-space derivatives into FEM and affine coordinates. The collision energy uses GIPC's squared-log barrier on squared distance [Huang et al. 2024a]
where is the squared distance, is its activation threshold, and is the barrier coefficient. This squared-log form is the GIPC barrier, rather than the original IPC single-log form. At each Newton iteration, we truncate the step along the search direction using continuous collision detection to prevent intersections, followed by line search to ensure a decrease in the incremental potential. Backward differentiation uses the converged frame state and its associated collision and friction data.
For a contact at frame , let and denote the gradient and Hessian of the collision energy with respect to the stacked world-space point positions . The superscript denotes point coordinates, whereas denotes simulation DoFs. With rest geometry fixed, the point map from Equation (5) is constant with respect to . The chain rule therefore gives the contributions to the frame energy gradient and Hessian:
The same transformation applies to friction derivatives with respect to the current-frame DoFs. Friction derivatives with respect to earlier states are included in the trajectory calculation in Section 4.
Huang et al.
Each point contributes through the map associated with its object. For point on affine body and point on affine body , let be their point-space Hessian block. Mapping this block gives a contribution to . If the second point is instead a FEM vertex , its identity map gives a contribution to . For the point pair , the block contributions are
(16)
All surface vertices of an affine body share its twelve DoFs. The contributions of all relevant point pairs are summed into the corresponding body blocks, without introducing independent vertex DoFs. For distinct points on the same body, both ordered point-block contributions must be included when they map to the same diagonal body block.
After assembly, grouping affine (A) and finite-element (F) DoFs gives the frame Hessian
The diagonal blocks and collect derivatives within the affine and FEM coordinates. Collision and friction contribute and , while joints couple affine bodies within . These cross blocks let a loss on one object influence parameters of another. Compact affine coordinates reduce system size while the cross terms preserve the interacting response.
The same point maps form the loss-gradient vector on the right-hand side of Equation (12). For a loss evaluated on world-space surface points, its gradient with respect to the affine coordinates of body , whose surface-vertex index set is , is
For a FEM vertex, the loss gradient with respect to its DoFs equals that with respect to its world-space position. These mappings hold with rest geometry fixed. Section 5.2 includes the additional dependence of the point maps and surface positions on rest shape. Section 4 extends this coupled adjoint to trajectories, where earlier states affect both later motion and the loss.
4 Frame-Wise Adjoint
The single-step adjoint captures interactions at one frame. A trajectory also depends on how earlier motion changes later inertia and friction. We account for these dependencies by backward substitution through the causal sequence of frame equations. Each reverse frame solves one coupled FEM-affine system, then contributes to the parameters and earlier states that influenced it. Algorithm 1 summarizes this recurrence. We derive its temporal structure and then specify the inertia and friction terms, using the converged states and recorded data that define the forward equations.
4.1 Equations for the whole trajectory
Let contain the free simulation DoFs in the order defined in Section 3.1. The equation at frame depends on its current state,
Algorithm 1 Frame-wise adjoint for a converged trajectory
Input: Converged states and their frame data, and loss partial gradients and (§4.2)
Output: Parameter gradient
1: for ; (§4.3)
2: (§4.2)
3: Restore frame 's converged state and earlier-frame data
4: Assemble the coupled Hessian
5: Solve (§4.3)
6: (§4.3)
Include optimized initial-state derivatives in (§4.4)
7: for each earlier solved frame affecting do (§4.1)
8:
Inertia: §4.4, and friction: §4.5
9: end for
10: end for
11: return
a subset of earlier solved states, and the physical parameters:
The set identifies those earlier frames. The initial state is an input rather than a solved frame: its optimized components contribute to , while unselected components remain fixed. Prescribed joint commands likewise enter through the applied controls. The matrices and retain their state and parameter definitions from Section 3.3. Temporal dependence introduces the additional derivative
Thus describes the coupled response within frame , whereas describes its dependence on an earlier state and vanishes for . Both current and earlier solved states vary with . Differentiating Equation (19) includes these changes together with the direct parameter derivative:
With , the equations for all frames form the block system
Causality makes block lower triangular, with the frame Hessians on the diagonal and nonzero off-diagonal blocks only for dependencies in .
The predictor in Equation (7) depends on and . Friction adds to the first of these dependencies, through . For the first three solved frames, the system is
This three-frame system illustrates the reverse calculation below. The sensitivities and the assembled trajectory matrix are used for the derivation, but are not formed by the backward algorithm.
4.2 Reverse-time adjoint equations
We extend the single-step adjoint in Equation (12) to the trajectory loss . Let denote its partial gradient with respect to the simulation DoFs at frame , and let denote its partial parameter gradient with all simulated states fixed. For a loss evaluated only on the final state, for , although earlier states can still affect the loss through the subsequent motion. Using from Section 4.1, the chain rule extends Equation (11) to
where stacks the per-frame loss gradients in the same order as the blocks of S. The first term accounts for the explicit parameter dependence of the loss. The second accounts for changes in the simulated trajectory.
To evaluate the trajectory contribution without computing S, we introduce an adjoint vector for each frame and solve
Combining this equation with from Equation (22) gives
The transpose reverses the causal order: is block upper triangular, so the trajectory adjoint is solved from the last frame backward. For the three-frame example,
Backward substitution first determines , then includes its effect when solving for the earlier adjoints:
Applying the same backward substitution to all T frames gives
Only later equations that depend on contribute to its right-hand side. The resulting adjoints account for these temporal effects in the parameter gradient:
(30)
4.3 Computing one coupled system per frame
For each frame , denotes the right-hand side of its adjoint equation. The vector accumulates contributions to the loss gradient with respect to the physical parameters . The reverse pass starts from the direct loss derivatives, for and . Before frame is solved, combines the direct loss gradient with respect to its motion DoFs with all contributions propagated from later frames that depend on . The backward pass processes frames in reverse order. For each frame, is first assembled from that frame's saved converged state. The adjoint is then obtained by solving
Let and denote frame 's contributions to an earlier-frame right-hand side and the parameter gradient, respectively. They are given by
The history contributions are summed into the corresponding , giving the right-hand side in Equation (29). The parameter contributions are summed into . After all frames have been processed, , as given by Equation (30).
Each history contribution reaches frame before that frame is solved (Figure 3). The products in Equations (32) and (33) are evaluated locally without assembling full or . Only the current frame's Hessian is retained during this reverse traversal, together with the saved trajectory and accumulated right-hand sides.
Each retained preserves cross-object coupling, while backward substitution carries that response through time. The trajectory length determines the number of frame solves. Additional parameters contribute local derivative products and share these solves, making the same recurrence suitable for low-dimensional controls and detailed shape design.
4.4 Inertia and initial-state dependencies
The history contribution in Equation (32) requires the derivative of with respect to each earlier state. For inertia, . Substituting the BDF1 predictor from Equation (7) and differentiating with respect to and gives
Substituting these blocks into Equation (32) gives the inertial parts of , denoted by the superscript in:
Huang et al.
Current reverse frame t

Fig. 3. Reverse-time accumulation in the frame-wise adjoint. Dashed arrows indicate forward state dependencies. Blue arrows carry contributions from the solved to the earlier right-hand sides and . For the dynamic predictor shown, inertia and friction contribute to , while inertia contributes to . Each right-hand side also includes its direct loss gradient.
The same mass products apply to both representations: M contains the FEM vertex-mass blocks and the mass block of each affine body.
The initial configuration and velocity are inputs to the simulation, not additional solved frames. Their contributions therefore enter the parameter-gradient contribution in Equation (33), rather than a right-hand-side vector . The first-step predictor is , so the inertial derivatives with respect to and are and , respectively. For each frame , the partial derivatives of with respect to the optimized initial configuration and velocity form the corresponding . We evaluate these derivatives at the converged state of frame and accumulate their contributions to the initial-state gradients using Equation (33).
For the velocity-reset approximation of quasi-static behavior, we set the predictor velocity to zero at every step, giving . The mass-weighted quadratic term in Equation (6) remains, so each update still depends on the previous configuration. Differentiating its energy gradient with respect to contributes to . Substituting this contribution into Equation (32) gives the inertial contribution
4.5 Friction between frames
Friction adds a second source of temporal dependence: its energy uses both the current displacement and contact quantities computed from the previous configuration. DiffIPC differentiates this dependence for finite elements [Huang et al. 2024c]. Here the point maps carry these history derivatives into the coupled FEM-affine recurrence, including contacts whose points use different motion representations. For contact c, let be the friction energy gradient with respect to the current world-space point positions . The maps and relate the same contact points to the simulation DoFs at the two frames. With rest geometry fixed, these maps do not depend on the solved DoFs. Differentiating with respect to therefore gives
This is the contact’s contribution to . For , contact c contributes to the earlier-frame right-hand side. Equation (32) gives
Summing these per-contact vectors gives the friction part of . Each contact point retains its FEM or affine map, so the same expression covers contact between the two representations.
The relative tangential displacement is computed from the corresponding vertex displacements using closest-point interpolation weights and a tangent basis. These weights, the tangent basis, and the normal force are computed from the converged configuration of the previous frame. They remain fixed throughout the current frame's solve. When differentiating with respect to the previous-frame positions, we also include the derivatives of these quantities. Appendix A.1 gives the friction law and its derivatives.
5 Affine-Body Derivatives for Shape, Initial States, and Control
The coupled adjoint describes how a loss responds to motion. To optimize an affine body's shape or controls, we must also differentiate how those parameters enter the frame equations. In particular, an affine body can expose many rest-shape coordinates for design, while adding only twelve motion DoFs per solve. A rest-shape change affects mass and inertia, world-space contact geometry, and the maps from point-space forces to affine coordinates. Friction adds the dependence on that geometry at the previous frame.
We derive these parameter derivatives, followed by initial-state and joint-control derivatives. For a scalar parameter , the partial derivative forms column of , evaluated at fixed solved DoFs. The adjoint accounts for the resulting motion response, and Equation (30) combines with the explicit loss derivative . The following derivatives preserve this separation, allowing surface design, placement, and control to share the twelve-DoF affine representation.
5.1 Rest-dependent mass and inertia
For affine body , let be its rest domain and its constant density. For a material point with rest position , the map in Equation (3) gives its world-space position as . With rest geometry fixed, its velocity is . The corresponding mass block is
Both and its shape derivative can be computed from the closed surface mesh. We express the volume integral as signed triangle contributions, each depending explicitly on the triangle's rest vertices. Differentiating these expressions gives the mass-matrix derivatives directly from the design surface, without an interior tetrahedral discretization.
Expanding in Equation (39) gives terms that are constant, linear, or quadratic in the rest position . The mass matrix is determined by three integrals over the body's rest volume:
(40)
Here is the total mass. The vector is the first mass moment and the matrix is the second mass moment. With density fixed, , , and depend only on the body's rest shape.
The closed surface mesh provides these volume integrals. For an outward-oriented triangle with rest vertices , , and , the three vertices and the origin define a signed tetrahedron. Its volume and mass-weighted integrals can be calculated directly from the three vertex positions. With , the signed contributions are
(41)
Summing , , and over all surface triangles gives , , and , respectively. Retaining the signs in these sums recovers the volume moments from the oriented surface triangles.
Using these quantities and the coordinate order in Equation (1), the affine-body mass matrix is
The total mass determines the translation block. The first mass moment determines the blocks between translation and the affine transformation, while the second mass moment determines the blocks for the affine transformation.
Each contribution in Equation (41) is an explicit function of the triangle's rest vertex positions. With density and mesh connectivity fixed, summing their derivatives over the surface triangles gives , , and . Substituting them into Equation (42) gives . When the inverse mass matrix is needed, its derivative is . Shape updates preserve the closed, consistently oriented, nondegenerate surface and the validity of its mass distribution. Invalid candidates are rejected before updating the simulation geometry.
5.2 Rest-shape gradients
Rest-shape derivatives express how the frame equations change when the affine design surface changes. Solved FEM positions and affine states are held fixed when forming , while an affine rest variation still moves its surface point by . The resulting mass, contact-map, and energy-gradient variations are denoted by , , and . They supply the corresponding parameter derivatives, with direct surface-loss dependence added separately to .
Mass, inertia, and shape energy. For body at frame , the inertial energy gradient is . The product rule gives the corresponding first-order change:
The first term uses the mass derivative derived above. The second includes any rest-shape dependence in the inputs to the predictor. The affine shape incremental potential is , where is the affine stiffness coefficient, is the rest volume, and is the near-rigidity penalty. Let be its gradient with respect to . With and fixed, the rest-shape derivative of the combined inertial and shape contributions is
(44)
The two contributions describe different physical effects of redesign: redistributing material changes the inertial response through , while changing the rest volume changes the scale of the near-rigidity energy. Both enter the parameter derivative at fixed affine coordinates. The adjoint then accounts for the resulting change in motion.
Collision-barrier derivatives and the point map. For a surface vertex on body , partial differentiation with respect to holds the translation and affine transformation fixed. Equation (2) gives the resulting world-space position change as . This variation also changes and the corresponding entries of the contact map . For contact , let collect the changes in its world-space point positions. Applying the product rule to the collision energy gradient gives its first-order change:
(45)
Here ct denotes the collision-barrier term, and is its Hessian with respect to the world-space point positions . The first term accounts for the changed mapping from a point force to the body's affine equations: even an unchanged point-space force has a different contribution when its material point moves. The second term accounts for the force change caused by the altered world-space collision geometry. Rest-shape changes affect both the world-space collision gradient and the mapping , so both terms must be included. Varying only a selected scalar rest-coordinate , while holding all other parameters and solved DoFs fixed, gives the corresponding partial derivative:
(46)
is contact 's collision contribution to column of .
Huang et al.

Fig. 4. Garment Hanger shape design. Two shared Bézier control scales modify both shoulders of the affine rest surface under frictional cloth contact. The initial and optimized configurations are shown at frame 33. The optimized hanger retains both garment straps.
Rest shape under frictional contact. The friction energy at frame t depends on the surface-point positions at both frames t and . For vertex i on affine body b, these two positions are computed from the same rest position using Equation (2). We vary while keeping each frame's translation and affine transformation at their converged values. The resulting world-space position changes are
A rest vertex identifies the same material point at both frames. Moving it can therefore change the relative sliding displacement even when the two affine transforms are held fixed. Its previous-frame position also determines the interpolation weights, contact-plane basis, and normal force used by the friction law. The shape derivative must include these changes together with the current point displacement.
Let and be the derivatives with respect to the current and previous point positions. The block includes the changes in the interpolation weights, tangent basis, and normal force. The rest-shape variation also changes . Applying the product rule to therefore gives all three contributions:
These terms capture the changed force map and the current- and previous-frame contact geometry at fixed simulated DoFs. Their contribution to complements the earlier-state dependence propagated by the history update in Section 4.5. Appendix A.1 provides the friction law in terms of contact-point positions and its derivatives.
Direct dependence of a surface loss. A loss evaluated on an affine surface also depends on rest geometry through . For a loss on surface positions at one frame , holding the simulation DoFs fixed gives the direct contribution
For losses on several frames, these direct contributions are summed over the corresponding frames and included in . They are added to the contributions through the frame equations in Equation (30). Garment Hanger (Figure 4) illustrates both contributions. Its support objective depends on the relative positions of the cloth straps and hanger shoulders. Changing the rest surface therefore affects the loss directly through the surface map and indirectly through the coupled motion, including frictional contact. Both contributions enter the rest-shape gradient.
5.3 Initial-state gradients
Following Section 4.4, we include the selected components of an affine body’s initial configuration and initial velocity in . Their parameter derivatives enter and determine the initial-state components of in Equation (33). For these partial derivatives, the rest geometry, prescribed accelerations, and computed states remain unchanged. Only the selected initial values vary.
The first-frame inertial derivatives in Section 4.4 use the mass block for affine body b:
The initial configuration also appears in the second-frame BDF1 predictor, . Differentiating with respect to gives
The first-frame derivatives contribute to , and the second-frame derivative contributes to . Let contain the twelve entries of the coupled adjoint corresponding to body b. Substituting these derivatives into Equation (33) gives the inertial contributions to the initial-state gradients:
(51)
For a one-frame trajectory, the term containing is omitted.
Friction provides an additional initial-configuration derivative. At the first frame, its previous-frame positions are the initial surface positions . Changing changes these positions and the interpolation weights, tangent basis, and normal force computed from them. We compute this derivative using Equation (37) with . Since is an input parameter, this derivative contributes to and the parameter-gradient update, rather than an earlier-frame vector .
For the velocity-reset updates used to approximate quasi-static behavior in Section 4.4, the first-frame predictor is . Its inertial derivatives are with respect to and zero with respect to . Subsequent predictors use the previous solved configuration without an explicit term. In this mode, the inertial contributions are and . The first-frame friction contribution is included as described above.
5.4 Joint targets and forces
Revolute and prismatic joint targets and forces provide actuation parameters alongside rest shapes and initial states. Their reference geometry and driving stiffness remain fixed during control optimization. Let denote the scalar target, force, or torque applied to joint j at frame t, and let denote its contribution to the frame energy gradient. Equation (33) gives this joint's contribution to the control gradient:
Although the local control derivative involves only the two joint-connected bodies, its product with the coupled adjoint includes their response through contact with the rest of the scene. Joint targets and forces can therefore be optimized for objectives on interacting objects, using the same backward system as shape and initial-state parameters.
Actuation energies and parameter derivatives. For the local formulas, we omit the joint and frame indices. Let be the applied target, the joint force (a linear force for a prismatic joint and a torque for a revolute joint), and the effective driving stiffness. The affine DoFs of the two bodies connected by the joint are denoted by and . The vector collects both bodies' DoFs, with . For a prismatic joint, let denote the relative displacement between the two joint attachment points, projected onto the joint axis of body in world space. Its energy and control derivatives are
(53)
The gradient also accounts for how the world-space joint axis of body c changes with . The quadratic term penalizes displacement away from the target a, whereas specifies the applied joint force along the joint coordinate. Targets and joint forces therefore enter the same frame equation through different parameter derivatives.
For a revolute joint, two scalar quantities and computed from the bodies' transformed reference directions define the relative angle . For target , define
These quantities compare the relative orientation with the target. For rigid rotations with orthonormal reference directions and aligned joint axes, they reduce to and . The squared sine vanishes both at the target and a half-turn away. The cosine term below gives the half-turn a positive penalty. The periodic target energy is
(55)
Here is the fixed relative weight of the cosine penalty, not an optimized control. The joint energy uses and computed directly from the affine-transformed joint reference directions. Their derivatives account for changes in both the lengths and orientations of these directions. The angle derivatives used by the torque term are given in Appendix A.3.
The partial derivatives with respect to the applied target and joint force are
(56)
All control derivatives are evaluated at the converged frame states. At fixed control values, differentiating the state gradients gives the full joint Hessians and . These include the second derivatives of the joint coordinates and of the potential terms linear in the joint force. Appendix A.3 gives the geometric definitions of , , and , their first and second coordinate derivatives, and the full Hessians in Equation (91).
6 GPU Backward and Reusable Interface
Compact coordinates and GPU parallelism reduce different parts of the backward cost. The coupled adjoint solve captures interactions across the scene, while local derivative products expose parallel work over elements, surface triangles, contacts, and joints. Conditional CUDA Graphs reduce repeated CPU coordination during the solve, and parallel accumulation returns gradients to earlier states and physical parameters (Figure 5). A PyTorch interface makes this computation reusable across task-specific designs and objectives.
The adjoint system is assembled from each frame's converged FEM and affine states. Equation (2) recovers the affine surface positions. The backward pass evaluates contact derivatives using the same contact pairs and distance formulas as the forward solve at this converged state. Previous-frame friction weights, contact-plane bases, and normal forces retain the history dependence derived in Section 4.5. StiffGIPC's parallel global Hessian assembly [Huang et al. 2025a] combines element, body, collision, friction, and joint contributions, including FEM-affine cross terms. The resulting Hessian is assembled once per reverse frame and remains fixed throughout its PCG solve, avoiding a repeat of the nonlinear forward iterations.
6.1 PCG with conditional CUDA Graphs
The adjoint in Equation (31) uses the same frame Hessian as the converged forward equations, allowing StiffGIPC's highly parallel GPU PCG solver [Huang et al. 2025a] to serve both forward and backward computations. Compact affine coordinates reduce PCG's numerical workload, making repeated CPU kernel launches and convergence synchronization a larger fraction of solve time. The stricter backward residual tolerance can amplify this cost over more iterations. To address this, we build a PCG pipeline managed by a conditional CUDA Graph, based on the PCG recurrence kernels [Baraff and Witkin 1998], their execution dependencies, and the convergence checks (Figure 5). Once launched from the CPU, the graph initializes PCG and then repeats its iterations and convergence checks entirely on the GPU until convergence or the iteration limit is reached, eliminating per-iteration kernel launches and CPU-GPU synchronization.
Huang et al.
(a) One PCG iteration after initialization

(b) CPU-controlled iterations

(c) Conditional CUDA Graph

Fig. 5. PCG computation and execution control. (a) Five stages of one iteration (Algorithm 2). (b) A host-controlled loop retrieves a convergence value after each GPU iteration. (c) A conditional CUDA Graph keeps iteration and stopping on the GPU. Frame restoration, Hessian assembly, and gradient accumulation remain outside the graph. Both execution modes use the same PCG recurrence and stopping criterion.
Algorithm 2 PCG with Conditional CUDA Graphs
Input: Current , , , relative target , iteration limit
Output: Candidate and convergence status
CPU: construct or reuse CUDA Graph
1: Use , , and as inputs to the CUDA Graph
2: if no compatible CUDA Graph exists then
3: Construct a CUDA Graph from the GPU kernels of PCG
4: Connect dependent kernels
5: Add conditional loop node that reads GPU-updated continue flag
6: end if
7: Launch the CUDA Graph once from the CPU
GPU: PCG initialization within CUDA Graph
8: ; ; ;
9: ; ;
10: Set the continue flag from on the GPU
GPU: PCG iterations within CUDA Graph
11: while the graph's continue flag is true do
12: ;
13: ;
14: ;
15: ; ;
16: A GPU kernel clears the continue flag if or
17: end while
CPU: read final convergence status
18: Read and
19: return
For each reverse frame, we solve the assembled adjoint system using a reusable CUDA Graph (Algorithm 2). Its inputs , , and preconditioner are updated between frames and stay fixed during each solve. The graph preserves the dependencies between PCG kernels, while GPU convergence checks govern its conditional loop, so the same graph can run a different number of iterations. It can still be reused when contact sets change, as long as the kernel configuration and storage stay compatible. This reuse spreads graph construction across frames and removes per-iteration CPU coordination, so compact FEM-affine adjoint systems can benefit from their reduced numerical workload. The GPU convergence check compares the preconditioned residual measure with the target , set at the start of each solve. The conditional loop stops when this target is reached or the iteration count reaches . The default backward settings are and . Only an adjoint whose final residual measure meets the target is accepted for the gradient accumulation described next.
6.2 GPU-parallel gradient accumulation
The parameter-gradient and earlier-frame contributions in Equations (33) and (32) share the coupled adjoint . Its entries contain the influence of interactions across the scene, but each derivative product accesses the DoFs of a local element, contact and joint. Surface triangles provide the local mass and volume derivatives for affine shape design. This locality exposes parallel work even when a body has a compact motion state.
The parameter-gradient update is organized as parallel GPU tasks over FEM elements, contact pairs, joints, and affine surface triangles. Each task computes one local contribution to the gradient of a selected parameter. For affine rest-shape gradients, tasks assigned to individual surface triangles compute the mass-matrix and volume derivative contributions. Each task reads only the adjoint entries for the DoFs involved and evaluates their inner product with the corresponding parameter derivative. With the frame adjoint solved, the local derivative products are independent and evaluated in parallel. Atomic additions combine contributions to the same parameter-gradient entry. Let denote a local contribution to . The total loss gradient for parameter is
Here is the direct loss derivative with all solved states fixed. This decomposition sums the frame contributions in Equation (33) without assembling the global parameter-derivative matrix . The required derivatives come from Section 5, including inertia in Equation (43), initial states in Equations (49)–(50), and joint controls in Equation (52). Material derivatives are given in Appendix A.2.
Friction follows the same decomposition. The mapped adjoint is computed once per vertex and reused by all contacts involving that vertex. For each contact, a separate GPU task computes one entry of
without assembling the contact derivative matrix. Entries are summed at mesh vertices, and the resulting sum is mapped to previous-frame DoFs (Equation (38)). Contacts sharing a vertex therefore apply only once. For a free FEM vertex , is accumulated directly into the corresponding entries of . For affine bodies, the contributions are summed over their vertices into the body's twelve entries in . The per-vertex vectors are also reused for the rest-shape gradient contribution arising from previous-frame contact positions (Equation (47)). Motion changes propagate through the earlier-frame right-hand sides, and the remaining rest-shape terms reuse the point gradients and Hessians assembled before affine conversion, without adding motion DoFs.
The inertial history terms in Equations (35)–(36) are likewise evaluated independently across vertices and bodies. All contributions to an earlier right-hand side must be accumulated before its adjoint solve. Parallelism therefore lies within each reverse frame, while frames follow the dependency order in Section 4.3. For a fixed trajectory and scalar loss, all selected parameters share the same frame adjoint, so adding parameters requires local derivative computation rather than additional coupled solves.
6.3 A reusable interface for inverse problems
The parameter map converts user-defined design variables into physical parameters such as rest geometry, material properties, or joint controls. The output map converts simulated DoFs into quantities used to evaluate the loss, such as surface vertex positions. PyTorch differentiates both maps and the loss, while DiffGIPC computes derivatives through the coupled simulation. A loss evaluated on one object can therefore guide the optimization of another object's parameters through their physical interactions.
Let contain the optimizer variables, map them to physical parameters , and form the quantities used by the scalar loss from the converged states:
The parameter map imposes task-specific constraints or shares design variables across physical parameters, so need not equal . The output map combines quantities from different objects and frames without changing the coordinates of the coupled solve.
PyTorch differentiates the loss and output map to obtain
For affine surface points, maps point gradients to body DoFs as in Equation (18), whereas FEM positions use the identity map. Selecting outputs sets the direct loss gradients, not the dependencies retained by the adjoint. A frame absent from has but can still receive contributions from later frames. The output map and loss may also depend explicitly on physical parameters. With the simulated DoFs fixed, their contribution is
For example, changing an affine rest surface moves its world-space points even at fixed motion DoFs. This explicit geometric effect is distinct from the change in simulated motion accounted for by the adjoint. The vectors and initialize the right-hand sides and parameter gradient in Section 4.3. The GPU backward pass then supplies the physical gradient, which PyTorch maps to the optimizer variables:
(61)
Task parameterizations and objectives can therefore change without changing the coupled backward equations. In Garment Hanger (Figure 4), two shared shoulder-control scales specify the rest surface, while the loss measures support using both hanger and cloth positions. PyTorch differentiates the shape parameterization and geometric loss. DiffGIPC combines the direct surface dependence with the gradient through their coupled motion, retaining twelve motion DoFs for the hanger. The same composition applies to the physical parameter families listed in Table 7 (Appendix B). Additional physical models enter through their local derivatives, preserving the distinction between task design and coupled simulation.
7 Evaluation
Our evaluation examines the parameter-to-output dependencies supported by DiffGIPC and the cost of forward and backward evaluations across full-space and affine motion representations. The shared full-space FEM benchmarks from DiffIPC [Huang et al. 2024c] cover initial motion, rest design, and material or friction fitting at their original low mesh resolutions. In these benchmarks, both methods use full-space FEM. Further experiments exercise cloth design, affine shape and placement, and articulated control, including mixed-coordinate inverse problems. We first compare optimization outcomes and evaluation times on the shared FEM benchmarks, then demonstrate the coupled design and control tasks. Gradient validation assesses agreement between analytic gradients and finite differences, while studies of motion representation, resolution, and GPU execution explain the optimization cost.
For the shared benchmarks, DiffGIPC runs on an NVIDIA GeForce RTX 4090 and DiffIPC on an Intel Core i9-13900K. Both use double-precision arithmetic and the same convergence tolerances. Appendix B summarizes the simulation settings in Table 6 and the differentiated parameter families in Table 7. A forward evaluation simulates a trajectory to the task's observation horizon. A backward evaluation computes its loss gradient over that trajectory. counts
Huang et al.

(a) Iteration 0

(b) Iteration 1

(c) Iteration 3

(d) Iteration 10
Fig. 6. Collision-mediated initial-velocity optimization. The first bunny’s initial velocity is adjusted so that the second bunny’s horizontal centroid reaches its target. The panels compare frame 40 before optimization and after 1, 3, and 10 iterations.
forward evaluations, including line-search trials and verification runs, while counts complete gradient evaluations used for optimization. Let and denote their mean times. The combined mean time is . The accumulated evaluation time is . In the loss definitions below, is the world-space position of vertex at observation frame , and a star denotes a prescribed target held fixed during optimization. Each task specifies its observation endpoint or selected frame set. Unsubscripted norms are Euclidean norms, and denotes the Frobenius norm for matrices.
7.1 Comparison with DiffIPC
The shared FEM benchmarks establish the framework’s coverage in full-space FEM before introducing affine design and control. They progress from contact-driven motion to rest-shape design and parameter fitting, changing both the optimized input and the observed response. Figure 11 compares their optimization histories, and Table 1 reports the corresponding evaluation times. We relate each task’s objective to its physical outcome before examining the computational cost.
Bunny collision. We optimize a shared initial velocity for the vertices of one bunny so that collision moves the other bunny to a target. The objective uses only the second bunny’s volume-weighted horizontal center after 40 frames:
Here is the volume-weighted horizontal center of the second bunny and T = 40. Because the loss observes only that body, the optimized velocity affects it through collision. Figure 6 shows

(a) Iteration 0

(b) Iteration 1

(c) Iteration 3

(d) Iteration 10
Fig. 7. Trajectory matching through contact between two deformable bodies. The first body’s initial velocity is optimized to reproduce the target motion. Opaque surfaces show the simulation and translucent surfaces the target at frame 100, before optimization and after 1, 3, and 10 iterations.
the final position approaching the target. Section 7.4 revisits this task across motion representations.
Tentacle trajectory matching. The first deformable body’s shared initial velocity is optimized while the second body’s initial velocity remains fixed. Let be the first body’s volume-weighted position, using fixed rest-tetrahedron weights. Its trajectory-matching objective is
where and is the prescribed target. Thus observations throughout the trajectory contribute to the initial-velocity gradient through motion and friction history; Figure 7 shows the endpoint.
Loaded Support design. Selected rest vertices of a FEM support are optimized under downward loading, with its supports fixed. At the end of each 20-frame simulation, the squared-stress term is . Here is the evaluated tetrahedron set, is the rest volume, and is the first Piola stress evaluated at . Rest-volume weighting makes larger stressed regions contribute proportionally more. A surface-smoothing penalty discourages local irregularities in the designed rest geometry. The optimized loss is . The smoothing set contains surface vertices selected in rest coordinates. For each , let be its surface-edge neighbors that also belong to . Using the current rest positions , the penalty is
Table 1. Mean time per forward and backward evaluation (seconds) on the shared FEM benchmarks. Forward + Backward gives the sum of the two per-evaluation means.
| Example | System | Forward | Backward | Forward + Backward | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Linear | CCD | Hessian | Search | Other | Total | Hessian | Linear | Other | Total | |||
| Bunny collision (Fig. 6) | DiffIPC | 4.5 | 10 | 4.6 | 1.1 | 1.9 | 22 | 1.4 | 1.1 | 0.44 | 2.9 | 25 |
| DiffGIPC | 0.65 | 0.044 | 0.037 | 0.017 | 0.002 | 0.75 | 0.0069 | 0.22 | 0.0057 | 0.24 | 0.98 | |
| Speedup | 6.9× | 232.0× | 123.9× | 67.7× | 963.8× | 30.0× | 204.7× | 4.9× | 76.3× | 12.5× | 25.8× | |
| Tentacle matching (Fig. 7) | DiffIPC | 140 | 14 | 120 | 66 | 11 | 350 | 7.4 | 11 | 2.8 | 21 | 370 |
| DiffGIPC | 8.1 | 2.4 | 2.2 | 1.4 | 0.011 | 14 | 0.04 | 1 | 0.024 | 1.1 | 15 | |
| Speedup | 16.9× | 5.9× | 55.3× | 46.7× | 1037.5× | 24.6× | 184.8× | 10.9× | 120.7× | 19.7× | 24.3× | |
| Loaded Support (Fig. 8) | DiffIPC | 22 | 0.60 | 3.2 | 1.1 | 11 | 38 | 2.9 | 12 | 0.49 | 16 | 54 |
| DiffGIPC | 0.93 | 0.02 | 0.014 | 0.0017 | 0.00051 | 0.97 | 0.011 | 0.85 | 0.0066 | 0.87 | 1.8 | |
| Speedup | 23.8× | 29.5× | 232.1× | 653.7× | 21172.2× | 39.3× | 266.4× | 14.7× | 74.2× | 18.3× | 29.4× | |
| Material fitting (Fig. 9) | DiffIPC | 0.89 | 0.029 | 0.69 | 0.028 | 0.61 | 2.2 | 0.35 | 0.53 | 0.057 | 0.94 | 3.2 |
| DiffGIPC | 0.015 | 0.0021 | 0.0042 | 0.00064 | 0.0032 | 0.025 | 0.0026 | 0.023 | 0.0016 | 0.028 | 0.053 | |
| Speedup | 60.3× | 14.3× | 161.8× | 43.5× | 190.7× | 90.1× | 135.0× | 22.8× | 36.0× | 34.2× | 60.7× | |
| Friction optimization (Fig. 10) | DiffIPC | 17 | 22 | 21 | 8.1 | 6.8 | 76 | 2.5 | 1.9 | 1.2 | 5.6 | 81 |
| DiffGIPC | 3.8 | 1.4 | 1.3 | 0.7 | 0.0093 | 7.2 | 0.037 | 0.36 | 0.039 | 0.44 | 7.7 | |
| Speedup | 4.6× | 16.3× | 15.7× | 11.7× | 734.8× | 10.5× | 66.3× | 5.3× | 31.8× | 12.8× | 10.6× | |
Vertices without neighbors in this set contribute zero. This term measures each selected vertex's deviation from its neighbors' mean position, normalized by the mean incident edge length. Figure 8 shows how the redesigned geometry redistributes stress under the same loading and color scale. The loss histories in Figure 11 reach similar final objective levels for both methods. Their intermediate jumps occur when remeshing changes the stress discretization. Gradients are evaluated on each current fixed mesh, with feasible rest-shape updates selected by backtracking. The task demonstrates rest-shape design through the combined changes in geometry, element volume, and elastic response.
Material identification. A homogeneous FEM cube is compressed by prescribed displacements on its two opposing faces. Its material

(a) Iteration 0

(b) Iteration 20

(c) Iteration 50

(d) Iteration 200
Fig. 8. Rest-shape optimization of a loaded FEM support. Under fixed constraints and downward loading, the objective minimizes squared first-Piola stress. The panels show the deformed support at frame 20 before optimization and after 20, 50, and 200 iterations.
response is fitted to a fixed reference deformation using surface-vertex positions. Two shared logarithmic variables, and , parameterize the positive Lamé inputs and . They determine the deformation coefficients of the stable Neo-Hookean energy as
The same coefficient pair is assigned to every tetrahedron. The loss is . Here M contains prescribed vertex markers on the cube's face in the rest configuration. The marker indices remain unchanged during optimization, so and refer to the simulated and reference positions of the same vertex, not to a nearest-point match. The factor sets the numerical scale of the squared-position loss, which is summed rather than averaged over the markers. The timing configuration uses T = 10 simulation steps with h = 0.1 s, and the loss is evaluated only at the final step. Both Lamé input parameters are initialized to . Both methods reach similar marker-position errors at the plotted scale. Figure 9 shows the separately rendered frame-19 configurations approaching the reference deformation. This task demonstrates fitting a shared material response from surface-position errors through the positive coefficient map.
Friction optimization. The bunny-slide friction coefficient is fitted to a target position at frame 100, with s. The loss is , where is the bunny's volume-weighted center coordinate, is the slide endpoint, and . The coefficient changes from 0.5 to 0.1 (Table 6 in Appendix B). Figure 10 shows the corresponding change in sliding distance at the fixed observation time. This task isolates the coefficient-to-motion dependence: geometry and initial motion remain fixed, and the optimized friction changes the cumulative sliding response.
Together, the shared benchmarks test gradients through collision-transmitted motion, observations over time, loaded shape changes, material fitting and friction response. Table 1 measures the cost of
Huang et al.

(a) Iteration 0

(b) Iteration 2

(c) Iteration 5

(d) Iteration 20
Fig. 9. Fitting the material response of a constrained cube to marker positions. Each column pairs side (top) and oblique (bottom) views at frame 19, before optimization and after 2, 5, and 20 iterations. Opaque surfaces denote the simulation, translucent surfaces the target, and arrows the Dirichlet constraints.

(a) Iteration 0
(b) Iteration 1

(c) Iteration 3
(d) Iteration 5
Fig. 10. Friction optimization on a curved slide. A bunny-slide friction coefficient is adjusted so that the bunny reaches its target position at frame 100. The panels show the unoptimized simulation and results after 1, 3, and 5 iterations.
that optimization capability with full-space FEM in both systems. The complete backward pass is faster, including Hessian assembly, the adjoint solve, and gradient accumulation. Combined forward and backward speedups range from for friction fitting to for material fitting, while forward speedups are . These gains demonstrate efficient trajectory-gradient evaluation before introducing affine motion reduction. Section 7.4 examines that additional benefit, and Section 7.5 relates evaluation cost to complete optimization workloads.
7.2 Rest-shape design and stable placement
The design tasks separate the object being changed from the quantities used to judge the result. Cloth fitting maps a size parameter to a deforming garment, hanger design optimizes an affine surface through its effect on supported cloth, and stone placement adjusts initial positions while preserving shape. Together they demonstrate how rest geometry and initial-state parameters act through the same coupled trajectory gradient.
Cloth rest-scale fitting. A single optimizer variable scales the garment’s rest shape, with a fixed mannequin. This map changes many rest coordinates while preserving full-space cloth deformation. At the observation endpoint , the target drape defines , where contains all garment vertices and is the fixed target position of the corresponding material vertex. After 5 updates, the optimized drape approaches the target in Figure 12. The result demonstrates how a low-dimensional design parameter controls detailed simulated geometry through rest-shape derivatives.
Garment Hanger shoulder design. Each shoulder profile is controlled by a quadratic Bézier curve with two fixed endpoints and one movable middle control point. The design variables and adjust the middle control point's horizontal and vertical positions. Starting from , decreasing moves the point toward the hanger's centerline, and decreasing lowers it. The reflected curve uses the same pair, so both shoulders change symmetrically without moving their endpoints. The affine hanger retains twelve motion DoFs and supports a garment with friction coefficient 0.05.
At the terminal frame, and denote the horizontal positions of the hanger's shoulder tip and the corresponding strap's outer edge, respectively, on the left or right side . On each side, horizontal coordinates increase from the hanger's centerline toward the shoulder tip. Their difference therefore measures how
(a) Bunny
DiffGIPC
DiffIPC
(b) Tentacle

(c) Loaded Support
(d) Material
Optimization Iteration
(e) Friction
Fig. 11. Optimization histories for the shared FEM benchmarks. Blue and red denote DiffGIPC and DiffIPC, respectively. The horizontal axes count accepted parameter updates from the initial parameters (iteration 0). Loss scales are task-specific, and Loaded Support is remeshed between updates.

(a) Iteration 0
(b) Iteration 1
(c) Iteration 3
(d) Iteration 5
(e) Target
Fig. 12. Cloth rest-scale fitting on a fixed mannequin. The blue panels show the initial drape and results after 1, 3, and 5 updates. The orange panel shows the target.
far the hanger extends beyond the strap. The quantity is the minimum three-dimensional distance between the selected strap and corresponding upper-shoulder vertices. For the fixed target margin m, the support margin and loss are
The gap penalty reduces the margin when the strap separates from the shoulder by more than 0.01 m. Both surfaces contribute to the loss, whose shape gradient includes direct geometric and coupled-motion contributions (Section 5.2).
Each optimization rollout ends at the first margin violation after the corresponding strap approaches within 0.01 m of its shoulder, or at frame 600. The optimized control-point scales move the middle control points inward and downward. The resulting hanger retains both straps in two independent 600-frame checks (Figure 4). After each strap contacts the hanger, its support margin must remain nonnegative ( ) until frame 600. The larger target margin is used to guide optimization. Figure 16 shows optimization progress, and Section 7.4 compares a surface-matched FEM hanger.
Seven-stone placement. We optimize the horizontal initial positions of seven affine bodies with fixed shapes. Their detailed surfaces determine the contacts, while the motion system contains only 84 DoFs. Let identify the bottom reference stone. At frame , is the Euclidean distance between the horizontal center positions of stone and that reference stone. With allowed distance , the placement objective is , where is the set of observation frames. The base is excluded from the inner sum, and only distances exceeding contribute. Optimization starts from horizontally offset stone placements. The first 50 updates use to encourage the simulated centers of mass to align horizontally with that of the base stone. The remaining updates use to allow a broader set of contact-supported configurations. Both stages take , where is the first frame where for any non-base stone. If for every non-base stone at every simulated frame, the loss is zero. The optimizer adjusts the stones' initial horizontal positions. The loss is computed from the horizontal distances between their simulated centers of mass and that of the base stone. Figure 1 shows updates 10, 50, and 78, with separate 1,000-frame forward simulations testing whether the resulting stacks remain stable. The task demonstrates contact-aware placement through affine initial-state gradients: detailed surface interactions guide the horizontal positions without changing the stones' shapes.
7.3 Articulated control
Articulated tasks extend the coupled gradients from geometry and placement to actuation. Grasp-angle control tests joint-target tracking under contact, and cup catching optimizes joint commands for the motion of an interacting object. Dual-arm grasping optimizes
Huang et al.

Fig. 13. Grasp-angle control. Initial (left) and optimized (right) grasps at frame 60. Joint-target optimization moves the grasp toward the 0.45-rad target. Coral guides follow the fingers. Dashed blue guides indicate visual reference directions.
one vertical offset added to both grippers' target positions to control their normal contact force on the cloth. These objectives span motion and force while sharing the coupled FEM-affine backward computation.
Grasp-angle control. An articulated affine robot approaches and grasps a FEM object above a fixed support. The closure objective measures two revolute joints in each finger linkage. The 120-frame horizon includes approach, closure, and return motion. Let be this set of four gripper joints and their simulated revolute angles. At the closure observation , the objective is , with fixed desired angle rad. The optimized input is the common target angle. The four angles are measured from the simulated response to that target and need not be identical under contact. The optimized joint-target angle is 0.447843 rad. The objective acts on the four simulated angles, so the gradient accounts for the robot's response to the command within the coupled scene. Figure 13 compares the grasps. Its dashed guides are visual references and do not enter the loss.
Cup catching. Joint targets move a plate held firmly by an xArm gripper. The task requires the plate motion to account for the incoming cup's response through contact. A uniformly decelerating free-plate trajectory, constructed from the cup's initial velocity, supplies an initial joint-target motion through sequential URDF inverse kinematics (IK). This initializes the commands geometrically. Differentiable simulation then optimizes their effect on the coupled cup-and-plate dynamics, as compared with the stationary and initial-trajectory cases in Figure 14.
The simulation uses 240 frames at s with friction coefficient 1.0. The optimized command matrix is , where contains the relative target angles of the seven arm joints at control sample . The command at simulation frame is

(a) Frame 94
(b) Frame 111
(c) Frame 120
(d) Frame 239
Fig. 14. Articulated cup catching through plate-trajectory optimization. With the arm held at rest (left), the cup falls from the plate. After optimization (right), the plate catches and retains it. The middle column shows the initial IK trajectory, which also fails to retain the cup.
The final 42 frames hold fixed, and their gradients accumulate into this target.
Five state losses average errors over frames 99–240, starting when the plate commands begin. For body , and denote its simulated center position and affine orientation matrix, and is its center velocity. Starred plate quantities denote the prescribed reference. Position, velocity, and orientation tracking keep the plate near this path with the intended motion and orientation:
The normalization scales are , , and .
Cup uprightness discourages tipping without constraining yaw, and a relative-velocity loss discourages sliding between the cup and plate. With world up , the cup up vector is
The two losses are
Command smoothness is encouraged by , which penalizes changes between consecutive independent targets. The total objective is
with fixed weights , , , , , and .
The cup tilt is . A catch is successful when, in each of the final ten frames, rad, the minimum cup-plate vertex distance is at most 2 mm, and both center speeds and are below 0.05 m/s. Optimization stops once all of these conditions are met. The optimized plate catches and retains the cup (Figure 14). All 700 joint-target variables are optimized jointly through the arm dynamics and cup-plate contact. Their gradients share one coupled adjoint solve per frame (Sections 4.3 and 5.4). At a fixed simulation horizon, additional control variables therefore require local derivative accumulation rather than additional coupled solves.
Dual-arm towel grasp. The same vertical offset is added to both grippers' target positions during descent and the subsequent hold. Optimizing this one value changes how firmly the fingers press the cloth. The horizontal trajectories and finger-closing commands remain fixed. Let be the total normal contact force between the cloth and the fingers of both arms at frame 120 during the hold.
The target normal force is estimated from the friction needed to accelerate the cloth with the closing fingers, using the cloth mass, prescribed closing acceleration, and cloth-finger friction coefficient. A fixed factor of three provides additional margin, giving . The optimized loss is , with measured from the simulated contacts. Starting from a finger-surface height of 1.9 mm and contact force 0.0226 N, the optimizer produces a grasp that lifts and folds the towel after seven updates (Figure 15). This task uses a force objective during the press-down hold to set the contact needed for the subsequent cloth motion, linking an affine position command to a deformable-object outcome.
These outcomes connect parameter choice to physical effect: rest geometry establishes support, initial placement forms a stable assembly, and actuation controls contacting objects. All use the same coupled backward equations, with task-specific parameter maps and losses. Figure 16 complements the physical sequences with the corresponding optimization histories.
Before
After


(a) Initial (0 s)


(b) Lifting (2.00 s)


(c) Raised (2.40 s)


(d) Final (3.30 s)
Fig. 15. Dual-arm towel grasp by optimizing one vertical offset applied to both grippers' target positions. Before optimization (left), the arms fail to grasp the towel. After optimization (right), they grasp the towel and then lift and fold it. Rows show the motion at 0, 2.00, 2.40, and 3.30 s.
7.4 Gradient validation and representation studies
Gradient validation. Table 2 reports finite-difference (FD) checks at the initial optimization parameters for all DiffGIPC examples and the shared DiffIPC benchmarks. For the checked parameter vector , let be its analytic loss gradient. The direction is the normalized gradient, or its sign for a scalar parameter. With perturbation size , the centered difference is . The reported relative error is . The shared-case checks use the first 10 frames. The other checks use the stated task-specific windows.
Huang et al.

(a) Fig. 1
(b) Fig. 12

(c) Fig. 4

(d) Fig. 13
(e) Fig. 14

(f) Fig. 15
Fig. 16. Optimization histories for the additional tasks. Stone placement changes its centroid tolerance after 50 updates. Garment Hanger, cup catching, and Dual-arm grasp use constant offsets that set their final plotted values to zero.
Table 2. Finite-difference checks at the initial optimization parameters.
| Example | System | Dim | Relative FD error |
|---|---|---|---|
| Stone placement (Fig. 1) | DiffGIPC | 14 | |
| Garment Hanger (Fig. 4) | DiffGIPC | 2 | |
| Bunny collision (Fig. 6) | DiffGIPC | 3 | |
| DiffIPC | 3 | ||
| Tentacle matching (Fig. 7) | DiffGIPC | 3 | |
| DiffIPC | 3 | ||
| Loaded Support (Fig. 8) | DiffGIPC | 9939 | |
| DiffIPC | 9939 | ||
| Material fitting (Fig. 9) | DiffGIPC | 2 | |
| DiffIPC | 2 | ||
| Friction optimization (Fig. 10) | DiffGIPC | 1 | |
| DiffIPC | 1 | ||
| Cloth rest scale (Fig. 12) | DiffGIPC | 1 | |
| Grasp angle (Fig. 13) | DiffGIPC | 1 | |
| Cup catching (Fig. 14) | DiffGIPC | 700 | |
| Dual-arm grasp (Fig. 15) | DiffGIPC | 1 |
Bunny resolution study. Table 3 compares three body representations as bunny resolution increases. FEM+FEM uses two deformable bodies, ABD+FEM uses one affine and one FEM body, and ABD+ABD uses two affine bodies. As resolution grows from 933 to 28,435 vertices, the combined forward and backward time for DiffGIPC FEM+FEM increases from 0.98 to 10 s, whereas the ABD+ABD time increases from 0.14 to 0.37 s. The increases are about and , respectively.
At the highest resolution, ABD+ABD has a forward-plus-backward speedup of about over DiffGIPC FEM+FEM. The time spent in backward linear solves falls from 2.3 to 0.0044 s (about ), while the time for a complete backward evaluation falls from 2.5 to 0.048 s (about ). With twelve motion DoFs per body, ABD reduces the adjoint-system size without simplifying the surface mesh used for contact and shape derivatives. For FEM+FEM, the speedup of DiffGIPC over DiffIPC grows from to across resolutions. Combining GPU execution with an affine motion representation gives a speedup for DiffGIPC ABD+ABD over DiffIPC FEM+FEM at the highest resolution.
Garment Hanger: ABD versus FEM. This comparison keeps the surface discretization fixed at 4,476 vertices and 8,952 triangles while changing the motion representation. The FEM replacement adds 902 interior vertices and 18,256 tetrahedra, with a harmonic extension of the two Bézier shape fields to the interior. The mean forward-plus-backward cost is 7.1 s for ABD and 16 s for FEM, giving a speedup of . The backward costs are 0.27 and 1.0 s. The corresponding optimized control-point scales ( ) are (0.8285, 0.8000) and (0.8301, 0.8000). At fixed surface discretization, the two models allocate computation differently. FEM resolves non-affine deformation through an interior tetrahedral mesh, whereas ABD retains a compact motion state and differentiates mass directly from the surface. The timings compare forward and backward evaluations of the ABD and FEM models for the same cloth-support design task.
7.5 GPU execution and optimization cost
This section measures the speedup from CUDA Graphs and the time spent on forward simulation and backward differentiation during optimization. Conditional CUDA Graphs reduce coordination during PCG, while parallel assembly and derivative accumulation process the local work surrounding each solve. Table 4 gives a detailed breakdown of the time spent on forward simulation and backward differentiation, together with the evaluation counts and accumulated evaluation time for each optimization. Table 5 compares execution with CUDA Graphs enabled and disabled, reporting PCG and total evaluation times for forward simulation and backward differentiation, together with the resulting speedups.
CUDA Graph execution provides speedups in forward PCG and in backward PCG over conventional kernel launches (Table 5). The PCG recurrence and convergence criterion are unchanged. These gains demonstrate the benefit of reducing kernel-launch overhead and CPU-GPU synchronization within the iterative solve (Section 6.1).
PCG is the largest contributor to backward time in most tasks (Table 4), making the adjoint solver a major source of savings in gradient evaluation. The acceleration remains visible in the complete computation: combined forward and backward evaluations achieve speedups across all reported tasks. These timings include collision detection, Hessian assembly, line search, and derivative
Table 3. Mean forward and backward evaluation times (seconds) for the bunny-collision resolution study and Garment Hanger rest-shape design. Forward + Backward gives the sum of the two per-evaluation means.
| Resolution / case | System | Forward | Backward | Forward + Backward | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Linear | CCD | Hessian | Search | Other | Total | Hessian | Linear | Other | Total | |||
Bunny collision (Fig. 6): resolution study
| 933 vertices | DiffGIPC ABD+ABD | 0.025 | 0.039 | 0.041 | 0.021 | 0.0023 | 0.13 | 0.0081 | 0.0042 | 0.0032 | 0.016 | 0.14 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| DiffGIPC ABD+FEM | 0.58 | 0.049 | 0.058 | 0.03 | 0.0025 | 0.72 | 0.011 | 0.22 | 0.0085 | 0.24 | 0.96 | |
| DiffGIPC FEM+FEM | 0.65 | 0.044 | 0.037 | 0.017 | 0.002 | 0.75 | 0.0069 | 0.22 | 0.0057 | 0.24 | 0.98 | |
| DiffIPC FEM+FEM | 4.5 | 10 | 4.6 | 1.1 | 1.9 | 22 | 1.4 | 1.1 | 0.44 | 2.9 | 25 | |
| 7,991 vertices | DiffGIPC ABD+ABD | 0.032 | 0.054 | 0.11 | 0.029 | 0.0023 | 0.22 | 0.018 | 0.0043 | 0.0036 | 0.026 | 0.25 |
| DiffGIPC ABD+FEM | 1.4 | 0.075 | 0.18 | 0.045 | 0.0033 | 1.7 | 0.028 | 0.32 | 0.025 | 0.37 | 2.1 | |
| DiffGIPC FEM+FEM | 2.1 | 0.069 | 0.18 | 0.032 | 0.0031 | 2.4 | 0.029 | 0.49 | 0.02 | 0.54 | 3 | |
| DiffIPC FEM+FEM | 80 | 24 | 54 | 9.7 | 7.6 | 170 | 15 | 17 | 0.98 | 33 | 210 | |
| 28,435 vertices | DiffGIPC ABD+ABD | 0.027 | 0.059 | 0.21 | 0.026 | 0.0026 | 0.32 | 0.039 | 0.0044 | 0.0043 | 0.048 | 0.37 |
| DiffGIPC ABD+FEM | 3.5 | 0.091 | 0.53 | 0.059 | 0.0049 | 4.2 | 0.081 | 0.99 | 0.074 | 1.1 | 5.4 | |
| DiffGIPC FEM+FEM | 6.9 | 0.088 | 0.73 | 0.052 | 0.0043 | 7.8 | 0.11 | 2.3 | 0.057 | 2.5 | 10 | |
| DiffIPC FEM+FEM | 740 | 58 | 440 | 55 | 32 | 1300 | 100 | 110 | 4.6 | 220 | 1500 |
Garment Hanger (Fig. 4): rest-shape optimization
| Bezier pair | DiffGIPC ABD | 3.7 | 0.88 | 1.5 | 0.8 | 0.0088 | 6.9 | 0.033 | 0.21 | 0.022 | 0.27 | 7.1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| DiffGIPC FEM | 11 | 1.1 | 1.7 | 0.73 | 0.0076 | 15 | 0.029 | 0.95 | 0.02 | 1 | 16 |
Table 4. Complete optimization workloads and mean phase times (seconds) of the eleven examples. counts forward evaluations, including line-search trials and verification runs. counts complete gradient evaluations used for optimization. Linear comprises PCG and Others, and Hessian combines local and global assembly.
| Example | Forward mean | Backward mean | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Linear | CCD | Hessian | Search | Other | Total | Hessian | Linear | Other | Total | ||||||
| PCG | Others | PCG | Others | ||||||||||||
| Stone placement (Fig. 1) | 80 | 78 | 0.097 | 0.0093 | 0.079 | 0.12 | 0.024 | 0.0088 | 0.34 | 0.051 | 0.067 | 0.003 | 0.023 | 0.14 | 39 |
| Bunny collision (Fig. 6) | 15 | 12 | 0.62 | 0.027 | 0.044 | 0.037 | 0.017 | 0.002 | 0.75 | 0.0069 | 0.22 | 0.005 | 0.0057 | 0.24 | 14 |
| Tentacle matching (Fig. 7) | 11 | 10 | 6.8 | 1.3 | 2.4 | 2.2 | 1.4 | 0.011 | 14 | 0.04 | 0.99 | 0.024 | 0.024 | 1.1 | 170 |
| Garment Hanger (Fig. 4) | 32 | 30 | 2.8 | 0.87 | 0.88 | 1.5 | 0.8 | 0.0088 | 6.9 | 0.033 | 0.2 | 0.01 | 0.022 | 0.27 | 230 |
| Loaded Support (Fig. 8) | 231 | 200 | 0.92 | 0.012 | 0.02 | 0.014 | 0.0017 | 0.00051 | 0.97 | 0.011 | 0.84 | 0.0065 | 0.0066 | 0.87 | 400 |
| Material fitting (Fig. 9) | 21 | 20 | 0.011 | 0.0035 | 0.0021 | 0.0042 | 0.00064 | 0.0032 | 0.025 | 0.0026 | 0.021 | 0.002 | 0.0016 | 0.028 | 1.1 |
| Friction optimization (Fig. 10) | 6 | 5 | 3.2 | 0.6 | 1.4 | 1.3 | 0.7 | 0.0093 | 7.2 | 0.037 | 0.35 | 0.014 | 0.039 | 0.44 | 45 |
| Cloth rest scale (Fig. 12) | 7 | 6 | 13 | 0.38 | 0.54 | 0.68 | 0.31 | 0.0046 | 15 | 0.0029 | 0.48 | 0.00087 | 0.001 | 0.48 | 110 |
| Grasp angle (Fig. 13) | 44 | 20 | 0.34 | 0.044 | 0.074 | 0.27 | 0.12 | 0.0035 | 0.85 | 0.048 | 0.058 | 0.0073 | 0.064 | 0.18 | 41 |
| Cup catching (Fig. 14) | 7 | 6 | 2.3 | 0.17 | 2.1 | 2.2 | 1.1 | 0.017 | 7.9 | 0.2 | 0.68 | 0.009 | 0.13 | 1 | 62 |
| Dual-arm grasp (Fig. 15) | 9 | 7 | 3.4 | 0.24 | 0.84 | 1.6 | 0.4 | 0.012 | 6.5 | 0.2 | 0.9 | 0.024 | 0.58 | 1.7 | 70 |
accumulation, demonstrating a reduction in the cost of simulation and differentiation beyond the PCG loop itself.
CUDA Graphs also accelerate the additional forward simulations used to evaluate candidate parameters and verify the optimized motion. Grasp-angle optimization, for example, uses 44 forward evaluations and 20 backward evaluations (Table 4). The same graph-based forward solver serves both the trajectories used for gradient computation and the additional objective checks and verification runs. Together with the representation study, these results establish complementary benefits: compact coordinates reduce the numerical workload, and graph-based execution reduces the recurring overhead of solving these systems throughout optimization.
8 Conclusion and Discussion
DiffGIPC combines mixed-coordinate trajectory adjoints with GPU execution for contact-rich inverse problems. Full-space FEM and twelve-DoF affine bodies remain coupled through contact, friction, and joints, while affine shape and control derivatives expose these interactions to optimization. Parallel accumulation, CUDA Graph-based PCG, and a PyTorch interface provide the GPU backward and task-level pipeline. Across the shared full-space FEM benchmarks, complete backward evaluation is 12.3–34.1× faster than DiffIPC, with 10.6–60.9× combined forward-and-backward speedups. Affine coordinates provide further savings when near-rigid motion is appropriate, although surface resolution still determines contact and assembly work.
Huang et al.
Table 5. CUDA Graph enabled (On) versus disabled (Off). Times are mean seconds per evaluation; parentheses in the Off rows give speedups from enabling the graph. Linear comprises PCG and Others; the separate Other is Total minus Linear. The rightmost Total combines forward and backward time.
| Example | Graph | Forward (s) | Backward (s) | Total (s) | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Linear | Other | Total | Linear | Other | Total | |||||
| PCG | Others | PCG | Others | |||||||
| Stone placement (Fig. 1) | On | 0.097 | 0.0093 | 0.24 | 0.34 | 0.067 | 0.003 | 0.074 | 0.14 | 0.49 |
| Off | 0.18 (1.8×) | 0.0094 | 0.24 | 0.42 (1.2×) | 0.12 (1.8×) | 0.003 | 0.073 | 0.2 (1.4×) | 0.62 (1.3×) | |
| Bunny collision (Fig. 6) | On | 0.62 | 0.027 | 0.1 | 0.75 | 0.22 | 0.005 | 0.013 | 0.24 | 0.98 |
| Off | 0.97 (1.6×) | 0.026 | 0.1 | 1.1 (1.5×) | 0.35 (1.6×) | 0.0051 | 0.011 | 0.36 (1.5×) | 1.5 (1.5×) | |
| Tentacle matching (Fig. 7) | On | 6.8 | 1.3 | 6 | 14 | 0.99 | 0.024 | 0.063 | 1.1 | 15 |
| Off | 10 (1.5×) | 1.3 | 6.3 | 18 (1.3×) | 1.5 (1.5×) | 0.024 | 0.067 | 1.6 (1.4×) | 20 (1.3×) | |
| Garment Hanger (Fig. 4) | On | 2.8 | 0.87 | 3.2 | 6.9 | 0.2 | 0.01 | 0.055 | 0.27 | 7.1 |
| Off | 4.1 (1.5×) | 0.8 | 3.2 | 8.1 (1.2×) | 0.27 (1.4×) | 0.01 | 0.049 | 0.33 (1.2×) | 8.4 (1.2×) | |
| Loaded Support (Fig. 8) | On | 0.92 | 0.012 | 0.036 | 0.97 | 0.84 | 0.0065 | 0.017 | 0.87 | 1.8 |
| Off | 1.2 (1.4×) | 0.012 | 0.032 | 1.3 (1.3×) | 1.2 (1.4×) | 0.0064 | 0.019 | 1.2 (1.4×) | 2.5 (1.4×) | |
| Material fitting (Fig. 9) | On | 0.011 | 0.0035 | 0.01 | 0.025 | 0.021 | 0.002 | 0.0042 | 0.028 | 0.053 |
| Off | 0.017 (1.5×) | 0.0034 | 0.011 | 0.032 (1.3×) | 0.033 (1.5×) | 0.0018 | 0.0049 | 0.039 (1.4×) | 0.071 (1.4×) | |
| Friction optimization (Fig. 10) | On | 3.2 | 0.6 | 3.4 | 7.2 | 0.35 | 0.014 | 0.076 | 0.44 | 7.7 |
| Off | 5 (1.6×) | 0.63 | 3.7 | 9.3 (1.3×) | 0.55 (1.6×) | 0.015 | 0.082 | 0.64 (1.5×) | 9.9 (1.3×) | |
| Cloth rest scale (Fig. 12) | On | 13 | 0.38 | 1.5 | 15 | 0.48 | 0.00087 | 0.004 | 0.48 | 16 |
| Off | 18 (1.4×) | 0.4 | 1.6 | 20 (1.3×) | 0.64 (1.3×) | 0.00093 | 0.0038 | 0.64 (1.3×) | 21 (1.3×) | |
| Grasp angle (Fig. 13) | On | 0.34 | 0.044 | 0.47 | 0.85 | 0.058 | 0.0073 | 0.11 | 0.18 | 1 |
| Off | 0.51 (1.5×) | 0.045 | 0.48 | 1 (1.2×) | 0.084 (1.4×) | 0.0074 | 0.11 | 0.21 (1.2×) | 1.2 (1.2×) | |
| Cup catching (Fig. 14) | On | 2.3 | 0.17 | 5.4 | 7.9 | 0.68 | 0.009 | 0.33 | 1 | 8.9 |
| Off | 3.7 (1.6×) | 0.13 | 5.5 | 9.3 (1.2×) | 1 (1.5×) | 0.0099 | 0.33 | 1.3 (1.3×) | 11 (1.2×) | |
| Dual-arm grasp (Fig. 15) | On | 3.4 | 0.24 | 2.9 | 6.5 | 0.9 | 0.024 | 0.78 | 1.7 | 8.2 |
| Off | 5 (1.5×) | 0.21 | 2.8 | 7.9 (1.2×) | 1.3 (1.5×) | 0.024 | 0.79 | 2.1 (1.2×) | 10 (1.2×) | |
Differentiation uses the contact pairs, closest-feature choices, and control operations recorded during forward simulation. A pair of objects that remains outside the barrier's activation range contributes no direct contact gradient, which can limit the guidance available when the initial trajectory does not establish the desired interaction. Rest-shape derivatives assume fixed connectivity within each differentiated trajectory. Remeshing can occur between optimization steps, but its decisions and vertex transfers are not differentiated. Improving the underlying contact model and the gradients used for optimization offers a direction for future work. Geometric Contact Potential [Huang et al. 2025b] could reduce spurious contact forces and sensitivity to surface discretization. Long-range contact potentials [Ye et al. 2026] could provide gradient information before objects enter the local barrier range, helping optimization establish new contacts. Randomized smoothing with bundled gradients [Suh et al. 2022] could mitigate rapid changes in contact gradients. Adapting these approaches to coupled FEM-affine dynamics and evaluating their effects on simulation accuracy, optimization convergence, and computational cost remain future work.
References
David Baraff and Andrew Witkin. 1998. Large Steps in Cloth Simulation. In Proceedings of the 25th Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH '98). Association for Computing Machinery, New York, NY, USA, 43–54. doi:10.1145/280814.280821
Jernej Barbič and Doug L. James. 2005. Real-Time subspace integration for St. Venant-Kirchhoff deformable models. In ACM SIGGRAPH 2005 Papers (Los Angeles, California) (SIGGRAPH '05). Association for Computing Machinery, New York, NY, USA, 982–990. doi:10.1145/1186822.1073300
Filipe de A. Belbute-Peres, Kevin A. Smith, Kelsey R. Allen, Joshua B. Tenenbaum, and J. Zico Kolter. 2018. End-to-end differentiable physics for learning and control. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (Montréal, Canada) (NIPS'18). Curran Associates Inc., Red Hook, NY, USA, 7178–7189.
Miklos Bergou, Max Wardetzky, David Harmon, Denis Zorin, and Eitan Grinspun. 2006. A quadratic bending model for inextensible surfaces. In Proceedings of the Fourth Eurographics Symposium on Geometry Processing (Cagliari, Sardinia, Italy) (SGP '06). Eurographics Association, Goslar, DEU, 227–230.
Sofien Bouaziz, Sebastian Martin, Tiantian Liu, Ladislav Kavan, and Mark Pauly. 2014. Projective dynamics: fusing constraint projections for fast simulation. ACM Trans. Graph. 33, 4, Article 154 (July 2014), 11 pages. doi:10.1145/2601097.2601116
Christopher Brandt, Elmar Eisemann, and Klaus Hildebrandt. 2018. Hyper-reduced projective dynamics. ACM Trans. Graph. 37, 4, Article 80 (July 2018), 13 pages. doi:10.1145/3197517.3201387
Youshuai Cai, Chen Li, Haichuan Song, Youchen Xie, and ChangBo Wang. 2025. DiffQN: Differentiable Quasi-Newton Method for Elastodynamics. In Pacific Graphics Conference Papers, Posters, and Demos, Marc Christie, Ping-Hsuan Han, Shih-Syun Lin, Nico Pietroni, Teseo Schneider, Hsin-Ruey Tsai, Yu-Shuen Wang, and Eugene Zhang (Eds.). The Eurographics Association. doi:10.2312/pg.20251265
Jiong Chen, Florian Schäfer, Jin Huang, and Mathieu Desbrun. 2021. Multiscale Cholesky preconditioning for ill-conditioned problems. ACM Trans. Graph. 40, 4, Article 81 (July 2021), 13 pages. doi:10.1145/3450626.3459851
Jonas Degrave, Michiel Hermans, Joni Dambre, and Francis wyffels. 2019. A Differentiable Physics Engine for Deep Learning in Robotics. Frontiers in Neurorobotics Volume 13 - 2019 (2019). doi:10.3389/fnbot.2019.00006
Tao Du, Kui Wu, Pingchuan Ma, Sebastien Wah, Andrew Spielberg, Daniela Rus, and Wojciech Matusik. 2021. DiffPD: Differentiable Projective Dynamics. ACM Trans. Graph. 41, 2, Article 13 (nov 2021), 21 pages. doi:10.1145/3490168
Zachary Ferguson, Minchen Li, Teseo Schneider, Francisca Gil-Ureta, Timothy Langlois, Chenfanfu Jiang, Denis Zorin, Danny M. Kaufman, and Daniele Panozzo. 2021. Intersection-free rigid body dynamics. ACM Trans. Graph. 40, 4, Article 183 (July 2021), 16 pages. doi:10.1145/3450626.3459802
C. Daniel Freeman, Erik Frey, Anton Raichuk, Sertan Girgin, Igor Mordatch, and Olivier Bachem. 2021. Brax – A Differentiable Physics Engine for Large Scale Rigid Body Simulation. arXiv:2106.13281 [cs.RO] https://arxiv.org/abs/2106.13281
Moritz Geilinger, David Hahn, Jonas Zehnder, Moritz Bächer, Bernhard Thomaszewski, and Stelian Coros. 2020. ADD: analytically differentiable dynamics for multi-body systems with frictional contact. ACM Trans. Graph. 39, 6, Article 190 (Nov. 2020), 15 pages. doi:10.1145/3414685.3417766
Arvi Gjoka, Espen Knoop, Moritz Bächer, Denis Zorin, and Daniele Panozzo. 2024. Soft Pneumatic Actuator Design using Differentiable Simulation. In Special Interest Group on Computer Graphics and Interactive Techniques Conference Conference Papers '24 (Denver, CO, USA) (SIGGRAPH Conference Papers '24). Association for Computing Machinery, New York, NY, USA, Article 106, 11 pages. doi:10.1145/3641519.3657467
David Hahn, Pol Banzet, James M. Bern, and Stelian Coros. 2019. Real2Sim: visco-elastic parameter estimation from dynamic motion. ACM Trans. Graph. 38, 6, Article 236 (Nov. 2019), 13 pages. doi:10.1145/3355089.3356548
Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand. 2020. DiffTaichi: Differentiable Programming for Physical Simulation. ICLR (2020).
Yuanming Hu, Jiancheng Liu, Andrew Spielberg, Joshua B Tenenbaum, William T Freeman, Jiajun Wu, Daniela Rus, and Wojciech Matusik. 2019. ChainQueen: A Real-Time Differentiable Physical Simulator for Soft Robotics. Proceedings of IEEE International Conference on Robotics and Automation (ICRA) (2019).
Kemeng Huang, Floyd M. Chitalu, Huancheng Lin, and Taku Komura. 2024a. GIPC: Fast and Stable Gauss-Newton Optimization of IPC Barrier Energy. ACM Trans. Graph. 43, 2, Article 23 (March 2024), 18 pages. doi:10.1145/3643028
Kemeng Huang, Xinyu Lu, Huancheng Lin, Taku Komura, and Minchen Li. 2025a. StiffGIPC: Advancing GPU IPC for Stiff Affine-Deformable Simulation. ACM Trans. Graph. 44, 3, Article 31 (May 2025), 20 pages. doi:10.1145/3735126
Zizhou Huang, Maxwell Paik, Zachary Ferguson, Daniele Panozzo, and Denis Zorin. 2025b. Geometric Contact Potential. ACM Trans. Graph. 44, 4, Article 158 (July 2025), 24 pages. doi:10.1145/3731142
Zizhou Huang, Daniele Panozzo, and Denis Zorin. 2024b. Optimized shock-protecting microstructures. ACM Trans. Graph. 43, 6, Article 181 (Nov. 2024), 21 pages. doi:10.1145/3687765
Zizhou Huang, Davi Colli Tozoni, Arvi Gjoka, Zachary Ferguson, Teseo Schneider, Daniele Panozzo, and Denis Zorin. 2024c. Differentiable solver for time-dependent deformation problems with contact. ACM Trans. Graph. 43, 3, Article 31 (may 2024), 30 pages. doi:10.1145/3657648
Krishna Murthy Jatavallabhula, Miles Macklin, Florian Golemo, Vikram Voleti, Linda Petrini, Martin Weiss, Breandan Considine, Jerome Parent-Levesque, Kevin Xie, Kenny Erleben, Liam Paull, Florian Shkurti, Derek Nowrouzezahrai, and Sanja Fidler. 2021. gradSim: Differentiable simulation for system identification and visuomotor control. In International Conference on Learning Representations (ICLR). https://openreview.net/forum?id=c_E8kFWfhp0
Theodore Kim. 2020. A Finite Element Formulation of Baraff–Witkin Cloth. Computer Graphics Forum 39, 8 (2020), 171–179. doi:10.1111/cgf.14111
Shih-Yu Lai, Sung-Han Tien, Jui-I Huang, Yen-Chen Tseng, Yi-Ting Chiu, Siyuan Luo, Ziqiu Zeng, Fan Shi, Peter Yichen Chen, Tiantian Liu, Yu-Lun Liu, and Bing-Yu Chen. 2026. DiffPhD: A Unified Differentiable Solver for Projective Heterogeneous Materials in Elastodynamics with Contact-Rich GPU-Acceleration. arXiv:2605.14526 [cs.GR] https://arxiv.org/abs/2605.14526
Lei Lan, Danny M. Kaufman, Minchen Li, Chenfanfu Jiang, and Yin Yang. 2022. Affine body dynamics: fast, stable and intersection-free simulation of stiff materials. ACM Trans. Graph. 41, 4, Article 67 (July 2022), 14 pages. doi:10.1145/3528223.3530064
Minchen Li, Zachary Ferguson, Teseo Schneider, Timothy Langlois, Denis Zorin, Daniele Panozzo, Chenfanfu Jiang, and Danny M. Kaufman. 2020. Incremental Potential Contact: Intersection- and Inversion-free Large Deformation Dynamics. ACM Trans. Graph. (SIGGRAPH) 39, 4, Article 49 (2020).
Minchen Li, Chenfanfu Jiang, Zhaofeng Luo, Wenxin Du, Chang Yu, Žiga Kovačić, and Tianyi Xie. 2026. Physics-Based Simulation. doi:10.5281/zenodo.20597655
Xuan Li, Chang Yu, Wenxin Du, Ying Jiang, Tianyi Xie, Yunuo Chen, Yin Yang, and Chenfanfu Jiang. 2025. Dress-1-to-3: Single Image to Simulation-Ready 3D Outfit with Diffusion Prior and Differentiable Physics. ACM Trans. Graph. 44, 4, Article 71 (July 2025), 16 pages. doi:10.1145/3731177
Yifei Li, Tao Du, Kui Wu, Jie Xu, and Wojciech Matusik. 2022. DiffCloth: Differentiable Cloth Simulation with Dry Frictional Contact. ACM Trans. Graph. 42, 1, Article 2 (oct 2022), 20 pages. doi:10.1145/3527660
Junbang Liang, Ming C. Lin, and Vladlen Koltun. 2019. Differentiable Cloth Simulation for Inverse Problems. In Conference on Neural Information Processing Systems (NeurIPS).
Tiantian Liu, Sofien Bouaziz, and Ladislav Kavan. 2017. Quasi-Newton Methods for Real-Time Simulation of Hyperelastic Materials. ACM Trans. Graph. 36, 3, Article 23 (May 2017), 16 pages. doi:10.1145/2990496
Mickaël Ly, Jean Jouve, Laurence Boissieux, and Florence Bertails-Descoubes. 2020. Projective dynamics with dry frictional contact. ACM Trans. Graph. 39, 4, Article 57 (Aug. 2020), 8 pages. doi:10.1145/3386569.3392396
Yi-Ling Qiao, Junbang Liang, Vladlen Koltun, and Ming C. Lin. 2020. Scalable Differentiable Physics for Learning and Control. In ICML.
Junior Rojas, Eftychios Sifakis, and Ladislav Kavan. 2021. Differentiable Implicit Soft-Body Physics. arXiv:2102.05791 [cs.LG] https://arxiv.org/abs/2102.05791
Breannan Smith, Fernando de Goes, and Theodore Kim. 2018. Stable Neo-Hookean Flesh Simulation. ACM Transactions on Graphics 37, 2, Article 12 (2018), 15 pages. https://graphics.pixar.com/library/StableElasticity/paper.pdf
Hyung Ju Terry Suh, Tao Pang, and Russ Tedrake. 2022. Bundled Gradients Through Contact Via Randomized Smoothing. IEEE Robotics and Automation Letters 7, 2 (2022), 4000–4007. doi:10.1109/LRA.2022.3146931
Davi Colli Tozoni, Yunfan Zhou, and Denis Zorin. 2021. Optimizing contact-based assemblies. ACM Transactions on Graphics 40, 6 (2021), 269:1–269:19. doi:10.1145/3478513.3480552
Ty Trusty, Otman Benchekroun, Eitan Grinspun, Danny M. Kaufman, and David I.W. Levin. 2023. Subspace Mixed Finite Elements for Real-Time Heterogeneous Elastodynamics. In SIGGRAPH Asia 2023 Conference Papers (Sydney, NSW, Australia) (SA '23). Association for Computing Machinery, New York, NY, USA, Article 112, 10 pages. doi:10.1145/3610548.3618220
Ty Trusty, Yun (Raymond) Fei, David Levin, and Danny Kaufman. 2024. Trading Spaces: Adaptive Subspace Time Integration for Contacting Elastodynamics. ACM Trans. Graph. 43, 6, Article 227 (Nov. 2024), 16 pages. doi:10.1145/3687946
Xuan Wang, Zhaofeng Luo, Minchen Li, Taku Komura, and Kemeng Huang. 2026. AGIPC: Adaptive In-Solve Algebraic Coarsening for GPU IPC. In SIGGRAPH Conference Papers '26. Association for Computing Machinery, New York, NY, USA, Article 154, 11 pages. doi:10.1145/3799902.3811199
Keenon Werling, Dalton Omens, Jeongseok Lee, Ioannis Exarchos, and C. Karen Liu. 2021. Fast and Feature-Complete Differentiable Physics Engine for Articulated Rigid Bodies with Contact Constraints. In Proceedings of Robotics: Science and Systems. Virtual. doi:10.15607/RSS.2021.XVII.034
Botao Wu, Zhendong Wang, and Huamin Wang. 2022. A GPU-based multilevel additive schwarz preconditioner for cloth and deformable body simulation. ACM Trans. Graph. 41, 4, Article 63 (July 2022), 14 pages. doi:10.1145/3528223.3530085
Xiaohan Ye, Xifeng Gao, Kui Wu, Zherong Pan, and Taku Komura. 2025. SDRS: Shape-Differentiable Robot Simulator. IEEE Transactions on Robotics (2025).
Xiaohan Ye, Kui Wu, Zherong Pan, and Taku Komura. 2026. Efficient Differentiable Contact Model with Long-Range Influence. In International Conference on Learning Representations. https://arxiv.org/abs/2509.20917
Ziqiu Zeng, Siyuan Luo, Fan Shi, and Zhongkai Zhang. 2025. Fast But Accurate: A Real-Time Hyperelastic Simulator with Robust Frictional Contact. ACM Trans. Graph. 44, 4, Article 88 (July 2025), 19 pages. doi:10.1145/3730834
A Derivatives for the Coupled FEM–Affine Adjoint
The frame-wise adjoint requires local derivatives for assembling the coupled Hessian and accumulating parameter and earlier-state gradients (Sections 4–6.2). This appendix derives these quantities for friction, elasticity, inertia, and joints. The derivations account for current and previous contact geometry, the dependence of mass and elastic response on rest shape, and the effects of joint geometry and control parameters.
A.1 Friction derivatives
A.1.1 Smoothed friction energy. The friction energy uses current-step sliding and contact quantities computed from previous-frame geometry [Li et al. 2020]. For contact c, the previous positions determine the closest-point interpolation weights, contact plane, and normal force. Let and denote the previous position and displacement of contact vertex .
The matrix converts stacked vertex displacements into the relative displacement of the two closest points:
Adding the same displacement to all contact vertices leaves their relative displacement unchanged because the sum of the weights
• Huang et al.
is zero. With , the weights for the four mesh-contact types of IPC are
The point is numbered first for point-edge and point-triangle contact. For point-edge contact, the other side has endpoints 2, 3, and its closest point is , where and . For point-triangle contact, , , are the barycentric coordinates of the closest point on triangle :
For edge-edge contact, the two edges have endpoints and , with closest points and , where and . The coefficients satisfy
The edge and triangle formulas apply when the closest points lie in the interiors of the respective features. When a closest point lies at an edge endpoint or on a triangle boundary, the contact uses the corresponding point-point or point-edge formula.
The columns of are two orthogonal unit directions in the contact plane. For mesh–mesh contact, the unit normal is . An explicit construction using a Cartesian unit vector not parallel to is
Any orthonormal basis of this plane gives the same isotropic friction energy and world-space gradient, since . For the fixed horizontal ground, the normal is fixed and only the moving vertex is included in . In this case, and , with and .
For mesh–mesh contact, W and U depend on . Both remain fixed when differentiating with respect to current positions. For the stacked displacement , the sliding displacement is
Here contains the two in-plane displacement components, and is its squared length.
The friction energy is , where is the friction coefficient. The normal-force magnitude is determined by the barrier in Equation (14). For , let and . The first and second barrier derivatives are
(67)
At the previous squared contact distance , the normal-force magnitude is . It is held fixed during the current-frame solve. Its dependence on the previous positions is included in the history derivative. The unsmoothed friction energy is proportional to , which is not differentiable at zero sliding displacement. IPC uses smoothed friction to avoid discontinuities. With , where is the friction-smoothing velocity threshold, the smooth function for mesh-mesh contact is
For ground friction, the smoothed function is
The required energy gradient is with respect to current vertex positions . Since , , and are fixed for this derivative, . The chain rule gives
(70)
The vector is the gradient with respect to the two-dimensional sliding displacement. For mesh–mesh friction below the smoothing threshold,
This slip gradient is mapped to vertex positions by the factor in Equation (70). Above the threshold, the slip gradient is for both laws. For ground friction below the threshold, it is .
Within each smooth branch, differentiating again gives the Hessian:
At zero slip, the gradient is zero and the limiting is for mesh–mesh friction or for ground friction. The dependence of W, U, and on previous-frame positions supplies the temporal coupling in Equation (38).
A.1.2 Friction-coefficient and history derivatives. Point-space friction gradient supports coefficient fitting and differentiation through time. Its coefficient derivative measures how frictional resistance changes with . Its history derivative also accounts for changes in closest-point weights, contact-plane orientation, normal force, and relative displacement. Let denote the two-dimensional slip derivative in Equation (70). At fixed frame configurations, W, U, and are independent of . The coefficient derivative and its loss-gradient contribution from contact c at frame t are
(72)
The contributions are summed over all contacts and frames that share . Together with the direct loss derivative, this sum gives the total coefficient gradient in Equation (30).
A change in changes both the measured displacement and the geometry defining friction. The corresponding matrix is
With the contact vertices indices and contact type fixed, vary while holding , , and fixed. Since , Equation (66) gives
The first two terms account for changes in the contact-plane basis and closest-point weights. The last accounts for the previous positions in the displacement difference. Applying the product rule to Equation (70) yields
The weight differential is . For point-point contact, the weights are constant, so . For the remaining contact types, the interpolation weights depend on the previous-frame vertex positions through the closest-point parameters. These parameters locate the closest points on the edges or triangle and form the vector
The vector is determined by the linear system
Here is the coefficient matrix and is the right-hand side, both determined by the previous-frame vertex positions.
For point-edge contact, the closest point on edge is , with . At an interior closest point, the vector is perpendicular to the edge direction , giving
For point-triangle contact, are the two independent barycentric coordinates of the closest point on triangle , with . The matrix
has as its columns the two triangle edges starting at vertex 2. The closest point is . For a closest point inside the triangle, the vector is perpendicular to both triangle edges, giving
For edge–edge contact, , locate the closest points along edges (1, 2) and (3, 4). With and , the closest points are and . For closest points in the interiors of both edges, the vector connecting them is perpendicular to both edge directions, yielding
Differentiating the linear system with respect to the previous-frame vertex positions gives
The product rule applied to the explicit expressions above gives and from the vertex variations. The edge–edge coordinate variations and include the effects of changes in both edge directions and their relative positions. The resulting weight variations are
where has been substituted in the triangle case. These entries determine through its block definition above.
For mesh–mesh contact, let be the vector between the closest points and the reference direction projected into the contact plane. Holding fixed, differentiation of the normalized directions gives
These expressions supply the weight and contact-plane derivatives required by the history derivative. Differentiating the normal force using Equation (67) gives
For the fixed ground plane, dW and dU vanish. Its history derivative includes changes in sliding displacement and in the normal force set by the previous vertex-to-plane distance.
The mapped derivative places FEM and affine contact points in the same temporal coupling. Its transposed product
Huang et al.
contributes to through Equation (38), carrying the effect of later friction back to earlier motion DoFs. Second-frame friction therefore contributes to initial-state gradients through the first-frame adjoint. At t = 1, the previous positions are initial inputs and their parameter dependence contributes directly to the initial-state gradient.
A.1.3 Rest-shape derivatives under friction. With solved motion DoFs fixed, an affine rest-shape change moves contact points at both the current and previous frames. The direct derivative therefore includes both configurations and the map from point forces to affine DoFs. These derivatives hold , the friction coefficient, and the smoothing threshold fixed. The frame adjoints supply the complementary change in simulated motion.
For a surface vertex on affine body , let be one component of its rest position , where indexes the , , and components, respectively. The vector is the unit vector along the selected coordinate axis. Equation (2) gives at both and . Thus the same rest-coordinate change moves current and previous contact points through their respective affine transformations. The point map in Equation (3) also changes:
For a contact containing vertex , this block occupies the rows of that vertex and the columns of body in . For a shape parameter controlling several rest coordinates, its derivative follows by applying the chain rule through the rest-shape parameterization.
The induced change in the point-space friction gradient is
The current-position term uses the Hessian obtained by differentiating Equation (70). The previous-position term uses Equation (73), including the changes in weights, basis, and normal force derived above. Combining these geometry terms with the point-map derivative gives Equation (47). For contact c at frame t, the friction contribution to the loss gradient is
The three terms account for the force map and the contact geometry at both time levels. Their sum over the relevant contacts and frames is added to the other physical contributions and any direct loss derivative to obtain the total rest-shape gradient .
For free FEM vertices, the solved positions are the motion DoFs and their point maps are identity matrices. The effect of rest shape on simulated motion is propagated through the frame adjoints. Affine surfaces also contribute the direct geometry and point-map derivatives above. If rest shape determines the initial vertex positions, their direct contribution is included in the first-frame friction derivatives with respect to those initial positions.
A.2 Volumetric FEM and cloth parameter derivatives
Element energies supply both the frame Hessian and the parameter derivatives needed for material identification and deformable rest-shape design. Volumetric elements use stable Neo-Hookean [Smith et al. 2018]. Cloth combines the finite-element Baraff–Witkin [Kim 2020] with StiffGIPC’s cubic extension penalty. Differentiating these energies with respect to material and rest-shape parameters supplies local gradient contributions at fixed current positions. The coupled adjoint accounts for the resulting deformation and its interactions with other objects.
A.2.1 Tetrahedral elasticity. For a tetrahedron with local vertex indices 0, 1, 2, 3, define its rest and current edge matrices as
Its deformation gradient is , and its rest volume is . Let . The stable Neo-Hookean [Smith et al. 2018] is
The coefficients are per element, with element subscript suppressed. The incremental-potential contribution is . The determinant derivative is , where denotes the cofactor matrix. Differentiating the energy density with respect to gives the first Piola stress:
Let vec stack matrix columns and . The same geometric Jacobian maps stress, constitutive Hessian, and material derivatives into vertex DoFs:
Here stacks the four current vertex positions and is constant with respect to them. With for and , , where is the Kronecker product.
The constitutive Hessian follows by differentiating the stress:
The colon is the Frobenius inner product. For , the cofactor columns are , , and . Their differentials follow the cross-product rule, e.g., . These expressions determine every entry of .
At fixed , the material derivatives are
Their contributions to are . The material parameterization relates Young's modulus and Poisson's ratio to the energy coefficients through the Lamé input parameters and , followed by and . Gradients with respect to , , or the optimizer variables in Equation (65) follow through these maps.
Rest-shape design changes both the reference geometry and the elastic response. Rest-shape differentiation accounts for changes in the inverse rest-edge matrix , the element rest volume , and the deformation-gradient Jacobian . With current positions fixed,
(77)
Differentiating the block expression for gives . The complete elastic contribution is
The three terms account for variations in the rest volume , the deformation-gradient Jacobian , and the first Piola stress , respectively. The adjoint converts their effect on the frame equations into loss gradients. For stress-based objectives such as Loaded Support (Figure 8), the loss's explicit dependence on rest geometry contributes separately through .
A.2.2 Cloth membrane elasticity. For a nondegenerate triangle with local vertices 0, 1, 2, define the rest edges and , and the current edge matrix . Aligning the local horizontal axis with the rest edge gives
The entries depend on edge lengths and their included angle, so a rigid rotation of the rest triangle leaves unchanged. At a fixed rest shape, this matrix remains constant throughout the forward trajectory. The deformation gradient is . Let and . The two local coordinate axes specify the orthogonal warp and weft directions in the stretch and shear terms of Kim [2020]. Including StiffGIPC's cubic extension penalty [Huang et al. 2025a] gives
Here and is the fixed cubic-penalty coefficient. The cubic term adds resistance in extension, with its derivatives included in the same stress and Hessian. The incremental potential is , with the rest area. The constitutive parameterization is and .
Define , where . Since and , the stress columns are
For and , with , the four blocks of are
The parameter derivatives follow from the linear dependence of the stress on the two stiffnesses:
The assembly in Equation (75) maps these constitutive derivatives to cloth vertex DoFs, using and replacing by .
Rest-shape derivatives follow directly from the edge-based reference coordinates. Let be the first edge length, and let be vertex 2's local coordinates, given by the second column of . With rest area and unit normal , the geometric differentials are
Consequently,
The inverse-matrix identity in Equation (77) gives . At fixed current positions, changes the constitutive stress, and the same inverse-map derivative changes . supplies the integration-weight variation.
A.2.3 Cloth bending derivatives. The quadratic bending model of Bergou et al. [2006] uses a geometric matrix determined by the adjacent triangle areas and cotangent weights. This matrix supplies the position gradient, Hessian, and bending-stiffness derivative. Its rest-shape derivative includes changes in both the area normalization and the cotangent weights. An interior cloth edge defines a hinge with rest vertices , where 0, 1 are endpoints and 2, 3 are opposite vertices. Let , , and . The adjacent rest areas are and . Using , define
• Huang et al.
The geometric matrix is . With stacking current hinge vertices, the energy is
Its contribution to the incremental potential is . The hinge coefficient is the average of its adjacent triangles' bending stiffnesses . The matrix is symmetric and fixed during differentiation with respect to current positions, giving
At fixed stiffness and current positions, the rest derivative is , where
The area derivatives use the triangle formula above. Each cotangent derivative is explicit:
These cotangent derivatives determine and complete the hinge's rest-shape derivative.
Rest-shape gradients also account for the mass redistribution induced by geometry changes. A tetrahedron contributes to each incident vertex, and a cloth triangle contributes . Differentiating these weights gives dM and the inertial contribution
at fixed solved states. The second term accounts for parameter-dependent positions or velocities in the predictor. Elastic, bending, and inertial terms provide local contributions to in Equation (33). Their products share the same coupled adjoint and can be accumulated without forming the global parameter-derivative matrix, as described in Section 6.2.
A.3 Joint geometry and control derivatives
Joint targets and forces influence the coupled scene through the same frame equations as collision and friction. Geometric constraints maintain the connection between the two bodies and . The control energy sets a target for the joint's permitted motion or applies a joint force. Differentiating both energies in affine coordinates preserves their cross-body Hessian blocks, allowing the adjoint to connect a joint command to the response of interacting FEM and affine objects. The local expressions use and . Joint anchors, reference directions, and stiffnesses are held fixed when differentiating control parameters.
A.3.1 Local maps and geometric constraints. A material-space anchor has world position , where is the point map from Equation (3). A material-space direction has no translation component. Its map is
so . The joint energy uses these affine-transformed directions directly. For each body, denote the transformed joint axis and two transverse reference directions by , , and . Let .
A revolute joint matches two distinct points on its hinge line. For endpoint , define , using the two bodies' material-space copies of that endpoint. A prismatic joint constrains the anchor separation to lie along the joint axes and matches transverse directions. The geometric residuals are
A fixed joint uses anchor coincidence and matching transverse directions: . For any of these residuals, the constraint energy is . With , the chain and product rules give
(80)
The affine coordinate maps make point- and direction-matching residuals linear in q, with zero second derivatives. Prismatic cross-product residuals are bilinear and supply additional cross-body Hessian terms. The two cross-product terms in , and , contribute second derivatives to the constraint-energy Hessian. To derive these terms, let denote either cross-product residual:
With the joint reference geometry fixed, are constant with respect to . For the first prismatic block they are and . For the second block, they are and . Writing , the block Jacobian is
For component , let , so . A second differentiation yields
These constant component Hessians supply the residual-weighted term in Equation (80).
A.3.2 Prismatic displacement. The prismatic coordinate depends on the vector joining the two joint anchors and the world-space joint-axis vector of body c. Differentiating both vectors accounts for the motion of both connected bodies in its gradient and Hessian.
Let and . Differentiating gives , hence
The gradient with respect to includes both anchor motion and axis variation. Differentiating with respect to gives
The bilinear coordinate gives a constant Hessian at fixed joint geometry. Its off-diagonal blocks retain the dependence on both connected bodies.
A.3.3 Revolute orientation. Revolute actuation is expressed directly in the two bodies' affine coordinates. Bilinear orientation quantities give explicit gradients and constant cross-body Hessian blocks, retaining the coupled angular response in compact motion coordinates. Let and be the two transformed reference directions on body . The orientation quantities used by the control energy are
(84)
The two quantities measure relative turning and alignment. For rigid rotations with orthonormal reference frames and aligned joint axes, they equal the sine and cosine of the relative angle. The target energy uses their affine expressions directly, so the derivatives retain changes in both the lengths and orientations of the transformed reference vectors.
To express their bilinear form, let and , and define
(85)
Then and , giving
and
The joint angle is . The target quantities , are defined in Equation (54). For on the selected angle branch, differentiation gives
At fixed applied target a, the second derivatives of the target quantities use the same linear combinations:
(89)
For the angle, set , , and . Differentiating the numerator and denominator of yields
A.3.4 Control derivatives and coupled assembly. The coordinate derivatives determine the Hessians of the joint energies in Section 5.4 with respect to the motion DoFs. Differentiating the energy gradients with respect to joint targets and joint forces gives the control derivatives. For a prismatic joint, the scalar multiplying is . Its derivatives with respect to and are and , giving Equation (53). For a revolute target, and . Differentiating their state gradients also gives and . Substitution into the product rule yields Equation (56). The joint-force terms use coordinate gradients and . At fixed , , and , differentiating the state gradients gives the full control-energy Hessians:
(91)
Here is the fixed cosine weight from Equation (55).
Geometric and control Hessians use the same ordering. Their off-diagonal blocks couple the joint-connected bodies within the frame matrix, alongside the contact blocks coupling them to the rest of the scene. The local control derivative is multiplied by the corresponding free-body entries of the global adjoint in Equation (52). A shared control accumulates contributions from every joint and frame to which it is applied. All selected controls therefore use the same frame adjoints rather than separate coupled solves for individual control variables.
B Experimental Settings and Parameters
Tables 6 and 7 summarize the simulation settings and differentiated parameter families, respectively, for the experiments in Section 7. The task losses define the observation frames and optimization stopping events. For tasks with separate optimization and verification phases, the differentiated trajectory provides the gradient at the specified observation or event, and the full listed horizon assesses the resulting motion. Forward and backward evaluation counts follow the definitions in Section 7.
For scene diagonal , the collision activation gap is , whose square is in the barrier energy. The friction-smoothing velocity gives the displacement scale . The coefficients and control the collision barrier and affine shape energy, respectively. With denoting the Newton search direction in world coordinates, the stopping criterion is
Huang et al.
Table 6. Simulation settings for the design, identification, and control tasks in Section 7. The columns report time step , relative collision activation distance , barrier coefficient , friction-smoothing velocity threshold , motion DoFs, relative Newton tolerance , friction coefficient, Young's modulus for volumetric FEM or cloth stretching, and affine stiffness . For Dual-arm grasp, 0.3 is the arm–cloth friction coefficient and 0.2 is the cloth–table coefficient.
| Example | h | Horizon | #DOF | Newton | Friction | E | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| Stone placement (Fig. 1) | 0.03 | 1000 | 84 | 0.3 | - | |||||
| Bunny collision (Fig. 6) | 0.05 | 40 | - | 5598 | 0 | - | ||||
| Tentacle matching (Fig. 7) | 0.005 | 100 | 20688 | 1 | - | |||||
| Garment Hanger (Fig. 4) | 1/120 | 600 | 51357 | 0.05 | ||||||
| Loaded Support (Fig. 8) | 0.02 | 20 | - | 22545 | 0 | - | ||||
| Material fitting (Fig. 9) | 0.1 | 10 | - | 12567 | 0 | - | ||||
| Friction optimization (Fig. 10) | 0.02 | 100 | 2799 | 0.5→0.1 | - | |||||
| Cloth rest scale (Fig. 12) | 1/24 | 48 | - | 102732 | 0 | |||||
| Grasp angle (Fig. 13) | 0.02 | 120 | 195 | 0.1 | ||||||
| Cup catching (Fig. 14) | 0.005 | 240 | 192 | 1.0 | - | |||||
| Dual-arm grasp (Fig. 15) | 0.01 | 330 | 12504 | 0.2/0.3 |
Table 7. Physical parameter families exposed to task-specific design variables through the interface in Section 6.3. Each family contributes local derivatives to the shared coupled adjoint.
| Physical group | Differentiated quantities | Role |
|---|---|---|
| Tetrahedral material | Stable Neo-Hookean material response | |
| Initial FEM motion | Selected initial vertex velocities | Initial dynamic state |
| Deformable rest shape | Selected rest coordinates | Volumetric and cloth rest geometry |
| Cloth material | Stretch, shear, and bending coefficients | Cloth constitutive response |
| Friction | Mesh self and ground friction coefficients | Frictional contact |
| Initial affine motion | Initial affine state | |
| Affine rest shape | Selected surface-rest coordinates | Mass, inertia, shape energy, collision, and friction |
| Joint controls | Joint targets and forces | Revolute or prismatic actuation on selected joints and frames |
| Affine position targets | Target positions | Position control |
The shared FEM benchmarks use the same convergence tolerances to align numerical accuracy in the timing comparisons. The forward PCG relative residual tolerance is .
The parameter families in Table 7 connect task-specific design variables to material response, geometry, initial motion, and actuation through the interface in Section 6.3. Different parameterizations and objectives share the same coupled backward computation. Each parameter family is differentiated in its associated motion representation. The FEM rest-shape configuration uses free FEM vertex positions. Affine rest-shape derivatives include the effects of coupled contact and active friction.