Skip to content

Commit e62964b

Browse files
authored
GCP tutorial (#199)
1 parent 1339890 commit e62964b

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
tutorials/getting_started.rst
2222
tutorials/advanced_friction.rst
2323
tutorials/convergent.rst
24+
tutorials/gcp.rst
2425
tutorials/nonlinear_ccd.rst
2526
tutorials/adhesion.rst
2627
tutorials/simulation.rst

docs/source/references.bib

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,22 @@ @article{Huang2024GIPC
108108
pages = {1--18},
109109
note = {\url{https://dl.acm.org/doi/10.1145/3643028}}
110110
}
111+
@article{Huang2025GCP,
112+
author = {Huang, Zizhou and Paik, Maxwell and Ferguson, Zachary and Panozzo, Daniele and Zorin, Denis},
113+
title = {Geometric Contact Potential},
114+
year = {2025},
115+
issue_date = {August 2025},
116+
publisher = {Association for Computing Machinery},
117+
address = {New York, NY, USA},
118+
volume = {44},
119+
number = {4},
120+
issn = {0730-0301},
121+
url = {https://doi.org/10.1145/3731142},
122+
doi = {10.1145/3731142},
123+
abstract = {Barrier potentials gained popularity as a means for robust contact handling in physical modeling and for modeling self-avoiding shapes. The key to the success of these approaches is adherence to geometric constraints, i.e., avoiding intersections, which are the cause of most robustness problems in complex deformation simulation with contact. However, existing barrier-potential methods may lead to spurious forces and imperfect satisfaction of the geometric constraints. They may have strong resolution dependence, requiring careful adaptation of the potential parameters to the object discretizations.We present a systematic derivation of a continuum potential defined for smooth and piecewise smooth surfaces, starting from identifying a set of natural requirements for contact potentials, including the barrier property, locality, differentiable dependence on shape, and absence of forces in rest configurations. Our potential is formulated independently of surface discretization and addresses the shortcomings of existing potential-based methods while retaining their advantages.We present a discretization of our potential that is a drop-in replacement for the potential used in the incremental potential contact formulation [Li et al. 2020], and compare its behavior to other potential formulations, demonstrating that it has the expected behavior. The presented formulation connects existing barrier approaches, as all recent existing methods can be viewed as a variation of the presented potential, and lays a foundation for developing alternative (e.g., higher-order) versions.},
124+
journal = {ACM Trans. Graph.},
125+
month = jul,
126+
articleno = {158},
127+
numpages = {24},
128+
keywords = {finite element method, elastodynamics, contact dynamics}
129+
}

docs/source/tutorials/gcp.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.. _geometric-contact-potential-formulation:
2+
3+
Geometric Contact Potential
4+
======================
5+
6+
In addition to the original implementation of :cite:t:`Li2020IPC`, we also implement the Geometric Contact Potential (GCP) from :cite:t:`Huang2025GCP`.
7+
8+
GCP is implemented as separate collision and potential classes. A basic example of computing the GCP potential is as follows.
9+
10+
.. code-block:: c++
11+
12+
ipc::SmoothCollisions collisions;
13+
if (use_adaptive_dhat)
14+
collisions.compute_adaptive_dhat(collision_mesh, vertices, params);
15+
collisions.build(collision_mesh, vertices, params, use_adaptive_dhat);
16+
17+
ipc::SmoothContactPotential barrier_potential;
18+
double b = barrier_potential(collisions, mesh, vertices);
19+
20+
.. important::
21+
If `use_adaptive_dhat` is true, make sure to call `SmoothCollisions::compute_adaptive_dhat()` before `SmoothCollisions::build()`.
22+
23+
Technical Details
24+
-----------------
25+
26+
Similar to IPC, GCP potential has a distance barrier that converges to infinity as the distance converges to zero.
27+
28+
.. math::
29+
B(d; \hat{d}, p) := \frac{3}{2} B^3(\frac{2d}{\hat{d}}) d^{-p}
30+
31+
where :math:`\hat{d}` is the support size of the barrier function, :math:`p=d-1`, where :math:`d` is the dimension of the physics scene (2 or 3).
32+
33+
The main motivation of developing GCP is to eliminate the spurious collision forces in IPC when :math:`\hat{d}` is relatively large. The two important components to achieve this are *local minimum constraint* and *exterior direction constraint*. Please check out :cite:t:`Huang2025GCP` for more details, here we only give a high level idea.
34+
35+
The local minimum constraint is by noticing that the barrier potential is only necessary when the two primitives in a collision pair are the "distance local minima" on each surface they live. To achieve this, we consider the gradient of distance function along the tangent directions on the surface, and smoothly clamp the barrier to zero if the gradient of distance is positive along the tangent directions, since it suggests that there already exists a closer point on the surface that can trigger the barrier.
36+
37+
The exterior direction constraint is by noticing that, for a thin volumetric shell, the barrier potential is not needed for points on the opposite sides of the shell. To achieve this, we smoothly clamp the barrier based on the normal directions of two primitives in a collision pair. If the normal direction points to the opposite direction of the distance direction, we can skip this collision pair.
38+
39+
Both constraints not only reduces the number of collision pairs, but also increases the accuracy of collision handling by eliminating spurious forces that are non-physical, allowing wider range of :math:`\hat{d}` to be used in the simulation.
40+
41+
Parameter choices
42+
-----------------
43+
44+
Besides :math:`\hat{d}`, GCP also has other parameters to control the smoothness of local minimum and exterior direction constraints. For each constraint, there are :math:`\alpha` and :math:`\beta` to control the support region of the smooth Heaviside function (:math:`\alpha_t,\ \beta_t` for local minimum constraint, and :math:`\alpha_n,\ \beta_n` for exterior direction constraint). The smooth Heaviside function :math:`H(z;\alpha,\beta)\in C^1(\mathbb{R})` satisfies that
45+
46+
.. math::
47+
H(z;\alpha,\beta) = 0,\ \forall z < -\alpha \\
48+
H(z;\alpha,\beta) = 1,\ \forall z > \beta \\
49+
H'(z;\alpha,\beta) \geq 0,\ \forall z
50+
51+
Since :math:`H(z;\alpha,\beta)` takes the dot and cross products of unit vectors as inputs, we have :math:`-1\leq z\leq 1`. Thus, the basic requirement for parameters is:
52+
53+
.. math::
54+
0 \leq -\beta < \alpha \leq 1.
55+
56+
As :math:`\alpha + \beta` decreases, the support size of the Heaviside function reduces and the function becomes less smooth, thus, the overall potential becomes harder to optimize.
57+
58+
.. tip::
59+
For simplicity, we recommend to just use :math:`\beta_n = \beta_t = 0`. To make sure the potential landscape is smooth, the recommended parameter choices are :math:`\alpha_t\in [0.2, 0.9]`, :math:`\alpha_n = 0.1`.
60+
61+
Friction
62+
--------
63+
64+
We implement the original friction formulation of :cite:t:`Li2020IPC` following the same style, details are covered in the paper :cite:t:`Huang2025GCP`.

0 commit comments

Comments
 (0)