Commit Graph

4397 Commits

Author SHA1 Message Date
Haroon Qureshi 02b0b40b1c Add reflective materials.
A future CL will implement reflective surfaces and make use of these materials.

PiperOrigin-RevId: 889200524
Change-Id: Icbe5c0c390f89789ed0f5d5c6058a2ef31105608
2026-03-25 06:10:59 -07:00
Haroon Qureshi c61d239ac6 Use model name for window title.
PiperOrigin-RevId: 889193934
Change-Id: Ief9ade9e239c14da1d824d9bc8aa95dc0a71b65f
2026-03-25 05:53:47 -07:00
Haroon Qureshi 4df2fc2490 Ensure decoder has an error string.
We use that error buffer to check for errors.

PiperOrigin-RevId: 889193796
Change-Id: I1f7575321a57301b4ae5002d0c488bbb16a30b26
2026-03-25 05:52:46 -07:00
Sam Haves f5d3ce3451 Introduce mjpEncoder plugin architecture
Add a new mjpEncoder plugin type mirroring the existing mjpDecoder pattern.
Encoders serialize an mjSpec + mjModel to an mjResource for a given format.

New API functions:
- mjp_registerEncoder: globally register an encoder
- mjp_defaultEncoder: zero-initialize an encoder struct
- mjp_findEncoder: look up an encoder by filename extension or content type

The mjfEncode callback takes (mjSpec*, mjModel*, mjVFS*, mjResource*) and
returns 0 on success. Writing to mjResource keeps symmetry with the decoder
reading from mjResource and leaves the door open for writable resource providers.

PiperOrigin-RevId: 889187898
Change-Id: I180771b2255b91dea188ac5e2cdc3a8f0fb85364
2026-03-25 05:35:39 -07:00
Alessio Quaglino 2d33b50243 Parallelize tactile sensor computation.
The computation of tactile sensor values for each taxel is now parallelized using the MuJoCo threadpool when the number of taxels exceeds a threshold. Each thread processes a batch of taxels, accumulating forces from all colliding geoms.

PiperOrigin-RevId: 888606457
Change-Id: I98abf3e98a7318fc14080054bea7093ab46e8b8b
2026-03-24 05:21:08 -07:00
Alessio Quaglino f4e3469239 Add test for geom and mesh plugin attributes.
This test verifies that geom.plugin and mesh.plugin are accessible and can be assigned a plugin instance.

PiperOrigin-RevId: 888576511
Change-Id: Id17885de5fdf1f4543ac195a8b04bb01139d1bfa
2026-03-24 03:59:35 -07:00
Kyle Bayes 5c0de1f84d Remove model and data from ccd object. Each geom gets a copy of pos and mat, which is editable without modifying mjData.
PiperOrigin-RevId: 888028695
Change-Id: Ic9bbea4bcd7c2dbe62326798eab73d14da0aaa13
2026-03-23 04:51:53 -07:00
Haroon Qureshi babcfd6575 Add class to manage resources for a RenderTarget.
PiperOrigin-RevId: 888016283
Change-Id: I4959e63e95fad4f75a7a04fabf0879f0b9238f9f
2026-03-23 04:17:53 -07:00
Michael Moss 5664b9e89e Update pybind to 3.0.2.
PiperOrigin-RevId: 887980078
Change-Id: I2eb5284e878180293553e20c94dae853c380805c
2026-03-23 02:44:19 -07:00
Yuval Tassa 4b1667e4ce Fix documentation links
PiperOrigin-RevId: 886920783
Change-Id: Ie1ab433aeaaa668a103a684cbb30ef5375c6211b
2026-03-20 12:26:56 -07:00
Yuval Tassa 510d75f4cf Allow actuators to add damping and armature to joint and tendon transmissions.
PiperOrigin-RevId: 886899849
Change-Id: I02200ee0d4f7c96096d8188b95f823b566562a30
2026-03-20 11:41:15 -07:00
Copybara-Service f7bd6d15f7 Merge pull request #3164 from Balint-H:unity/passive-resubmit
PiperOrigin-RevId: 886821338
Change-Id: I2b733732fcc17223aad4299713f5528b597f03e8
2026-03-20 09:05:07 -07:00
Yuval Tassa c348bc9f4c Disable clang-format for MuJoCo public headers and engine source.
PiperOrigin-RevId: 886720463
Change-Id: I7c89fa99bee0598dcf48807bfbd61ee8bf8fa9b8
2026-03-20 05:06:15 -07:00
Michael Moss 904744bd72 Fix --gc-sections linking error on github macos-15-x86_64.
This forces `CMAKE_REQUIRED_FLAGS` to be treated as a string instead of list,
so none of the args get dropped when passed through `check_c_source_compiles`.

