Commit Graph

4699 Commits

Author SHA1 Message Date
Haroon Qureshi 766f519576 Move some scene settings into render request struct.
Reflections, shadows, and post-processing can be specified per render
request rather than per scene.

PiperOrigin-RevId: 915910030
Change-Id: I8ce773b42870aa76a2d8219347ca1cafaec1a97b
2026-05-15 03:23:25 -07:00
Alessio Quaglino 0ad77f1ddf Optimize flexedge velocity computation.
Skip flexedge velocity calculation for rigid and interpolated flexes, as they are not used in those cases. The computation is now done per-flex, only for the edges within each non-rigid, non-interpolated flex.

PiperOrigin-RevId: 915907396
Change-Id: I0beb1f98f0115c83da13fed184e89101f57563ab
2026-05-15 03:16:09 -07:00
Alessio Quaglino 7ca1bc6a56 Precompute rotated stiffness matrix before CG in implicit flex integrator.
This gives a 3x speedup in implicitfast.

Also cleanup old code that was used in the dense factorization of the stiffness matrix before we switched to CG.

PiperOrigin-RevId: 915900315
Change-Id: Id6973c4bfd7d371a43ec6db982703969b23a3550
2026-05-15 02:58:06 -07:00
Haroon Qureshi 85bf2b9660 Move GetMaterialType into material module.
PiperOrigin-RevId: 915895534
Change-Id: Ic7e9d52374131aa93445f90cf2208f6c93d123f4
2026-05-15 02:45:31 -07:00
Taylor Howell 072125c49c MJX (impl='warp'): nconmax -> naconmax
PiperOrigin-RevId: 915407157
Change-Id: Ie43c06164d6d942c2a4bb60b3d09fcb5c4c87a35
2026-05-14 06:52:45 -07:00
Haroon Qureshi 9c372fbbea Minor cleanup to scene_geom_util.
PiperOrigin-RevId: 915367694
Change-Id: Ia20c3ba050d9f364da5c26f0812bf9a9c5763cd6
2026-05-14 04:54:28 -07:00
Haroon Qureshi c587cea0f7 Add flex to shapes test scene.
PiperOrigin-RevId: 915363027
Change-Id: Icb0bf26374396a3929eeec30807fcf78b683ee94
2026-05-14 04:40:06 -07:00
Saran Tunyasuvunakool e47809d50d Refactor MuJoCo Live to separate out HTML, CSS, and JS components.
PiperOrigin-RevId: 915340338
Change-Id: Ic62b9d640af9967a59a77fa59a3556b916d5a24c
2026-05-14 03:39:42 -07:00
Yuval Tassa c56d662d27 Update link to Newton physics engine in changelog.
PiperOrigin-RevId: 915262716
Change-Id: I801267e760b8b5eeb534f71b4789e5a7fb8c35b1
2026-05-14 00:01:06 -07:00
Saran Tunyasuvunakool f7e00d041e Add commit hash and remove "Upload File" button from MuJoCo Live.
PiperOrigin-RevId: 914909503
Change-Id: I084d888eb5093b4278e758697bff43ff941c79d0
2026-05-13 09:34:47 -07:00
Saran Tunyasuvunakool 9230b34fed Exclude CMake install steps for Emscripten.
Install steps aren't needed for WASM builds, and are causing issues with EXPORT relating to lodepng and miniz.

PiperOrigin-RevId: 914891405
Change-Id: If653fe7449b0166ad6762a3fad6b95e02f3532b1
2026-05-13 08:55:26 -07:00
Taylor Howell e1f5534b5f Fix tactile sensor body validation.
PiperOrigin-RevId: 914870657
Change-Id: I57565b4975e0cd7eb1b1ffa199e451a5c5bc0a6e
2026-05-13 08:11:36 -07:00
Yuval Tassa 17fbc0aeef Update colors and legend in margin/gap figure.
PiperOrigin-RevId: 914857514
Change-Id: Ida36393bd4cd706bf81b8b7000ddd34f088fc936
2026-05-13 07:43:41 -07:00
Alessio Quaglino 955ae3f3c0 Fix sign error in flex interp implicit integration.
The flex interp stiffness matrix is Negative Semi-Definite (NSD). When forming the RHS for implicit integration, the term involving the velocity and stiffness should be added, not subtracted. A new test is added to ensure energy stability for flex interp stretch stiffness with the implicitfast integrator.

PiperOrigin-RevId: 914845245
Change-Id: Iaaf0914909128e64e195f17cc5f2f344a8a43bc2
2026-05-13 07:15:20 -07:00
Haroon Qureshi 69a1087e9e Disable window resizing on load as it breaks on some platforms.
PiperOrigin-RevId: 914774489
Change-Id: I9aea71b386de93f4d2fc3da5310dd7a3018c8c1c
2026-05-13 03:59:46 -07:00
Alessio Quaglino 35cdc779e6 Add implicit bending stiffness for standard flex.
Standard flex (flex_interp=0) with thin-plate bending treated bending forces purely explicitly. This caused contact-induced vertex vibrations and non-physical energy injection for flat resting sheets, because the solver treated each vertex as an independent mass during contact and contact normals are orthogonal to stretch constraints.

Fix: extend the existing preconditioned CG solver to include the constant bending stiffness K_bend in the implicit operator via matrix-free mat-vec.
PiperOrigin-RevId: 914774020
Change-Id: I45e0d6749abb6f873566203bccae956514b2576b
2026-05-13 03:58:16 -07:00
Yuval Tassa 7bfdbad80b Make PGS solver constraint visitation order time-independent.
PiperOrigin-RevId: 914741347
Change-Id: I7889a42543e9a9f3ff883e25ee9eafaceedc29e1
2026-05-13 02:34:30 -07:00
Saran Tunyasuvunakool 99e626096f Fix miniz include.
PiperOrigin-RevId: 914519929
Change-Id: I0dc00ef3f4518571165e4be0e85016511e0cdd60
2026-05-12 15:51:27 -07:00
Yuval Tassa a4e49f2dff Margin and gap redesign (breaking change)
PiperOrigin-RevId: 914329812
Change-Id: I905665e4c1965bdb8b90587e5b1277cfbfe5cce0
2026-05-12 09:43:43 -07:00
Saran Tunyasuvunakool 7f5be412a0 Put miniz in MujocoDependencies.cmake.
PiperOrigin-RevId: 914322421
Change-Id: I3f6e821164eede979802c51a6f8ee00d3346d585
2026-05-12 09:27:00 -07:00
Haroon Qureshi 58abf3d4ae Fix dependency between FilamentContext and SceneView.
Removes the DoRender and DoReadPixels functions which allowed
FilamentContext to "call" SceneView functions even though
SceneView depended on FilamentContext.

Adds a mjrf_setClearColor function so that we no longer rely
on SceneView setting the clear color.

PiperOrigin-RevId: 914253362
Change-Id: I33c1cc9dfc7cb2f4c3cc855a600cccb0c54ae31c
2026-05-12 06:37:51 -07:00
Haroon Qureshi 3f3ff85a59 Enable backface culling by default.
Disable only for geom types that need it (planes and triangles).

PiperOrigin-RevId: 914211570
Change-Id: Id95e32924122789111f561d922110128b3f56c77
2026-05-12 04:41:10 -07:00
Haroon Qureshi 5339d9154e Ensure faces for meshes are correctly oriented.
This is in preparation for a future CL that will disable backface culling.

PiperOrigin-RevId: 914136370
Change-Id: Ie8db1268faaa306c3f3356efc5e1305d791cf525
2026-05-12 01:27:31 -07:00
Alessio Quaglino f9f1db1e0a Replace the banded Cholesky solver for implicit flex interpolation
with a preconditioned Conjugate Gradient (CG) solver that operates
on the full system matrix.

The previous approach extracted flex DOFs into a reduced banded system,
factored it separately, and overwrote the global solve. This required
precomputed bandwidth (makeFlexBandwidth), parent-joint detection,
coupling corrections, and a FlexInterpContext struct — and only worked
for standalone flex trees without parent joints.

The new CG solver uses the already-factored global system (M - h*qDeriv)
as a preconditioner and adds the flex stiffness contribution via
matrix-free products (mjd_flexInterp_mulKD/mulK). This handles any
kinematic configuration — including flexes attached to articulated
chains or with parent joints — without sparsity pattern restrictions.

Before (`bunny_multicell`):
```
 Simulation time      : 50.80 s
 Steps per second     : 197
 Realtime factor      : 0.20 x
 Time per step        : 5080.3 µs

 CG iters / step      : 3.16
 Contacts / step      : 31.04
 Constraints / step   : 124.15
 Degrees of freedom   : 178
 Dynamic memory usage : 0.4% of 100M
```

