Commit Graph

467 Commits

Author SHA1 Message Date
Haroon Qureshi f2da6cabdf Add API function for querying frame stats.
Replaces the current GetFrameRate function.

PiperOrigin-RevId: 911897360
Change-Id: I4199ba9ce40d1d8bc37b551fa7058d964186641d
2026-05-07 04:57:30 -07:00
Haroon Qureshi e1b27afcda Merge math_util and model_util and rename to filament_util.
Move filament_util to the main folder so as to indicate that
these utilities can be used by anyone and aren't internal to
the filament renderer implementation.

PiperOrigin-RevId: 911884375
Change-Id: Ieb58184263bdac7e44a07f1e44a4649c68c6bf77
2026-05-07 04:20:28 -07:00
Haroon Qureshi 7ade42ca88 Internal changes.
PiperOrigin-RevId: 911871922
Change-Id: I82452ffb4c96dca0206d2284193e0756e3dc830e
2026-05-07 03:49:14 -07:00
Haroon Qureshi 607970a900 Remove dependency between SceneBridge and ObjectManager.
PiperOrigin-RevId: 911824153
Change-Id: Ie87d6d9e77b0b3f68a41a0c7d13a36fb2029e4c2
2026-05-07 01:55:52 -07:00
Haroon Qureshi 8e214e5133 Move imgui_editor into filament library.
PiperOrigin-RevId: 911808107
Change-Id: I14318b1c7396e2eaf0df9d6afcc5298de01bcfa4
2026-05-07 01:19:30 -07:00
Haroon Qureshi 39c891e358 Add function for creating Renderable meshes from mjtGeom types.
The Renderable class now internally knows which built-in meshes
to use for a given geom type. It gets these meshes from the
ObjectManager which now stores the collection of built-ins based
on the nstack/nslice/nquad quality arguments.

PiperOrigin-RevId: 911782530
Change-Id: I6698ec3964a5c657f6a9495809cc795eec2e346f
2026-05-07 00:13:01 -07:00
Haroon Qureshi b6aac76cc4 Pass filament::Engine instead of FilamentContext
for textures, meshes, and render targets.

PiperOrigin-RevId: 911770834
Change-Id: I081458e118f0e91091d6d4df7b760e9dbb321672
2026-05-06 23:44:39 -07:00
Sam Haves a501731089 Update multiccd default in mjcPhysics.
PiperOrigin-RevId: 911410939
Change-Id: Ia20b5be87f85c4662b71994dd824d90c6b98b3ed
2026-05-06 10:21:48 -07:00
Haroon Qureshi 2aa2131057 Refactor how render requests are generated.
Get the camera and drawmode from the bridges rather than recalculating
it unecessarily.

PiperOrigin-RevId: 911406470
Change-Id: Ia295846bb80105a2b0ad5da21912ca82b25e04bd
2026-05-06 10:13:37 -07:00
Haroon Qureshi 2b67fe3c3a Remove direct dependency between SceneBridge and ImguiBridge.
PiperOrigin-RevId: 911366540
Change-Id: I05c348ea6b1d08c034f2bb26e4c770079073c61d
2026-05-06 08:57:23 -07:00
Haroon Qureshi a692283db3 Add functions to create context and render.
Rename mjrf_render to mjrf_renderScene to avoid naming collision.
This function is will be removed in a future CL.

PiperOrigin-RevId: 910764245
Change-Id: If4d05e806a9699570ca4bbc882f28bfdd05dbd8d
2026-05-05 10:20:04 -07:00
Haroon Qureshi 24ce1eff10 Update compat library to use public functions.
There are still a few places where the compat library is downcasting
to the internal types due to limitations in the public APIs.

PiperOrigin-RevId: 910646480
Change-Id: I1ccb6714db08a2010d9535f59338e5eba06d1d35
2026-05-05 06:33:04 -07:00
Haroon Qureshi d168eb2d7d Expose several functions in the public C API.
PiperOrigin-RevId: 910629209
Change-Id: I8623309e348c72350703f6874a887592f0607bba
2026-05-05 05:56:02 -07:00
Haroon Qureshi 88bff84cbb Add API functions for creating and destroying objects.
Also provide a header-only C++ library that wraps created objects into
unique_ptrs.

