Skip to content

Commit 2747663

Browse files
authored
Colision doc extension (#3755)
1 parent 598c413 commit 2747663

3 files changed

Lines changed: 202 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Add opt-in isolated multi-world implicit MPM with capacity-bounded rebuildable sparse grids, selective world resets, outer graph capture, and asynchronous overflow reporting; legacy shared topology remains the default.
1919
- Add `cloth_stiff_material_hanging` and `cloth_stiff_material_stretch` examples regression-guarding the new Neo-Hookean triangle material (stability under gravity at extreme stiffness, and bulk area-preservation across a Poisson-ratio sweep)
2020
- Add contact examples for Newton's cradle, a balance bird, and a domino spiral
21+
- Document geometry-pair contact behavior and clarify that MuJoCo Warp currently produces a single contact for cylinder--box pairs even with MultiCCD enabled.
2122
- Add `ViewerUSD(points_as_spheres=...)` to render `log_points` particles as a `UsdGeom.PointInstancer` of sphere prototypes; enabled by default (opt out with `points_as_spheres=False` for flat `UsdGeom.Points` splats)
2223
- Add list-of-pattern and explicit-index selectors to `ArticulationView`.
2324
- Add `newton[onnx]` for ONNX policy inference through Warp-NN; `ControllerNeuralMLP`, `ControllerNeuralLSTM`, and RL policy examples can run exported `.onnx` policies without requiring PyTorch for ONNX execution.

docs/concepts/collisions.rst

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,205 @@ Examples:
143143
See :ref:`Solver Integration` for the full code pattern showing how to configure
144144
this.
145145

146+
.. _Geometry Pair Contact Behavior:
147+
148+
Geometry-Pair Contact Behavior
149+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
150+
151+
The two tables below describe contacts generated by Newton's
152+
:class:`~CollisionPipeline` only; they do not apply to contacts generated by the
153+
native MuJoCo CPU or MuJoCo Warp collision pipelines. The values are theoretical
154+
upper bounds per shape pair and collision pass before the shared
155+
``rigid_contact_max`` capacity is applied. Actual counts vary with pose, margin,
156+
and collision settings.
157+
158+
**CollisionPipeline primitive and convex-hull pairs**
159+
160+
.. list-table::
161+
:header-rows: 1
162+
:stub-columns: 1
163+
:widths: 18 9 9 10 11 11 8 9 13
164+
165+
* - Shape A / Shape B
166+
- Plane
167+
- Sphere
168+
- Capsule
169+
- Ellipsoid
170+
- Cylinder
171+
- Box
172+
- Cone
173+
- Convex hull
174+
* - Plane
175+
- 5
176+
- 1
177+
- 2
178+
- 1
179+
- 4
180+
- 4
181+
- 5
182+
- 5
183+
* - Sphere
184+
- 1
185+
- 1
186+
- 1
187+
- 1
188+
- 1
189+
- 1
190+
- 1
191+
- 1
192+
* - Capsule
193+
- 2
194+
- 1
195+
- 2
196+
- 1
197+
- 5
198+
- 5
199+
- 5
200+
- 5
201+
* - Ellipsoid
202+
- 1
203+
- 1
204+
- 1
205+
- 1
206+
- 1
207+
- 1
208+
- 1
209+
- 1
210+
* - Cylinder
211+
- 4
212+
- 1
213+
- 5
214+
- 1
215+
- 5
216+
- 5
217+
- 5
218+
- 5
219+
* - Box
220+
- 4
221+
- 1
222+
- 5
223+
- 1
224+
- 5
225+
- 5
226+
- 5
227+
- 5
228+
* - Cone
229+
- 5
230+
- 1
231+
- 5
232+
- 1
233+
- 5
234+
- 5
235+
- 5
236+
- 5
237+
* - Convex hull
238+
- 5
239+
- 1
240+
- 5
241+
- 1
242+
- 5
243+
- 5
244+
- 5
245+
- 5
246+
247+
The plane--plane upper bound is five when at least one plane is finite. Two
248+
infinite planes produce no contacts.
249+
250+
**CollisionPipeline mesh, heightfield, and SDF routes**
251+
252+
``V`` is a mesh vertex count, ``T_overlap`` is the number of overlapping
253+
triangles, and ``E`` is the number of collision edges. The estimated typical
254+
count is the sizing heuristic used for allocation, not a measured statistical
255+
average or a per-pair limit.
256+
257+
.. list-table::
258+
:header-rows: 1
259+
:widths: 27 18 23 12 20
260+
261+
* - Pair or route
262+
- Reduced maximum (default)
263+
- Unreduced maximum
264+
- Estimated typical count
265+
- Notes
266+
* - Triangle mesh--infinite plane
267+
- 240
268+
- ``V_mesh``
269+
- About 40
270+
- At most one candidate per mesh vertex.
271+
* - Mesh/heightfield--sphere or ellipsoid
272+
- 240
273+
- ``T_overlap``
274+
- About 40
275+
- At most one contact per overlapping triangle.
276+
* - Mesh/heightfield--other primitive or convex hull
277+
- 240
278+
- ``5 * T_overlap``
279+
- About 40
280+
- Each overlapping triangle uses the convex manifold path.
281+
* - Mesh--mesh
282+
- 240
283+
- ``E_A + E_B``
284+
- About 40
285+
- Uses edge-vs-SDF queries, with BVH distance fallback when needed.
286+
* - Heightfield--mesh
287+
- 240
288+
- ``E_heightfield + E_mesh``
289+
- About 40
290+
- Uses the mesh/SDF route with on-the-fly heightfield evaluation.
291+
* - Hydroelastic SDF--SDF
292+
- 240 by default
293+
- Geometry and buffer dependent
294+
- No fixed estimate
295+
- ``anchor_contact=True`` can add contacts beyond the reduced set.
296+
297+
The reduced maximum follows the current 240-slot contact-reduction layout.
298+
Disabling reduction exposes the geometry-dependent candidate bounds shown above.
299+
300+
**Common pair guidance**
301+
302+
.. list-table::
303+
:header-rows: 1
304+
:widths: 16 23 31 30
305+
306+
* - Pair
307+
- Expected behavior
308+
- Backend notes
309+
- Asset guidance
310+
* - Sphere--plane or sphere--box
311+
- A point contact.
312+
- Newton, MuJoCo Warp, and MuJoCo CPU use single-contact primitive paths.
313+
- Use one sphere unless the asset needs a finite support patch; then use
314+
multiple collision shapes or a surface-contact representation.
315+
* - Capsule--plane or capsule--box
316+
- End-on contact is point-like; side-on contact can span the capsule axis.
317+
- Newton and both MuJoCo backends have multi-contact paths for the
318+
line-like side contact.
319+
- A single capsule is normally sufficient. Use a compound only when the
320+
physical profile is not capsule-shaped.
321+
* - Box--plane or box--box
322+
- Face contact forms an area-supporting manifold; edge and corner contacts
323+
use fewer points.
324+
- Newton and both MuJoCo backends generate multi-point face contacts.
325+
- Prefer a single box for box-like parts; it is cheaper and usually more
326+
stable than a tessellated mesh.
327+
* - Cylinder--box
328+
- A cylinder lying across a broad box face should have a manifold spanning
329+
its support region.
330+
- Newton generates a convex manifold. MuJoCo CPU can generate a multi-point
331+
manifold with multi-CCD enabled. MuJoCo Warp currently emits one contact
332+
for this pair even with ``enable_multiccd=True``; contact location can
333+
alternate between the cylinder ends. This is a known discrepancy tracked
334+
in `mujoco_warp#1555
335+
<https://github.com/google-deepmind/mujoco_warp/issues/1555>`__.
336+
- Keep a single cylinder with Newton contacts. While the MuJoCo Warp issue
337+
is open, use ``use_mujoco_contacts=False`` or, if that is not possible,
338+
approximate load-bearing regions with multiple collision shapes.
339+
340+
The MuJoCo Warp cylinder--box behavior above is a known discrepancy, not the intended
341+
single-contact behavior of the geometry pair. For non-convex assets, use a
342+
convex compound or Newton's mesh/SDF paths rather than expecting one primitive
343+
to reproduce the surface. See :ref:`Mesh Collisions` and :ref:`Simulation Tuning`.
344+
146345
.. _Collision Pipeline:
147346

148347
Collision Pipeline

docs/solvers/mujoco.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ allows up to four contact points per geom pair instead of one. Pairs
495495
where either geom has non-zero MuJoCo ``geom_margin`` still fall back
496496
to a single contact regardless of the flag (see *Margin zeroing*
497497
below for how Newton's :attr:`~newton.Model.shape_margin` is forwarded
498-
to it).
498+
to it). MuJoCo Warp currently remains single-contact for cylinder--box;
499+
see :ref:`Geometry Pair Contact Behavior`.
499500

500501
**Margin zeroing.** ``mujoco_warp`` rejects non-zero geom margins on
501502
box-box pairs (its default NATIVECCD path) and on any box/mesh pair

0 commit comments

Comments
 (0)