Commit Graph

253 Commits

Author SHA1 Message Date
Haroon Qureshi e43ed60d29 Allow GUI to be rendered to texture as well.
Update SetFrameBuffer to allow users to customize which swap chain
(window or offscreen) to use for rendering both the main mjvScene
as well as the GUI.

PiperOrigin-RevId: 861624061
Change-Id: Ife7bfc447afb007016300438fc5f88a8e4cfa0f6
2026-01-27 03:12:05 -08:00
Haroon Qureshi bdb553ff8a Add a ModelPlugin that can be used to load and update models.
PiperOrigin-RevId: 861077626
Change-Id: I3ef4989cfbfff3632c5915c00ebda1e7a48716e8
2026-01-26 01:24:43 -08:00
Sam Haves 2582a83ac3 Add equalityJointAPI to mjcPhysics.
PiperOrigin-RevId: 860081702
Change-Id: Ifd961dcb2a8e0f5d885e9e9dadc0153b03cb5f4d
2026-01-23 06:28:29 -08:00
Haroon Qureshi bab468703c Display error message when requested file does not exist.
PiperOrigin-RevId: 859583121
Change-Id: Id9969e486499a70769e325161c3cd2c204006d9a
2026-01-22 06:34:35 -08:00
Matija Kecman 98593259e7 Internal change
PiperOrigin-RevId: 859578296
Change-Id: If4dd4ca68ab9750693e5f6ff20ea0c78d6b93464
2026-01-22 06:20:47 -08:00
Haroon Qureshi 2cc2e579f1 Refactor model loading APIs.
There are three ways to load a model: from a file, from a buffer, or an
"empty" model. Instead of overloading a single function to do all three,
provide three separate functions.

Also disable model loading functions that will not work for emscripten.

PiperOrigin-RevId: 859051341
Change-Id: I71557d31d0e7c9c6882895c36116d300f19e255d
2026-01-21 05:25:08 -08:00
Haroon Qureshi e2180ff744 First-pass of a plugin system for GUI elements.
Refactor filament's debug drawing to be one such plugin.

PiperOrigin-RevId: 859002002
Change-Id: Ibe9000dec19fce648eef6d57170ce435b9a8c6ff
2026-01-21 02:47:09 -08:00
Haroon Qureshi bf05bb1885 Make quit button work.
PiperOrigin-RevId: 858624789
Change-Id: Ibdd572b60273424f3b7e9bb6a9d117d2a0538227
2026-01-20 09:28:48 -08:00
Haroon Qureshi a0accc493a Fix camera select logic.
PiperOrigin-RevId: 858599199
Change-Id: I25f1a74ac145c73bb225d6df8e86aa82d88ebb4b
2026-01-20 08:18:29 -08:00
Haroon Qureshi de47cf0e6f Don't mipmap sRGB textures.
PiperOrigin-RevId: 858148054
Change-Id: Ic115b7431901549e1c636eb20414641c37cf3e8a
2026-01-19 05:26:27 -08:00
Matija Kecman 654b393060 Add a boxing utility which can surround a bunch of UI and render it in a box.
The ImGui table API cell padding variables can be used to adjust the positioning of the UI in the box.

PiperOrigin-RevId: 858137824
Change-Id: I1ce1519c0abd67bc5fafc30f9a18dfcf18c2a313
2026-01-19 04:48:50 -08:00
Haroon Qureshi 77d1ac10fe Fix scaling issues on HDPI monitors.
PiperOrigin-RevId: 857024487
Change-Id: I7d3db9ff754374053bcd33ba93c7466253afb58c
2026-01-16 01:17:38 -08:00
Sam Haves c08e1d9e6e Add MjcEqualityAPI as a base class for MuJoCo constraints and MjcEqualityWeldAPI for representing weld constraints.
This change introduces two new USD API schema:
* MjcEqualityAPI - base API for representing MuJoCo equality constraints in USD, this will typically be applied to joints such as UsdPhysicsFixedJoint.
* MjcEqualityWeldAPI - extends MjcEqualityAPI for MuJoCo's weld equality constraints with an attribute for torqueScale.