PiperOrigin-RevId: 886717366
Change-Id: I6314f9bfabd9d62bdcad5070c8801c453c381b79
2026-03-20 04:57:54 -07:00
Michael Moss 02d1d3d503 Fix call_guard usage inside .def_property calls.
See also [PR #5533](https://github.com/pybind/pybind11/pull/5533).

PiperOrigin-RevId: 886714838
Change-Id: I8c98461098ccf4958fb18bdcb5acc293c988c258
2026-03-20 04:50:50 -07:00
Yuval Tassa 9fa3f6f77e Enable float32 testing for most MuJoCo engine and user tests.
PiperOrigin-RevId: 886697701
Change-Id: I4a96fae03ea18494c3fcef8eb17b3b6f0863e9b7
2026-03-20 04:05:06 -07:00
Copybara-Service cab4b73f41 Merge pull request #3184 from MatiasManevi:single-thread-npm
PiperOrigin-RevId: 886334046
Change-Id: If054286ac11f2b0e13e770922c049e334d136ab1
2026-03-19 13:05:52 -07:00
Haroon Qureshi 6134fe48d9 Enable shadows depending on render settings.
PiperOrigin-RevId: 886236214
Change-Id: I6999e52ff3d9fc0734082312a77d6c033b69a24b
2026-03-19 09:59:50 -07:00
Haroon Qureshi eae31f0b3c Use model's num_quads for generating planes.
PiperOrigin-RevId: 886228541
Change-Id: I693f85edd84e4e1b1db6a932d4479888426bcae4
2026-03-19 09:44:53 -07:00
Michael Moss 779f6e8403 Save some CMake logs for debugging.
PiperOrigin-RevId: 886222847
Change-Id: Iaa641c334b3e90f594c6a19a29beefcf6eb7a3f4
2026-03-19 09:32:41 -07:00
Haroon Qureshi 7c63bcc8f3 Move Render logic into the Scene/Gui View classes.
This is in preparation for an upcoming change.

PiperOrigin-RevId: 886203890
Change-Id: I91eba35b394898d942f66f75e947c450b924a973
2026-03-19 08:50:41 -07:00
Taylor Howell 57bdf89d07 Import google-deepmind/mujoco_warp from GitHub.
PiperOrigin-RevId: 885715192
Change-Id: I13fcb8312c1515bb1bd2d6cdfd0d256e37cb74de
2026-03-18 11:58:25 -07:00
Kyle Bayes eec6e43a73 Bit compress face vertices in EPA to reduce memory needed. The parameter ccd_iteration is only supported to 1000, so we only need 10 bits for vertex index.
PiperOrigin-RevId: 885690198
Change-Id: I4c6af170ddc86316d3e9cfaf7ca7e0e4fac8a416
2026-03-18 11:10:14 -07:00
MatiasManevi b1c7ae1c19 Restore PTHREAD flag 2026-03-18 13:13:05 -03:00
MatiasManevi 9561decf64 Remove PTHREAD flag 2026-03-18 13:04:04 -03:00
MatiasManevi b35a5bab5e Shorten mv instruction 2026-03-18 12:10:08 -03:00
Alessio Quaglino e57d95e68f Remove vertcollide attribute from flex contact.
The `vertcollide` attribute in flex and flexcomp contact specifications has been removed since the next mjWarp release will support flex collisions. This attribute was previously used to enable vertex-based collisions by adding sphere geoms at flex vertices. The functionality associated with this attribute has been deprecated and removed from the XML parser, documentation, and internal data structures. Affected example XML files have also been updated.

PiperOrigin-RevId: 885595503
Change-Id: I6a78975f1bc540c09ea8b5306ff3be0962b7ab24
2026-03-18 07:59:57 -07:00
MatiasManevi 65d8d26af6 Add newline 2026-03-18 11:50:06 -03:00
MatiasManevi b694e9e951 Change caution for note 2026-03-18 11:49:19 -03:00
MatiasManevi aa07cdde5c Add documentation 2026-03-18 11:48:11 -03:00
MatiasManevi 8b7951c20c Add single threaded version 2026-03-18 11:18:41 -03:00
Sam Haves ef78f07ffb Automated g4 rollback of changelist 885555524.
*** Reason for rollback ***

Rolling back obj/stl decoder inclusion as sources due to broken windows build.

*** Original change description ***

Include obj and stl decoder plugins as sources in CMake builds.

This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged.

***

PiperOrigin-RevId: 885576586
Change-Id: I31e6fa4d10697862f7d800d0d771ca752747e36d
2026-03-18 07:18:19 -07:00
Sam Haves 15ca42ff68 Include obj and stl decoder plugins as sources in CMake builds.
This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged.

PiperOrigin-RevId: 885555524
Change-Id: I20aa5b6c55b678398345d49cb1c47667ae2bebcf
2026-03-18 06:23:26 -07:00
Matija Kecman f1715e67bd Fix studio web so that single file xml model can be loaded in a single-threaded wasm build
model_holder.cc modified to disable multi-threaded compilation for WASM builds. index.html `animate()` function modified so the animation rendering loop executes asynchronously with async/await calls. These changes are sufficient to make xml files without references work (e.g., humanoid.xml), more work is needed to make the vfs work so multi-file models can load.

PiperOrigin-RevId: 885537402
Change-Id: I3469cae48e7268073be334b99bf907c5ed8c27a7
2026-03-18 05:31:29 -07:00
Haroon Qureshi b0c48ba846 Planes should not receive shadows when rendered from behind.
Also refactors Renderables a bit to allow for additional use-cases.

PiperOrigin-RevId: 885527587
Change-Id: I4b17e097256de0356151a6d087bc01f11e3071b7
2026-03-18 05:05:21 -07:00
Haroon Qureshi 3f77daa27a Support wireframe rendering.
PiperOrigin-RevId: 885508978
Change-Id: I97216a120f4fede62924819cfb5cef5693adc7f8
2026-03-18 04:13:24 -07:00
Haroon Qureshi bc1f9513be Add flag for software rendering.
This flag is currently unused.

PiperOrigin-RevId: 885453938
Change-Id: Ia2112410ff12c7b18ad154f18887d4d795bafa3d
2026-03-18 01:48:15 -07:00
Tom Erez 60be42e83c Replace autowrap C# binding generator with introspect-based codegen.
This CL replaces the header-parsing autowrap system for generating
MuJoCo C# bindings (MjBindings.cs) with a new generator that uses
the mujoco.introspect module. The new generator reads pre-parsed
API data from introspect's enums, functions, and structs modules
instead of parsing C headers directly.

Changes:
- New: generate_cs_bindings.py in third_party/py/mujoco/codegen/
- Updated: genrule in unity/mujoco/BUILD to use codegen
- Updated: MjBindings.cs regenerated from codegen
- Removed: entire autowrap/ directory (9 files)
- Removed: transitional validate_codegen.py

The validate test continues to verify that the genrule output
matches the checked-in MjBindings.cs.

PiperOrigin-RevId: 885206129
Change-Id: Ib9fb883a2242dd2c039033eadee7a4a6ac91ed55
2026-03-17 14:19:49 -07:00
Yuval Tassa 206e245353 Internal change.
PiperOrigin-RevId: 885152209
Change-Id: I56941ba443fe3daad02eff39d6dbcaa9615df41b
2026-03-17 12:29:37 -07:00
Copybara-Service c0ab1cc130 Merge pull request #3178 from thowell:mjwarp_docs_mjlab_distributed_training_link_update
PiperOrigin-RevId: 885051946
Change-Id: Ib2473764a0d02924d73acccf59fc7a1236f5d8d1
2026-03-17 09:03:32 -07:00
Yuval Tassa 9d3ee5a948 Improve ASAN poisoning logic in mj_freeStack.
When freeing a stack frame, only poison the newly-freed memory region
`[old_top, new_top)` instead of the entire region `[limit, top)`. The old
code redundantly re-poisoned already-poisoned memory on every
`mj_freeStack` call.

Benchmarking `engine_forward_test` under ASAN:
- Before: 99.3s
- After:  75.6s  (~24% faster)

PiperOrigin-RevId: 885035750
Change-Id: Ib195661ca337d13c5ff6094bcc107c4c0a617b9b
2026-03-17 08:26:39 -07:00
Matija Kecman c420a6e1ca Fix resizing the window when running single threaded
This was affecting code running in the browser using WASM

PiperOrigin-RevId: 884921901
Change-Id: I13e634452275927f58a63179cdf140780852be2f
2026-03-17 03:32:35 -07:00
Matija Kecman 4be4a539c4 Fix "Selected backend not supported in this build" error when running using WASM
PiperOrigin-RevId: 884908229
Change-Id: I5515d1ffe8e7a4fd1f3c1eeee11a7f24196be780
2026-03-17 02:57:45 -07:00
Haroon Qureshi 9a0dd7d32d Make planes semi-transparent from behind.
PiperOrigin-RevId: 884896612
Change-Id: I00cc53e539fd1abccb43c7c6b89a7e063cb4848c
2026-03-17 02:27:34 -07:00
Taylor Howell 9d8004f60d mujoco warp documentation: update mjlab distributed training link 2026-03-16 20:26:34 +00:00
Yuval Tassa efae9157a7 Polynomial stiffness and damping https://youtu.be/aKa3ZlEF9_Y
PiperOrigin-RevId: 884607673
Change-Id: If8088dbf37fed1055304778a7eb84dec52cba920
2026-03-16 13:25:25 -07:00
Alessio Quaglino aec1b45dce Remove unnecessary const from grad parameter in strain Jacobian functions.
The `grad` parameter in `volumetric_dSdx` and `invariant_dSdx` is not modified, but the `const` qualifier was inconsistent with how the array was being passed, requiring an unnecessary cast. Removing the `const` simplifies the function signatures and calls.

PiperOrigin-RevId: 884598322
Change-Id: Icac8071aa8e838057dd39c979c23a4f47e1dc22d
2026-03-16 13:04:00 -07:00
Alessio Quaglino ac2730ab80 Change flex strain constraints for trilinear to a more stable formulation.
This change improves trilinear flex elements by using reduced integration for volumetric quantities (strain trace and volume ratio) at the element center, while adding full integration for shear components at 8 Gauss points and removing the second strain invariant from the constraints, which is negligible for small strains. This reduced integration "B-bar" technique is standard in finite element analysis and prevents artificial stiffness that can occur when low-order elements are nearly incompressible. The constraint count per trilinear element changes from 24 to 26 compared to using invariants. For quadratic elements, the full 27 quadrature point are used resulting in 162 constraints.

PiperOrigin-RevId: 884570752
Change-Id: Ib74ece8f4712c2c81fbfd784524fcac52a2c80e5
2026-03-16 12:05:16 -07:00
Sam Haves a5098a068a Update changelog for upcoming release.
PiperOrigin-RevId: 884479074
Change-Id: I086420505a047406c6bc36fc293c9722d9b41405
2026-03-16 09:23:13 -07:00
Yuval Tassa 1f2587fe3e Make preprocessor checks for ADDRESS_SANITIZER compatible with GCC
PiperOrigin-RevId: 884468086
Change-Id: I5742f023689fd8cc1747df1af5f0a9687a0e77ac
2026-03-16 09:03:52 -07:00