Skip to content

add vcpkg.json - #1

Open
MuGdxy wants to merge 2 commits into
KemengHuang:main-oldfrom
MuGdxy:main
Open

add vcpkg.json#1
MuGdxy wants to merge 2 commits into
KemengHuang:main-oldfrom
MuGdxy:main

Conversation

@MuGdxy

@MuGdxy MuGdxy commented Nov 18, 2025

Copy link
Copy Markdown

Add vcpkg.json, users don't need to manually call vcpkg install xxx

haoxiangNtu added a commit to haoxiangNtu/Stiff-GIPC that referenced this pull request May 6, 2026
…hybrid)

Two related patches for collision-detection performance when many ABD bodies
have all collisions excluded (e.g., non-gripper arm parts vs cloth):

KemengHuang#2: per-body isolation flag via collision_skip_matrix diagonal
  - sim_engine: detect bodies with ground_skip AND all-other-bodies-excluded;
    set collision_skip_matrix[i][i]=1 as a "fully isolated" marker.
  - mlbvh kernels: at leaf-bbox build, isolated body's faces/edges get an
    empty bbox -> BVH overlap test always false -> traversal naturally prunes
    the entire isolated subtree. Self-query kernels also early-return at
    thread entry on the same flag.

#3: indirect BVH input filter (active-subset Construct + adjusted self-query)
  - mlbvh: new _calcLeafBvs_indirect / _calcLeafBvs_ccd_indirect kernels
    write only n_active leaves; lbvh_f/_e Construct + ConstructFullCCD take
    the indirect path when _active_idx is set.
  - lbvh_e EE-self-query (which uses idx + N - 1 to locate self leaf) must
    use n_active as launch count, not edge_number -- otherwise threads read
    leaves at the default-path offset where indirect BVH didn't write.
  - sim_engine: build active face/edge index lists (drop primitives whose
    every vertex belongs to an isolated body), upload, hand off to bvh_f/_e.
  - Wiring deferred until after ipc.init() so bboxDiagSize2/dHat capture the
    full-scene BVH; second buildBVH() then transitions BVH state to indirect
    before buildCP runs.

Measured on case_27 mobile s1_hybrid (semi-implicit, dt=0.020, 33/42 bodies
fully isolated, 5 paired runs each, std<1.1ms):
  baseline (no exclusion API call):   368 ms median
  +KemengHuang#1 only (exclusion matrix used):   369 ms (no traversal effect, expected)
  +KemengHuang#2 (diag iso + empty bbox):         44 ms (8.45x, 5/5 runs +88%)
  +KemengHuang#2+#3 (indirect BVH):               41 ms (1.07x more, 5/5 runs +3-9%)
  --------------------------------------------
  total:                                9.02x median

Toggles for safe rollback:
  BVHSKIP2=0  disable KemengHuang#2 (auto-disables #3)
  BVHSKIP3=0  disable #3 only
  default: both enabled

Affects only the isolated-body fast path; case_26 (no exclusion calls) shows
no measurable change (regression-tested 1091 frames, no INTERSECT).

Bench reproducer in examples/bench_s1_hybrid.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
haoxiangNtu added a commit to haoxiangNtu/Stiff-GIPC that referenced this pull request May 6, 2026
…trix

FEM body vertices carry body_id == -1 in _bodyID by legacy semantic of
tetrahedra_obj::begin_load_body. As a result, when the user calls
add_collision_exclusion(abd_body, fem_global_id), the exclusion was
silently ignored everywhere a kernel called _is_collision_excluded:
  - bodyA == -1 || bodyB == -1 -> early return false -> not excluded.

This silent failure was masked in baseline because IPC barrier still
recorded the contact pair from BVH detection -> no penetration occurred,
and the user's exclusion declaration never had a visible effect.

Once BVH-skip KemengHuang#2 (collision_skip_matrix diagonal isolation) takes the
declaration at face value and removes the body's leaves from BVH,
the contact pair stops being recorded, and:
  - IPC barrier no longer pushes the bodies apart -> penetration
  - _edgeTriIntersectionQuery (sanity check) sees the actual geometric
    crossing, prints [INTERSECT-L] and forces line search to backtrack
    repeatedly -> simulation stalls.

Map FEM body id -1 to the last matrix row (matrix slot N-1) so the
exclusion declaration is honored uniformly by:
  - _selfQuery_vf / _selfQuery_ee narrow-phase filters
  - _edgeTriIntersectionQuery sanity check
  - any other consumer of _is_collision_excluded

Caveat: assumes a single FEM body. Multiple FEM bodies will share slot
N-1 and exclusions cannot distinguish them.

This also changes the semantics of KemengHuang#1 (collision matrix alone, no KemengHuang#2/#3):
exclusion declarations now actually filter contact pairs. Bench:
case_27 hybrid KemengHuang#1-only (no KemengHuang#2/#3) goes 369ms -> ~365ms (1% noise) since
the dropped pairs are a tiny fraction of total IPC work; the saving
is essentially zero relative to BVH traversal cost.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant