Commit Graph

5215 Commits

Author SHA1 Message Date
Yuval Tassa a3425c72a7 Ignore unsupported light types in the classic renderer.
The classic renderer supports only directional and spot lights, but initLights() set GL light colors for every scene light before dispatching on type, and the render passes enabled GL light slots without filtering. Since no position was ever set for unsupported types (mjLIGHT_POINT, mjLIGHT_IMAGE), OpenGL's default eye-space position turned them into phantom headlights with the model light's diffuse color, washing out the scene. A cast-shadow image light additionally triggered a full shadow pass with an unset light projection.

Filter all light setup and enable sites on a shared type predicate, so unsupported light types contribute nothing. The no-lights ambient fallback now applies when no supported lights are present.

PiperOrigin-RevId: 956696548
Change-Id: Ic29763df7f9330f21d94f14501ae2559fd460f2b
2026-07-30 13:13:42 -07:00
Taylor Howell b46d76683d Import Warp v1.15.0
PiperOrigin-RevId: 956678131
Change-Id: I09a672b7335a85a17c95773ffc29eb9272744986
2026-07-30 12:39:05 -07:00
Yuval Tassa 98ecadcdf2 Add reset buttons to Studio sliders.
Slider rows in the joints and controls tabs could only be reset through
a hidden right-click context menu. Replace it with a visible reset
button at the right edge of each row, disabled while the value is at
its reset target so the button column doubles as a modified indicator.
Rows split the remaining width equally between slider and label, and
labels clip at the button column. Adds an ImGui_ResetButton widget.

PiperOrigin-RevId: 956627705
Change-Id: I9c178f6cd1cc806c7ffd6f531acf7f2d470d9346
2026-07-30 11:10:26 -07:00
Haroon Qureshi e662350357 Simple window class for python.
PiperOrigin-RevId: 956544312
Change-Id: I52d0e2f555592bed3889f05a1406e7633eb6d468
2026-07-30 08:39:09 -07:00
Haroon Qureshi 58a54ef474 Move resource provider registration into a separate library.
PiperOrigin-RevId: 956506812
Change-Id: I9acde018e282171f41e0f8c756cd02b39c35dc67
2026-07-30 07:19:08 -07:00
Yuval Tassa 6c86e12567 Make the selection outline occlusion-aware in the filament renderer.
PiperOrigin-RevId: 956489408
Change-Id: I948493587eb154cac6e0fc31d5df987967405ff8
2026-07-30 06:38:18 -07:00
Yuval Tassa 60889f5e85 Add favicon to MuJoCo Live.
PiperOrigin-RevId: 956476524
Change-Id: I3f33cd09764e1236999b7d269045a2f8c2a8236e
2026-07-30 06:09:12 -07:00
Taylor Howell 82471cbdfb MuJoCo Warp documentation: Large scenes initialize trees asleep
![docs](https://screenshot-v2.corp.google.com/image/222i7rtheo5eg.png)

PiperOrigin-RevId: 956462670
Change-Id: I0c6f211126e5d86bfacebff49591c17cb503b062
2026-07-30 05:34:13 -07:00
Matija Kecman c2e95b4161 Add StatePayload and serialization helpers for web viewer
PiperOrigin-RevId: 956400340
Change-Id: Ibe049afe10eca85e5fb6d718a78863a641b864bb
2026-07-30 03:01:23 -07:00
Taylor Howell 6a7a723093 MuJoCo Warp documentation: Per-world assets
PiperOrigin-RevId: 956399999
Change-Id: I8d951e5e52e16442325c66cc33ac693bf68939e3
2026-07-30 03:00:29 -07:00
Yuval Tassa fba29294d3 Update lighting and visual settings in the fridge door model.
PiperOrigin-RevId: 955888127
Change-Id: I1af5a2d4cf2a6fb3325b04b4cb6fd4cceeb92d60
2026-07-29 08:08:46 -07:00
Yuval Tassa 6a4a289c3e Open macOS file dialogs in the directory of the seeded path.
OpenFileDialog and SaveFileDialog hardcoded the user's Documents directory
and placed the full seed path in the name field. Studio seeds dialogs with
the current model's path, so File > Open now starts in the model's
directory with the filename pre-filled, falling back to Documents when no
path is available. Also avoids passing a potentially non-NUL-terminated
string_view to stringWithUTF8String.

PiperOrigin-RevId: 955869713
Change-Id: I7563f2cb2e39089883d5e37a3d259055c26e146c
2026-07-29 07:25:15 -07:00
Yuval Tassa 5800dfc929 Improve Studio help window with fixes, completions, and task grouping.
Fix, complete, and group Studio's help window by task.

PiperOrigin-RevId: 955869367
Change-Id: I5ae7b3661dd80a1273d8c9fecee303c361c102c3
2026-07-29 07:24:11 -07:00
Michael Moss 22f4a286f3 Update deprecated node 20 to node 24.
PiperOrigin-RevId: 955851551
Change-Id: I03dcfaa29e39c6b0b685982d3a12c4da82adf1ba
2026-07-29 06:42:30 -07:00
Michael Moss 559c2af751 Update MuJoCo Studio icons to have less padding.
PiperOrigin-RevId: 955416676
Change-Id: Ieb13b3ed37f5495a647a6ff58099150a79ba02ee
2026-07-28 12:53:25 -07:00
Copybara-Service d400914e97 Merge pull request #3437 from smallquail:flex-rotation-fix
PiperOrigin-RevId: 955127380
Change-Id: Ie31ab56f7d64dd1a2266828c0fcd3683b55768a5
2026-07-28 02:17:23 -07:00
Alessio d895888da4 Use the inlined mji_ 3x3 helpers throughout engine_derivative.c
Convert the four remaining mju_mulMat{,T}{Vec,Mat}3 call sites in this
file to their inlined mji_ equivalents, so the file is consistent after
the review change to the stretch paths. Aliasing is unaffected: the
inlined variants mark the result restrict, and every call already
required a distinct result (the public versions overwrite res while
reading vec).
2026-07-28 09:14:26 +01:00
Alessio a6743d8e0d Address review: blank line, and use the inlined mji_ 3x3 helpers
Per review on #3437: add the missing blank line above the new comment
block, and use the internal inlined mji_mulMat{,T}{Vec,Mat}3 helpers
rather than the public mju_ ones, matching fe9dc584. Six call sites in
the two stretch paths; pre-existing mju_ calls elsewhere in the file are
left alone.
2026-07-28 09:09:38 +01:00
Michael Moss 1db801460b Update MuJoCo version to 3.11.1 following the 3.11.0 release
PiperOrigin-RevId: 954833728
Change-Id: I1c006cdd72072c6821d7b3c28d8ac320de19b8c5
2026-07-27 14:35:26 -07:00
Michael Moss b85fdca54f Update changelog for the 3.11.0 release.
PiperOrigin-RevId: 954795939
Change-Id: I357468dd9072a5d1bab5af2529039e4924db12ed
2026-07-27 13:22:37 -07:00
Matija Kecman ca5337161d Export netimgui files in MuJoCo Copybara configuration for use with the upcoming Web Viewer
PiperOrigin-RevId: 954769526
Change-Id: I4cdee083082f7d55c2babd5e664ec0283a2aaf63
2026-07-27 12:33:41 -07:00
Alessio 55b43414dd Fix stretch stiffness basis for flexes in rotated parent bodies
The implicit effective metric assembles the stretch stiffness from
world-space edge vectors, but a flex vertex body's slide dofs are
expressed in its parent body's frame. When that frame is rotated the
assembled operator is therefore not the Jacobian of the passive stretch
force, which mj_flexPassiveStretch already maps into the dof frame with
xmat^T. The metric is then inconsistent with the force it linearizes:
implicit integration loses its stability guarantee, and models that the
same flex handles comfortably in an unrotated frame diverge.

Apply the matching change of basis in both places that build or apply the
stretch stiffness: mjd_flexStretch_mul rotates the input dof vector into
world and the scattered result back, and mjd_flexStiff_assemble sandwiches
each 3x3 block as R_bi^T * blk * R_bj. Both are no-ops when the parent is
unrotated. Bending needs no change: its blocks are isotropic, and
R^T (q I) R = q I.

This completes the fix in fe9dc584, which covered the passive force paths
and the interp (trilinear) derivative but not the standard stretch one.

On a mesh flex inside a body with a 90-degree rotation, the metric's
directional agreement with the force Jacobian goes from cos = 0.57 to
cos = 1.0, and a hanging sheet that previously reached 176% strain
settles at 0.87%.
2026-07-27 20:08:31 +01:00
Yuval Tassa c7b6e0b8dd Fix the array size of biasprm in mjsActuator specification.
Note mjNBIAS == mjNGAIN, this change is a no-op.

PiperOrigin-RevId: 954712145
Change-Id: I096246e5d060596c4025ea4c23e8e9e887c8cd50
2026-07-27 10:45:29 -07:00
Matija Kecman e4d0a88ffd Refactor viewer loop and shutdown handling to support conditional rendering and clean exits.
This change introduces a get_frame method to the viewer protocol, replacing the previous is_running check. This allows the viewer loop to skip rendering and lifecycle events when no active frame is ready (for example, when no browser is connected to the web viewer).

Additionally, this change:
- Adds a shutdown hook to ViewerHandle to wait for the viewer to cleanly release resources before exiting.
- Implements an ExitEvent handler in the viewer protocol to stop the run loop.
- Adds an http_port configuration option for the web viewer.
- Prevents double-closing in the viewer.

PiperOrigin-RevId: 954603868
Change-Id: Iaba7d131dc94191de51150464514dd10fa7834b0
2026-07-27 06:55:17 -07:00
Matija Kecman e23b504201 Change how ImGui clip rect scaling and scissor computation works in imgui_bridge to fix flickering and clipping errors in the web viewer
Avoid mutating ImGui draw lists in place by scaling clip rects locally during scissor computation instead of calling ScaleClipRects. This prevents clip rects from growing exponentially on persistent draw lists, such as streamed remote UI. Additionally, clamp the scaled clip rects to the viewport boundaries to prevent Filament's scissor test from rejecting out-of-bounds rects, while avoiding resetting to full-window scissors which would disable clipping.

The draw geometry is now immutable in the Update function (ImGui texture state is still mutated).

PiperOrigin-RevId: 954277141
Change-Id: Ifdf6866bb4eabaca44b020ea40acc246428b4f0b
2026-07-26 13:35:03 -07:00
Copybara-Service 0ae308c50c Merge pull request #3421 from mmossg:fork_main
PiperOrigin-RevId: 953956612
Change-Id: Idf457a84f8541c5a51946c5e649b3aab441441fe
2026-07-25 14:42:28 -07:00
Michael Moss 59d84a714d Update dependencies ahead of the 3.11.0 release (retry).
Also updates MuJoCo files needed to address changes in Filament.
- "build with clang on windows" patch to sync context lines, remove some
  upstream conflicts, disable Clang thread-safety attribute errors, and
  allow running on MSYS2.
- Skip building Filament samples.
- Add missing <string_view> to material_manager.cc.
2026-07-24 15:27:31 +00:00
Michael Moss 28bea62d78 Fix git apply and re-enable cmake cache on Windows.
This forces git to treat the current directory as the git checkout to apply the
patch to, which avoids issues where a non-git checkout (e.g. from an unpacked
cached tarball) can cause git to find a higher-level git checkout and try to
apply the patches there, which then fails when the files to patch aren't found.

PiperOrigin-RevId: 953377327
Change-Id: I86f51d4e2823b64c825070139479089c7f30e53e
2026-07-24 08:21:48 -07:00
Sam Haves dd4d0585ee Fix missing timer end calls on early returns in collision and actuation
PiperOrigin-RevId: 953348565
Change-Id: I64b563e29b2d620df46d50d12dde9215885f41d6
2026-07-24 07:05:45 -07:00
Matija Kecman 91d78346e1 Replace the Studio parser module with a pure Python implementation
PiperOrigin-RevId: 953181335
Change-Id: I1d2ce6f27f50aa4c30cce6d43caed80186ddef42
2026-07-23 23:52:56 -07:00
Michael Moss a9f56dabc2 Fix Windows CMake patch application and add more logging.
PiperOrigin-RevId: 953024686
Change-Id: I5527f52b7473e74a9203916d866a6a91c01a06c9
2026-07-23 16:44:24 -07:00
Alessio Quaglino fe9dc58477 Fix flexcomp instability when parent body has non-identity quaternion
Fast path in mj_flexPassiveInterp, mj_flexPassiveBendInterp, and
mj_flexPassiveStretch assumed body slide joints are world-aligned
(J = I). When parent body has a non-identity quaternion, joint axes
are rotated (J = R_body), causing wrong force mapping and instability
(NaN/Inf in QACC).

Fix: project world-frame forces onto body local frame via
mju_mulMatTVec3(R_body^T, force) before adding to qfrc_spring/damper.
Also fix the derivative paths:
- mjd_flexInterp_kernel fast path: R^T * K_rot * R * vec
- mjd_flexStiff_assemble (CSR): R_bi^T * K_rot_block * R_bj

The CSR-assembled stiffness matrix is the actual path used by the
implicit CG solver (mj_flexCG gate). The test uses solver="CG" to
activate this path; without it, flex stiffness is integrated
explicitly and no derivative fix can help.

Ported from GitHub PR https://github.com/google-deepmind/mujoco/pull/3379
Original author: Devansh (https://github.com/devansh0703)
Fixes https://github.com/google-deepmind/mujoco/issues/3364

PiperOrigin-RevId: 952789284
Change-Id: If924f7160dd16c0cc88170d80e6e605da0fe2e04
2026-07-23 09:02:21 -07:00
Michael Moss b04a18a00a Fix backslash escaping in KOKORO_GFILE_DIR on Windows.
This var was missing from the "clean up" step for all the path vars, causing
the cmake cache lookups to silently fail due to path mismatch.

PiperOrigin-RevId: 952410036
Change-Id: I5c542e821317497e899de95e5c62d76f88836e60
2026-07-22 16:59:14 -07:00
Copybara-Service c214e81627 Merge pull request #3418 from winklemad:fix/minimize-xtol-accepted-candidate
PiperOrigin-RevId: 952380184
Change-Id: Ied4ab1bfc91dbb55dbd9d2f2e64ab2288513c50e
2026-07-22 15:57:46 -07:00
Michael Moss 3429373b96 Rollback filament dependency updates and patches.
PiperOrigin-RevId: 952196997
Change-Id: I0c4284823bb642e847bc73d4732bcce6a72455c8
2026-07-22 10:23:50 -07:00
Michael Moss c0d1c399af Update patch context in filament-allow-clang-windows.patch.
PiperOrigin-RevId: 952161543
Change-Id: Ia832f692f1f42e905a6cf66365731d5714297db9
2026-07-22 09:19:02 -07:00
Haroon Qureshi e1f6953efa Remove ModelObjects as a dependency on ModelDecorations.
Also allow users to Clear() the decorations explicitly.

PiperOrigin-RevId: 952152025
Change-Id: Ieb21d59986b127b4646c8c5721d33920d14dff85
2026-07-22 09:01:26 -07:00
Sam Haves 1a5af23558 Add <stem>/model.xml search path to mjz_decoder.
PiperOrigin-RevId: 952128127
Change-Id: I8a514297d84026a6028b2416e43df9b5a2a92bbb
2026-07-22 08:11:56 -07:00
Haroon Qureshi b6ab11dc6b Rename LightManager to ModelLights and RenderableManager to ModelRenderables.
This better reflects the purpose of these classes.

PiperOrigin-RevId: 952123609
Change-Id: Ib14c54c3d9b137258ebc706590aca3b2e80015fe
2026-07-22 08:03:32 -07:00
Michael Moss 8c0a73482c Remove unversioned tarball fallback from FindOrFetch.cmake.
PiperOrigin-RevId: 952098246
Change-Id: Id3030fde3045223857711b3e8cce7e671490f8c7
2026-07-22 07:08:04 -07:00
Haroon Qureshi ed7ba6027f Move SceneDecorator to support module.
Also rename it to ModelDecorations.

PiperOrigin-RevId: 952088857
Change-Id: I476d616ec950962f781614e39b75d3d59fdcfcd1
2026-07-22 06:48:33 -07:00
Haroon Qureshi ba9a65031b Allow mesh data to be reuploaded without having to recreate the mesh.
Splits mjrfMeshData into config+data parts.

PiperOrigin-RevId: 952042545
Change-Id: I19a572a0f591fa0d33bbc2c32b974efc075310f4
2026-07-22 04:56:30 -07:00
Google DeepMind d3166cb630 Fix cylinder bias stack overrun in XML parsing
PiperOrigin-RevId: 952016771
Change-Id: I49657d41ad96a6bd1f7f9d5e6b6491c5a229d244
2026-07-22 03:53:45 -07:00
Matija Kecman 0b1ed5b356 platform/ux: general C++ platform UX updates & spec adjustments.
* Enhances ImGui dialogs to support keyboard shortcuts (Enter/Escape) and filters.
* Adjusts GUI layouts for simulation speed and compiler settings.
* Exposes additional model fields in the XML spec generator.

PiperOrigin-RevId: 951988061
Change-Id: I4927c12a8882ba4e91e6098355ec2f5db35c2747
2026-07-22 02:46:30 -07:00
Michael Moss 782c00bc49 Update dependencies ahead of the 3.11.0 release.
PiperOrigin-RevId: 951974346
Change-Id: Ie2b7a357442705e7d37d824463f7feb120a212e7
2026-07-22 02:13:00 -07:00
Matija Kecman e0224c6440 studio: share ImGui and ImPlot contexts across python child extension modules.
Each pybind extension module holds its own copy of the ImGui/ImPlot globals (extension modules are loaded RTLD_LOCAL), so the viewer that owns the contexts must share the pointers explicitly. Without this, client plotting GUIs and user plotting scripts (e.g. the implot sample) crash on null context pointers.

PiperOrigin-RevId: 951917287
Change-Id: I639a173c2ae9f1af4feaf57aff7b5c81854b7393
2026-07-21 23:41:20 -07:00
winklemad 72c9f2af63 Fix least_squares xtol result 2026-07-22 08:17:25 +05:30
Copybara-Service 91bb075108 Merge pull request #3250 from gholmes829:fix/accumulate-inertia-com-frame-order
PiperOrigin-RevId: 951758696
Change-Id: I99f3502b15b84e2fffc58f4b608844148479ca3e
2026-07-21 16:21:08 -07:00
Yuval Tassa 2b30c6bc0f Update MuJoCo contributing guidelines regarding PR imports.
Updates CONTRIBUTING.md to suggest that contributors who do not require Git authorship attribution let maintainers know in the PR, which allows for faster direct incorporation of changes.

PiperOrigin-RevId: 951751097
Change-Id: I521f1ad1978987c71a90e85c1bed71392a07ee7b
2026-07-21 16:06:04 -07:00
Yuval Tassa a7e6114ed7 improve aspect ratios in embedded videos
PiperOrigin-RevId: 951714570
Change-Id: I71b3705d9bb7bceca7f9f7d69344acb4f8f91239
2026-07-21 14:57:26 -07:00