After:
```
 Simulation time      : 9.52 s
 Steps per second     : 1051
 Realtime factor      : 1.05 x
 Time per step        : 951.7 µs

 CG iters / step      : 3.21
 Contacts / step      : 30.90
 Constraints / step   : 123.61
 Degrees of freedom   : 178
 Dynamic memory usage : 0.3% of 100M
```

PiperOrigin-RevId: 913758038
Change-Id: If5aa617b2d535c86aec9bd71c9e0003a2b38bdd7
2026-05-11 10:11:51 -07:00
Haroon Qureshi 5d818306ef Save/restore window size in UX settings.
PiperOrigin-RevId: 913695007
Change-Id: I3366b11a5de53292d4ffe0e4c46f866381624788
2026-05-11 07:44:09 -07:00
Haroon Qureshi 465e574c42 Test scene for shape generators.
PiperOrigin-RevId: 913694536
Change-Id: I49a2a3a4f918f9b80650ce884d3d442581e60d6b
2026-05-11 07:42:56 -07:00
Yuval Tassa ff4a5673f8 Delete testspeed_test.sh
This shell test was extremely slow (taking up to 26 minutes under ASAN). In any case the compilation pipeline takes one kick-the-tires step, so the RecompileCompare test effectively does the same thing.

PiperOrigin-RevId: 913646840
Change-Id: If659705b88d0ac64722f88ddf2ae377932e5ef0f
2026-05-11 05:25:59 -07:00
Copybara-Service 044f294c7c Merge pull request #3243 from thowell:readthedocs
PiperOrigin-RevId: 913616905
Change-Id: I41452fc8823b96c8d15b8909b17fb13e69bf1f15
2026-05-11 03:54:33 -07:00
Michael Moss 28548ce51c Update MuJoCo version to 3.9.0 following the 3.8.1 release
PiperOrigin-RevId: 913596257
Change-Id: Ib8b27fd2224e38560a209054c1d508a9bba21bbf
2026-05-11 02:58:56 -07:00
Alessio Quaglino df59e7d0f1 Fix mj_makeConstraint error for flex trilinear vs trilinear contacts.
The coordinates for flex interpolation are now computed using the absolute values of the vertex weights. The sign of the first vertex weight is then applied to the resulting barycentric weights. This correctly handles cases where the flex is both the first and the second entity in the contact pair.

PiperOrigin-RevId: 913590928
Change-Id: I970b35fba3d209e13b5b33bb5f945e3c6a43d487
2026-05-11 02:45:27 -07:00
Michael Moss 688209574d Update changelog for the 3.8.1 release.
PiperOrigin-RevId: 913578392
Change-Id: I7367ff9044fd52039cec8dd492b37df2153a6d7f
2026-05-11 02:14:58 -07:00
Alessio Quaglino 5ee8bd7b9c Rotate undeformed normals before using them in the bending passive forces.
The normal jump residual in flex elasticity calculations now rotates the rest-frame normal jump into the current frame using the face's corotational quaternion before subtracting the jump from the current normal difference.

PiperOrigin-RevId: 913242127
Change-Id: Ia62b28ecccd59e79225737d8225ef4131b333c96
2026-05-10 03:00:11 -07:00
Michael Moss cb5a9caa5c Update dependencies ahead of the 3.8.1 release.
PiperOrigin-RevId: 913212199
Change-Id: I97e5a2367010c492e6277a8c333ae8eb8155f7f2
2026-05-10 00:51:43 -07:00
Haroon Qureshi 4e2064b26f Fix skin/flex rendering by setting size to 1 (not 0).
PiperOrigin-RevId: 912993245
Change-Id: Ib81f58bd8d474decea469cafa40d57f053eee516
2026-05-09 08:39:14 -07:00
Haroon Qureshi b9a1fad99b Fix segmentation/depth rendering.
PiperOrigin-RevId: 912674769
Change-Id: Iba525679630e7996bc27d916e61e5a265a147061
2026-05-08 13:40:37 -07:00
Taylor Howell fefbc2c407 mujoco introspect 2026-05-08 20:23:30 +01:00
Alessio Quaglino fa912dffa0 Add flex arrays to CompareModel check.
Due to a bug, all flex mjModel fields were previously ignored.

PiperOrigin-RevId: 912546202
Change-Id: Ica95ecfcbbe366fd81de6e8f7d83ed57a7d23033
2026-05-08 08:47:51 -07:00
Alessio Quaglino 8cef5bb978 Add configurable octree max depth for meshes.
The maximum depth of the octree used for SDF generation can now be specified in the mesh definition via `mjsMesh::octree_maxdepth`. The default value is 6.