The usd_decoder is updated to parse UsdPhysicsFixedJoints and convert the new schema attributes into the appropriate mjsEquality data fields.

PiperOrigin-RevId: 856723634
Change-Id: I0982fd3168b643f8e91d87bb5ae5933e526b63a1
2026-01-15 10:44:27 -08:00
Haroon Qureshi c92746641d Implement picture-in-picture mode.
Adds a new window that allows the user to display one or more renders from
the different cameras in the scene.

PiperOrigin-RevId: 856607089
Change-Id: I7268ffd3ef62b9b4d62ce8d004fdbbec92b42af4
2026-01-15 04:42:27 -08:00
Sam Haves d816b38f4c mjcPhysics MjcTendon path now has an indices attribute to allow repeated sites in tendon path.
Since relationships in USD can only contain a single instance of a path, it was previously impossible to have a tendon path that visits the same wrap target more than once. This is a fairly common occurence when dealing with tendons that have pulleys.

With this change, if mjc:path:indices is not defined then the behaviour is as it was and the mjc:path is considered to be ordered. If it is authored then the parser will use the indices into mjc:path as the order. This mirrors other similar concepts in USD such as face vertex indices.

PiperOrigin-RevId: 856339887
Change-Id: I6b9503973de377acdb0689be168c16e4aa19b70b
2026-01-14 13:24:28 -08:00
Haroon Qureshi 42c565d860 Use a dedicated swap chain for offscreen rendering.
PiperOrigin-RevId: 856320260
Change-Id: I3076827baf075282651e4308db74b163a5709935
2026-01-14 12:31:54 -08:00
Haroon Qureshi 5a7abfe8a0 Set cleared memory back to nullptr.
PiperOrigin-RevId: 856188793
Change-Id: Iab33171b07f0d2a48d19986e145b832d1037d596
2026-01-14 06:38:45 -08:00
Yuval Tassa 218226fc95 Breaking change: Add surface normal output to MuJoCo raycast functions.
PiperOrigin-RevId: 855781592
Change-Id: Id96b1ca7eaf722e260cc69d7706c28dc51f52d92
2026-01-13 10:22:21 -08:00
Haroon Qureshi 071cb83fe7 Strip the prefix correctly.
PiperOrigin-RevId: 855297807
Change-Id: Ic182f64c451077386fdba8bfe34e8da6364b9f60
2026-01-12 10:59:20 -08:00
Sam Haves a5dc57c0c3 Move OpenUSD parsing to usd_decoder
Add usd_decoder to mujoco/plugin.
  - Previously was src/experimental/usd/usd_to_mjspec.cc, now that same spec is returned by the plugin.

PiperOrigin-RevId: 854350962
Change-Id: Ia980190a557c50ce8197980922a2594b613859b4
2026-01-09 14:48:29 -08:00
Haroon Qureshi 2c4f710cf4 Ensure resource providers are correctly initialized.
PiperOrigin-RevId: 854095105
Change-Id: I028265d7f51e6ab178f4f3a1d801ba773093214f
2026-01-09 02:07:24 -08:00
Sam Haves 2f2f9a30ba When loading models use mj_parse instead of mj_parseXML, and allow non-xml file types.
PiperOrigin-RevId: 853730923
Change-Id: I1c107daafd558bedb99338779c8174ee3e4d07e2
2026-01-08 07:22:51 -08:00
Matija Kecman e1261ba5f1 Fix perturbation rendering in webdemo
PiperOrigin-RevId: 853290958
Change-Id: Ifcea1091633597171c5268d5ee091bea3ddee45b
2026-01-07 09:18:45 -08:00
Haroon Qureshi 9743c2d385 Use mjResourceProvider instead of custom LoadAsset callbacks.
PiperOrigin-RevId: 853172824
Change-Id: I60ef1207611c4da119cc3f0a7819088cffca6e4f
2026-01-07 03:03:23 -08:00
Haroon Qureshi e3ddb126f5 Fix target name; should be PLATFORM not STUDIO.
(This was caused by a bad merge on my end.)

