[FEATURE] Decouple FEM render geometry from simulation geometry. - #3079
[FEATURE] Decouple FEM render geometry from simulation geometry.#3079duburcqa wants to merge 1 commit into
Conversation
FEM entities expose their morph sub-meshes as visual geoms (FEMVisGeom), each pairing a render mesh carrying its own surface and UVs with the map from its vertices to the simulated vertices. The simulation operates on a single welded copy of the sub-mesh vertices, tetrahedralized for volumetric materials, while the rasterizer and raytracer draw the authored surfaces and update them per visual geom. The FEM solver drops its render-only topology and UV fields, and the normal render pass gains double-sided support shared between offscreen and viewer renders. Co-authored-by: Zhehuan Chen <acmlczh@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d880b403d3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| def _update_stress_noop(self, mu, lam, J, F, actu, m_dir): | ||
| raise NotImplementedError | ||
| return qd.Matrix.zero(gs.qd_float, 3, 3) |
There was a problem hiding this comment.
Guard cloth no-op stress outside IPC
When a FEM.Cloth entity is stepped in the default Scene configuration, the coupler is LegacyCouplerOptions, so FEMSolver.substep_pre_coupling() still runs compute_vel() over self.n_elements. Cloth is added only through _kernel_add_cloth(), which does not initialize elements_i.mass_scaled/tet data, and returning a zero stress here lets compute_vel() continue to dv = ... / mass_scaled with the default zero mass, producing NaNs instead of a clear unsupported-configuration failure. This only affects Cloth or other no-op FEM materials outside IPCCoupler; reject that setup before stepping or initialize/skip those elements rather than registering a zero-stress FEM material.
Useful? React with 👍 / 👎.
|
Closing in favor of #2904, which keeps the original authorship: the consolidated changes are convention and API-surface alignment on top of an unchanged design. Both branches carry the same tree. |
Description
FEM entities now expose their morph sub-meshes as visual geoms (
fem_entity.vgeoms, mirroring the rigid entity API): eachFEMVisGeompairs a render mesh carrying its own surface and UVs with the map from its vertices to the simulated vertices. The rasterizer and raytracer draw the authored input surface per visual geom and update its vertices from the simulation state through that map, while the FEM solver drops its render-only topology and UV fields. Sub-meshes are welded into a single simulation mesh before tetrahedralization, which now runs before the morph position is applied so the tetrahedralization and its on-disk cache are shared across placements of the same geometry. The normal render pass supports double-sided primitives in both offscreen and interactive viewer renders through a shared shader cache keyed on the primitive defines.Related Issue
Supersedes #2904.
Motivation and Context
Multi-material assets lost their appearance when simulated as FEM entities: rendering used the tetrahedral boundary with a single entity-wide surface and zero-padded UVs. Decoupling render geometry from simulation geometry preserves the authored look (per-sub-mesh materials, textures, UVs) and enables sub-mesh level segmentation for FEM entities.
How Has This Been / Can This Be Tested?
tests/deformable/test_fem.py: the newtest_multi_submesh_render_decouplingasserts exact per-vertex tracking between visual geoms and simulated vertices on a two-material GLB;test_interior_tetrahedralized_vertexchecks the same invariant on a tetrahedralized box. The full file passes, including the implicit falling sphere/box rest-state checks.tests/rendering/test_offscreen.py: the newtest_multi_submesh_fem_rendersnapshot test covers rgb/depth/segmentation/normal on the rasterizer and rgb on the raytracer;test_segmentation_mapcovers the per-sub-mesh segmentation keys at "geom" level.Genesis-Intelligence/snapshotsupdated to revision11a81c48367a18aedf0a3bed460b69c7ba7ccd4e(5 new PNGs), pinned intests/utils.py.Screenshots (if appropriate):
Pair 1 - Ducks (Left Rigid, Right FEM)
Pair 2 - Multi-sub-mesh FEM rendering (trashbag_rope.glb)
Checklist:
Submitting Code Changessection of CONTRIBUTING document.