PiperOrigin-RevId: 912494999
Change-Id: I6d828d1d3999b99d1210a6829a05b04fac591e1f
2026-05-08 06:35:45 -07:00
Yuval Tassa 531a571dda studio: replace separate Solver and Performance charts with a unified Profiler, bound to F3
Combines the "Solver" and "Performance" chart windows into a single "Profiler" window for better ergonomics and visual layout:
- Unified Dashboard: Groups the Solver block (Counts & Convergence) and the Performance block (Dimensions & CPU Time) in a single viewable window that scales cleanly without vertical scrollbars.
- Adaptive Stacking: Uses ImGui grouping so each block internally stacks its charts vertically, but tiles side-by-side horizontally when the window is stretched wide.
- Default Docking & Width: Integrates the Profiler into the default dockspace layout attached to the right of the main viewable area, with an optimized initial width scaling factor of 0.42.
- Shortcut and Menus: Adds a toggle shortcut bound to `F3`, updates the Help Shortcuts overlay, and replaces old separate entries in the Charts menu.

PiperOrigin-RevId: 912491435
Change-Id: I1f9215e5498866a01ce48b6aeb4a7461191fa01d
2026-05-08 06:25:31 -07:00
Haroon Qureshi 395a002801 Small usability fixes.
- allow reloading of files that failed to load
- clear errors on successful reload

PiperOrigin-RevId: 912458744
Change-Id: Ie6af87508f10e83461bc998c99c9c66e2d58312e
2026-05-08 04:50:13 -07:00
Yuval Tassa 2ad01960c6 Studio UI tweaks
- RHS: Make Inspector be focused by default.
- RHS: Remove Noise pane, put the functionality in the Controls pane.
- Improve Frame and Label dropdowns.

PiperOrigin-RevId: 912434712
Change-Id: I2ee5b647febfc4a90a0cf9387b1d416f5a0dd4a1
2026-05-08 03:33:16 -07:00
Michael Moss 3ef083eecc Allow the Studio build script to be run outside the git checkout.
PiperOrigin-RevId: 912421771
Change-Id: Ie355d2f59cd43166ab06aa49349d87a0f5f9151c
2026-05-08 02:51:53 -07:00
Sam Haves b7b96d2acc Remove explicit mjz linking from studio.
PiperOrigin-RevId: 912157162
Change-Id: Ie5a229836cfe2c4af1b2f3cc9de9f03623b5d815
2026-05-07 14:35:18 -07:00
Sam Haves f4ab9aa93d Make miniz a PRIVATE dependency of mujoco in CMake.
PiperOrigin-RevId: 912068267
Change-Id: I5d4f3bbd294c6d4fcc519ae4f36f13005d51f9b7
2026-05-07 11:33:18 -07:00
Sam Haves 3e960ba3d3 Fix mjcPhysics doc link in changelog.
PiperOrigin-RevId: 912053636
Change-Id: Ie711995e171ae9dc97766a82902ba6917b08cd79
2026-05-07 11:07:04 -07:00
Sam Haves eddfbcfc50 Move mjz_decoder out of experimental to xml/mjz.
Since the mjz format is just an archive for MJCF assets this seems like a sensible place. The upcoming mjz encoder will also need to make use of the full precision XML utility that is local to src/xml.

PiperOrigin-RevId: 912044746
Change-Id: I6a9fef24b1c3fec5b5edc3a8d4c8e22584273264
2026-05-07 10:52:03 -07:00
Haroon Qureshi 5f36cb9e64 Add/cleanup documentation.
PiperOrigin-RevId: 912014433
Change-Id: I8f05d482e07ed58588f5847d470e5420e5c09f3a
2026-05-07 09:52:04 -07:00
Haroon Qureshi 730ecceda1 Add SDF support.
PiperOrigin-RevId: 912007379
Change-Id: I89ebf6bbabca08656932d028b27f1fbe48178986
2026-05-07 09:37:18 -07:00
Haroon Qureshi abea65b0be Simplify materials.
Merge shading model, material params, and material textures into a
single "mjrMaterial" type.

Remove redundant decor_line material.

PiperOrigin-RevId: 911960222
Change-Id: Icce3772a8ea48467dfd610799c0c2f2ba752323e
2026-05-07 07:51:15 -07:00
Haroon Qureshi d5c5a989f2 Use viewport instead of width/height.
PiperOrigin-RevId: 911942457
Change-Id: I2d6d52a8bb6b1b10d69956cce9e5d7f62e7d1f1c
2026-05-07 07:06:35 -07:00