PiperOrigin-RevId: 851315742
Change-Id: Ifd5afa7f6cbd566ef2c15603e91a7360ea65c86a
2026-01-02 06:03:13 -08:00
Haroon Qureshi b9fa8ee6e9 Move all specialized rendering logic into Renderer class.
(We may consider splitting this class up into specialized subclasses at a later date.)

PiperOrigin-RevId: 851290789
Change-Id: Iee00b8e906eeb911de5799f784475ac6916ab55b
2026-01-02 04:25:07 -08:00
Matija Kecman 9f674b04a9 Fix ground plane rendering when using filament backend
PiperOrigin-RevId: 848473849
Change-Id: I096b20c6a5538ff95396bdf09f84ed5f2d3015ed
2025-12-24 01:25:51 -08:00
Haroon Qureshi a3e66cd5df Combine performance charts; add fullscreen mode.
PiperOrigin-RevId: 847751915
Change-Id: I819eb8d36224ddba38ef8532a038a2ef350890c8
2025-12-22 07:08:20 -08:00
Sam Haves 44c8ef890d When building with USD enabled, add functionality that automatically registers the mujoco USD plugins.
PiperOrigin-RevId: 846767370
Change-Id: Ieedbe127353623c11150551c1409d340dbc57421
2025-12-19 09:39:03 -08:00
Sam Haves 3d9c195e3c Fix rpath for usd target shared libs.
PiperOrigin-RevId: 846759676
Change-Id: I5b2a73b3f997d4d0d447e051c43069ae7418a7ec
2025-12-19 09:14:45 -08:00
Sam Haves 9e150fe82c Add separate build step for OpenUSD to third_party_deps.
This will fetch and call the build_usd.py build helper for OpenUSD and build within the MuJoCo _deps folder. Simplifying the build process for MuJoCo with USD. Users can still provide their own USD build, but must now do so via pxr_DIR.

PiperOrigin-RevId: 846735578
Change-Id: I0da7eb2da6465e2d518084340e762bf370adb6d5
2025-12-19 08:00:15 -08:00
Haroon Qureshi d1fd11bccd Refactor SaveScreenshot into a more useful RenderToTexture function.
Removes a few unused functions from helpers library.

PiperOrigin-RevId: 846661437
Change-Id: I815ffe1990098dedb71f694af088d85294f9c7de
2025-12-19 03:33:59 -08:00
Haroon Qureshi 522ff1cd80 Allow ImGui uploaded images to be resized or destroyed.
PiperOrigin-RevId: 846354598
Change-Id: I86882813ab607945fffc763122248e167be856a8
2025-12-18 11:42:19 -08:00
Sam Haves b5b654f00c Correctly handle segmentation and ID_COLOR flag in filament.
PiperOrigin-RevId: 846319715
Change-Id: I244ae52c34079b79d3179fafdf6aa506cc89e1ff
2025-12-18 10:14:13 -08:00
Haroon Qureshi bebdd62943 Allow studio to search for models in predetermined search paths.
A future CL will allow users to specify search paths in their settings.

PiperOrigin-RevId: 846240293
Change-Id: I1a1a4027d0fc85004a12fe01a406f50fd929f3e4
2025-12-18 06:32:24 -08:00
Haroon Qureshi 7190bd4912 Add flag for depth rendering.
PiperOrigin-RevId: 846203691
Change-Id: I5ec494446bcfc1f7c81536a87dd24f9967973563
2025-12-18 04:36:26 -08:00
Sam Haves eef71832db Remove usage of usdImaging tokens to avoid needing to build imaging.
PiperOrigin-RevId: 844768270
Change-Id: Iba0a03646e56d9be5accf754f97ec37db8055425
2025-12-15 07:44:18 -08:00
Haroon Qureshi 43bcbb158c Load last saved GUI configuration on first load.
Also save theme to the configuration.