PiperOrigin-RevId: 910607824
Change-Id: I0427f6dedab6aa299b3128031b055bd4d0c8e497
2026-05-05 05:08:25 -07:00
Haroon Qureshi de030f4664 Allow SceneView to read configuration from mjModel directly.
PiperOrigin-RevId: 910548865
Change-Id: I4db045e76cd36012810c75b9d150c6c5f5746488
2026-05-05 02:52:18 -07:00
Haroon Qureshi 68fdc439e4 Use mjrTextureTarget type instead of filament type.
PiperOrigin-RevId: 910547104
Change-Id: I3e8aa30a72b9b5ec8c45e8fa6bac18353ce7b485
2026-05-05 02:47:53 -07:00
Haroon Qureshi ee3ac5b349 Expose Renderable settings in mjrRenderableParams.
PiperOrigin-RevId: 908587103
Change-Id: Ic0e19a7fb3535bf32782b85d2da0049ec4ac8ec7
2026-05-01 00:19:28 -07:00
Yuval Tassa 22ca5fe0df studio: improve behavior of help window
PiperOrigin-RevId: 908132295
Change-Id: Iac0aead82a575dffbe35e3be8ba06af13986d1a2
2026-04-30 06:21:10 -07:00
Sam Haves e552a5f80d Expose more filament render settings via XML custom fields
PiperOrigin-RevId: 907659170
Change-Id: I0d8ca1ec058d40ed072db09c370f48b1e79ca6b3
2026-04-29 10:26:51 -07:00
Yuval Tassa cae70086da Scale UI style sizes by DPI.
PiperOrigin-RevId: 907630627
Change-Id: Ia6dc35ce00e9764a454f4021250089b0d9a94073
2026-04-29 09:31:33 -07:00
Haroon Qureshi 4e7b2f2124 Allow dimensions to be specified when creating a render target.
PiperOrigin-RevId: 907622395
Change-Id: I0f806f4d77afa6a178a20d36dae3e96b81359494
2026-04-29 09:14:10 -07:00
Haroon Qureshi 7e848e9406 Add mjr_sceneParams for creating Scene objects.
PiperOrigin-RevId: 907589621
Change-Id: If7537cf6fbac6d6418ac2bf8315714ada969511d
2026-04-29 07:58:42 -07:00
Yuval Tassa 52e90bf55d Fix high-DPI window size in Studio.
PiperOrigin-RevId: 907585586
Change-Id: Ie7db20f5242d89926a4a34ffed3a6e39698defd3
2026-04-29 07:48:12 -07:00
Sam Haves a2cd7aa52f Make mjz_decoder threadsafe.
PiperOrigin-RevId: 907574530
Change-Id: Ie292ff10dfa515e4ddc9dad1459e44c3ba9eeabe
2026-04-29 07:19:13 -07:00
Haroon Qureshi e745538ad6 Use FilamentContext for creating objects (instead of filament::Engine).
PiperOrigin-RevId: 907568857
Change-Id: If7b1b55bac9ef56dde43dc56b45c2c1034149dac
2026-04-29 07:04:46 -07:00
Yuval Tassa 9796345888 Add font scaling to studio, bound to CTRL+MINUS/PLUS
PiperOrigin-RevId: 907491215
Change-Id: I144467c3ff0e3d11f4a5bfb6ed2b1e4e88b8693d
2026-04-29 03:42:07 -07:00
Haroon Qureshi ace90c00b9 Remove deleted file.
PiperOrigin-RevId: 906944517
Change-Id: I8471d1014888cc03632df631b47080618694f4a4
2026-04-28 06:34:47 -07:00
Haroon Qureshi 5751b09ff6 Initial pass at exposing the new mjr APIs.
Moves all internal types and structs to the "public"
render_context_filament.h header file.

PiperOrigin-RevId: 906929736
Change-Id: I7e7c315fb99a3601b09841073eaeec795718b999
2026-04-28 06:00:03 -07:00
Haroon Qureshi 00fff8c780 Update APIs to use opaque handle types instead of concrete types.
PiperOrigin-RevId: 906895053
Change-Id: Id61d437ea814e038f25d92375eb747a6c6775c32
2026-04-28 04:40:46 -07:00
Haroon Qureshi 32aeb377b5 Move filament::Skybox object management into SceneView.
ModelObjects no longer directly manages any filament objects.

PiperOrigin-RevId: 906873925
Change-Id: Iaa317cbeb9c5236745a5f0d04a740985bec54a5c
2026-04-28 03:56:01 -07:00
Yuval Tassa 6f275b79c6 Studio: toolbar cosmetic improvements
- Remove hard-coded button sizes (48×32) from toolbar icons; buttons now use default ImGui sizing, matching the existing copy-camera button.
- Remove the Unload button (available via menu).
- Add ImGui_ColorButtonEx widget with per-corner rounding via ImDrawFlags, enabling segmented button-group visuals.
- Use segmented rounding for the pause/viscous/play triplet: rounded-left, square, rounded-right.
- Make pause and play buttons 40% wider than the viscous button for emphasis.
- Replace the theme combo dropdown with a cycling button.
- Reduce toolbar height from 48px to 34px and vertically center content via WindowPadding.
- Zero out table CellPadding in the toolbar for precise vertical centering.
- Remove the speed combo's inflated vertical padding.

PiperOrigin-RevId: 906853958
Change-Id: I6e4ec7243adb9e0f1f06f8779fa896a6865c46c7
2026-04-28 03:12:55 -07:00
Matija Kecman 9cd89eec2f Make Studio's monitoring charts responsive and full-window
* **Dynamic Full-Window Scaling**: Charts in the Performance and Solver panels now expand to fill the entire pane, automatically arranging side-by-side or stacked based on window orientation to eliminate scrollbars.

  * **Responsive Decorators**: Added reusable C++ ImPlot helper functions that auto-hide titles, legends, and tick labels when the plot surface is small.

  * **Cleaner Visualization**: Refined chart titles (e.g., "CPU msec vs frame", "Convergence vs iter") and removed redundant axis labels for improved scannability.

These changes were based on the plot behavior of //third_party/mujoco/src/experimental/py/sample/implot.py This is an incremental improvement, we can make the plots even nicer in future.

PiperOrigin-RevId: 906351914
Change-Id: I8cb19c19bf807f0107c717066250a71bcf7e325f
2026-04-27 07:42:56 -07:00
Yuval Tassa 2e3205229c Studio: various panel usability improvements
- Reorder Physics section, move Actuator Groups to end.
- Rename "Physics Settings" → "Physics", "Rendering Settings" → "Rendering".
- Reduce IndentSpacing from 20 to 6.
- Reduce FramePadding Y from 6 to 2 for narrower buttons and popups.
- Remove explicit Unindent/Indent overrides in Rendering and Visibility Groups
  sections so buttons are naturally indented under their tree nodes.
- Dynamically adjust convergence and counts plot X-axis limits based on actual
  solver iterations instead of hardcoded 20.

PiperOrigin-RevId: 906244477
Change-Id: Ic3e6e6e793395158c8cb6692af885884ca3f7f50
2026-04-27 03:11:51 -07:00
Matija Kecman 3a5a48b9f9 Fix texture ID collisions in ImguiBridge
Texture IDs were assigned using textures_.size() + 1, which is not monotonic: after erasures the map shrinks and previously used IDs can be reassigned to new textures. This causes multiple ImGui images to reference the same underlying Filament texture, rendering them all with the same pixel data. This fix replaces the size-based scheme with a monotonically increasing counter (next_tex_id_) that never reuses IDs.

PiperOrigin-RevId: 906214496
Change-Id: I5a388861ad9565c8e00e27b39cc9c76c9750ca1e
2026-04-27 01:59:28 -07:00
Haroon Qureshi b643f50b2a Rename IndexType USHORT/UINT to U16/U32.
PiperOrigin-RevId: 906026433
Change-Id: I0016c1923560fc8517e5388ed6068d54b84d5923
2026-04-26 14:55:55 -07:00
Haroon Qureshi 8f32f6e72e Rename enum values to match type name.
PiperOrigin-RevId: 906014884
Change-Id: I0f37ab0a0a910724723fb9f7e477b64643ca05fc
2026-04-26 14:03:59 -07:00
Haroon Qureshi 2fa2db7ae0 Re-enable spotlights in wasm builds.
PiperOrigin-RevId: 905917482
Change-Id: Iaadd2b2ccf3be91ec2edfb8ecfd40db32909dd4e
2026-04-26 07:34:17 -07:00
Matija Kecman 82eab11a88 Remove deprecated Fonts->Build() and clean up ImGui texture lifecycle
* Remove the explicit io.Fonts->Build() call from InitImGui, which was deprecated in Dear ImGui v1.92.0. With ImGuiBackendFlags_RendererHasTextures already set, the font atlas is now built lazily by ImGui and communicated to backends via the ImTextureStatus_WantCreate protocol.