PiperOrigin-RevId: 843710929
Change-Id: I7ce9ce0f026d2cb5f79addf6c16c9b540bf11954
2025-12-12 08:56:53 -08:00
Haroon Qureshi 3da421afaa First-pass implementation of web-based studio app.
PiperOrigin-RevId: 843685213
Change-Id: I2642a21d5573ef548eece0eb9a2c634e4881eec5
2025-12-12 07:42:42 -08:00
Haroon Qureshi a0a56065e0 Use hex values instead of u8 string literals.
PiperOrigin-RevId: 843583709
Change-Id: Ib55cfd472de2f83b0455ebf95f6826c887f6dd70
2025-12-12 01:45:13 -08:00
Haroon Qureshi e07adc387a Update themes to differentiate from default dear_imgui themes and add a classic theme that's similar to simulate.
PiperOrigin-RevId: 843313013
Change-Id: Id01841097f32a5b01acd8fcf59392a73acad8f27
2025-12-11 11:46:12 -08:00
Haroon Qureshi 87d333c64a Allow MJB and XML content to be loaded directly.
PiperOrigin-RevId: 843180720
Change-Id: Id4f2bf81507b971dfbbf250d775d7fdfc76517df
2025-12-11 05:41:43 -08:00
Yuval Tassa fe0a11d58d Change Filament background color to black.
PiperOrigin-RevId: 843152096
Change-Id: I2ef87ffffb9cc8662fa6353c6d38f1046f21b34b
2025-12-11 03:56:34 -08:00
Haroon Qureshi 9c1b8d8cfb Enable font loading for wasm builds.
PiperOrigin-RevId: 842627994
Change-Id: I347f79ec668f31a8bbc4d26638a045e29084d715
2025-12-10 02:31:46 -08:00
Yuval Tassa 32d7b87ba7 Improve studio 2D plots
PiperOrigin-RevId: 842260702
Change-Id: I4644b69da92b9d015eb2d140b98f68c05d31a222
2025-12-09 08:56:51 -08:00
Haroon Qureshi 7553541b4b Use public mj_parseXml function.
PiperOrigin-RevId: 842245812
Change-Id: I26e1f992f82050a36373ee3a3f2c97c399b4e788
2025-12-09 08:14:32 -08:00
Haroon Qureshi 97eb307ce9 First pass at mjSpec Explorer and Properties windows.
Displays the list of bodies and joints from the mjSpec and displays
values for the selected element.

Functionality is very limited and a bit non-intuitive. However, we want
to get this into our users hands to start getting feedback.

PiperOrigin-RevId: 842228895
Change-Id: I2491cd5e0acaf622110e0f6b8406919024d3607a
2025-12-09 07:28:26 -08:00
Haroon Qureshi 925c533580 Move playback speed control to the toolbar.
Initialize playback speed based on the model's global.realtime setting.

Adjust layout and tweak colours of the status and tool bars.

PiperOrigin-RevId: 842214796
Change-Id: Iff9cda74178df28a0787693242fee81e011014fc
2025-12-09 06:47:38 -08:00
Yuval Tassa cc914c9ec7 Modify studio keyboard bindings to conform to MuJoCo API.
PiperOrigin-RevId: 842197387
Change-Id: I6ee9b1f5050cb4a8c2f67253f37481c61c91fdbd
2025-12-09 05:53:14 -08:00
Haroon Qureshi e1e2248925 Internal changes only.
PiperOrigin-RevId: 842099953
Change-Id: Ia11feec323504976cdc3e6d7170435b74ed33fcd
2025-12-09 00:18:06 -08:00