* Add proper texture shutdown in ~ImguiBridge by iterating ImGui::GetPlatformIO().Textures and destroying all tracked textures, per the //third_party/dear_imgui/docs/BACKENDS.md instructions.

* Remove the "OK but missing" and "WantUpdates but missing" texture recovery hacks from Update(). These handled a state where ImGui thought textures were alive but the Filament-side storage had been torn down. With proper destruction acknowledgement (SetStatus(Destroyed) + SetTexID(Invalid)), ImGui will now transition destroyed textures to WantCreate on the next frame, and the normal creation path handles it cleanly.

PiperOrigin-RevId: 905886622
Change-Id: Ic449eeaf083740a67eae9c637fb53546a6192b28
2026-04-26 05:19:26 -07:00
Haroon Qureshi 4eb987ad25 Fix uninitialized value.
PiperOrigin-RevId: 905169930
Change-Id: I8df07e8731e8eb1847bc43388f26654d28bcef4c
2026-04-24 12:37:48 -07:00
Haroon Qureshi a2ee85f477 Fix wasm flickering.
Always execute the engine in non-threading (wasm) builds.
And stop rendering if any beginFrame call returns false.

PiperOrigin-RevId: 905000139
Change-Id: I0a6f06a07a8fc0ab0251a67be13a9d170d4a905d
2026-04-24 06:42:38 -07:00
Saran Tunyasuvunakool 1465d8b6ce Initial implementation of MuJoCo Live.
This is a combination of minor tweaks to the existing Studio WASM application, CMake cleanup to make it buildable, and integration with GitHub Actions for deployment.

The new features added are drag-and-drop, model specification through `?model=` URL parameter, HTTP and HTTPS resource provider, and a user-visible loading message while the model is loading.

PiperOrigin-RevId: 904594610
Change-Id: I3a73b1ca0fcd6fc9ba192469942b2dab010a9308
2026-04-23 12:56:12 -07:00
Haroon Qureshi c52d3d0789 Split out the compatibility classes from the filament renderer.
The filament library provides APIs for creating the low-level
objects such as meshes and textures. The compat library provides
the high-level compatibility layer between mjvScene and the core
library.

PiperOrigin-RevId: 904504900
Change-Id: Ida1aecab4b9a8aefbbf6b0a0c4ba7ff164864b8e
2026-04-23 09:52:45 -07:00
Matija Kecman 2b211e1ce6 Detect wayland sessions and report a clear error prompting users to switch to X11 or choose a different graphics mode
PiperOrigin-RevId: 904460146
Change-Id: I9324f403cb09787833c06f863ac157059eea60e7
2026-04-23 08:02:29 -07:00
Haroon Qureshi 8a87a1efbf Rename types to conform to mjr naming conventions.
PiperOrigin-RevId: 904459745
Change-Id: I9369bec34e72dc973df45f844fcf1a6cb08b26b1
2026-04-23 08:01:46 -07:00
Haroon Qureshi 2bc97d8408 Rename types to conform to mjr naming conventions.
PiperOrigin-RevId: 904458866
Change-Id: Id9ca27b698e0e40469524ba4454ab9721a65e785
2026-04-23 07:59:19 -07:00
Haroon Qureshi ead7b1f65e Rename types to conform to mjr naming conventions.
PiperOrigin-RevId: 904457841
Change-Id: I023ffe87eee0a190006dea72ced8748725490098
2026-04-23 07:56:27 -07:00
Haroon Qureshi 3d13d43c9c Rename types to conform to mjr naming conventions.
PiperOrigin-RevId: 904456797
Change-Id: I759b1430a43c7072ed9750d084679d02f0c9cb6e
2026-04-23 07:53:34 -07:00
Haroon Qureshi 4345a2a09f Rename types to conform to mjr naming conventions.
PiperOrigin-RevId: 904440645
Change-Id: I0b9a0c6bd61170ace1a3ea7fb54fb70b615c346b
2026-04-23 07:14:46 -07:00
Haroon Qureshi c1c7643fad Rename types to conform to mjr naming conventions.
PiperOrigin-RevId: 904438811
Change-Id: I77fe14592a4460234e0aff473ee3f530e652bca9
2026-04-23 07:13:00 -07:00
Haroon Qureshi fa33310750 Fix use-after-release issue.
PiperOrigin-RevId: 904351356
Change-Id: Ie6a574763b2ee0ffc0cf5537d8ccdfe87ab1b477
2026-04-23 03:23:55 -07:00