Commit Graph

439 Commits

Author SHA1 Message Date
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
Haroon Qureshi e1794b3d1c Add missing files.
PiperOrigin-RevId: 904346200
Change-Id: I63f4e8741098d5da9403c05ca13419c670743848
2026-04-23 03:10:54 -07:00
Haroon Qureshi 57ad7463b1 Use separate SceneView for main scene and UX.
Refactor FilamentContext to allow multiple render requests to
be submitted onto a single RenderTarget. The main scene and the
ux scene are then submitted as two separate requests that share
the same target, resulting in a single, composited render.

PiperOrigin-RevId: 904324801
Change-Id: I7c47ec4f8d159320612fa33384c01e8db3414daa
2026-04-23 02:23:23 -07:00
Haroon Qureshi c41ed42407 Split the core filament context from the mjr_ API compatibility layer.
PiperOrigin-RevId: 904305762
Change-Id: I462068a847a21be8ad7f3f1a8889f6b5b2aa2d5f
2026-04-23 01:39:12 -07:00
Kyle Bayes 6cb6e5a93f Enable multiccd by default.
PiperOrigin-RevId: 902752921
Change-Id: I8e2085ff17db0ac0db1641b8837415c458e5eca4
2026-04-20 12:00:10 -07:00
Haroon Qureshi 8e7787ad09 Use function for applying transforms to multimesh Renderables.
PiperOrigin-RevId: 902712241
Change-Id: I5bfdab8bce12ffb1a1f030ae0a32a61e9b8157e1
2026-04-20 10:39:44 -07:00
Haroon Qureshi 476e2e909e Allow Transforms to be set directly on Renderable.
Also allow multiple Meshes to be assigned at once rather than one at a
time.

This simplifies both the usage and implementation of Renderable.

PiperOrigin-RevId: 902665683
Change-Id: I23ff365a54fd6a3814ed3452b1e094ae9f698a1b
2026-04-20 09:06:14 -07:00
Yuval Tassa b2281883dd Improve slider precision and range clamping, fixes #3206
Add clamping to slider values in both ImGui widgets and mjUI to ensure they remain within the defined min/max ranges, preventing potential floating point inaccuracies from causing values to slightly exceed the bounds.

PiperOrigin-RevId: 902660458
Change-Id: Ia153ae7907f07b890f2b5ac2e3a4be93ecae7bd3
2026-04-20 08:54:11 -07:00
Haroon Qureshi cad734ae70 Introduce Trs type.
Combines a translation, rotation, and size into a single struct.

PiperOrigin-RevId: 902620586
Change-Id: I628bfdedebde8c83239215efe0bee4a338eabd06
2026-04-20 07:13:52 -07:00
Haroon Qureshi 86ad41b9c2 Use RenderableParams for creating Renderables.
PiperOrigin-RevId: 902569516
Change-Id: Id233a5ef7fe86ce5902ce2552d8d0fec6ce860b7
2026-04-20 04:51:18 -07:00
Haroon Qureshi eb31027a7c Simplify RenderTarget creation.
Remove the RenderTargetTextureType enum and, instead, create
RenderTargets directly from pixel formats.

PiperOrigin-RevId: 902536708
Change-Id: I2683aa9db23c011212087d93df0260ad27621170
2026-04-20 03:27:52 -07:00
Haroon Qureshi bf9be2c312 Remove MeshPtr type alias.
PiperOrigin-RevId: 902502036
Change-Id: I5bd0c185f204518f0cd0d9189741c17c24b51eb6
2026-04-20 02:01:34 -07:00
Matija Kecman cf3f6ccf1f Make file search deterministic in FindFileInPath.
Collect all entries from the recursive directory iterator, sort them, and then check for the filename. This ensures that if multiple files with the same name exist in different subdirectories, the one found is always the same, regardless of the filesystem's directory iteration order.

PiperOrigin-RevId: 902487291
Change-Id: Ia4c45cd2e3cab4a4e3825c267fc47c3134f99f76
2026-04-20 01:27:40 -07:00
Haroon Qureshi f3f12bfad6 Manage dynamic meshes (skins, flexes) in model_objects.
Simplifies Renderable as it no longer has the option of owning
any Meshes. Instead, the ModelObjects owns the Meshes for
flex and skin geom (just like it owns all the other mjModel
Meshes).

PiperOrigin-RevId: 902485912
Change-Id: I8b9f9d394de6c46f7e25aa4b3885a374aad05294
2026-04-20 01:23:47 -07:00
Haroon Qureshi 8415dff307 Merge Material into Renderable.
Allows the Renderable to update its own MaterialInstances whenever
Material textures or parameters are modified.  Each Renderable now
also knows how it is intended to be used (i.e. scene objects or ux)
which allows it to correctly pick the underlying filament::Material
to use.

PiperOrigin-RevId: 901161990
Change-Id: Ic280731d39c272c50d6ad100cec7116e683cbc79
2026-04-17 01:59:02 -07:00
Matija Kecman f91ce9a627 Remove window dependency from PipGui
PiperOrigin-RevId: 901115560
Change-Id: I85183a91fd07682f17f43fcfad593dececdde28c
2026-04-17 00:11:59 -07:00
Haroon Qureshi 1117e7db39 Move DrawMode into its own header file.
PiperOrigin-RevId: 900656695
Change-Id: I4db6f0f74c2109752efe40bc37c7104505139049
2026-04-16 04:44:22 -07:00
Haroon Qureshi 5a0809efaf Remove dependency on Texture from ObjectManager.
ObjectManger now manages low-level filament Texture and
Material objects directly. Moves the IBL Texture to the
SceneBridge class.

PiperOrigin-RevId: 900626110
Change-Id: Idd39464bfb324188dd54975a500954d4ebb29006
2026-04-16 03:24:21 -07:00
Haroon Qureshi a6b98e5a78 Keep track of the vertex attributes in a Mesh.
PiperOrigin-RevId: 900583030
Change-Id: I5b1ff5ad7b698e3e68fd06f44f2c5d3399d08504
2026-04-16 01:41:56 -07:00
Haroon Qureshi eacbce95f4 Fix CMakeLists file.
gui_view was renamed imgui_bridge

PiperOrigin-RevId: 900208849
Change-Id: I305a8a90306038c236256c21d04d2bad7144d83a
2026-04-15 09:37:06 -07:00
Haroon Qureshi e047f1101a Rename GuiView to ImguiBridge.
PiperOrigin-RevId: 900186368
Change-Id: Ie8f08d081dbc9a2b5638b5e799788e81891c908a
2026-04-15 08:44:00 -07:00
Haroon Qureshi 62cffb1536 Update GuiView to use SceneView and Renderables.
PiperOrigin-RevId: 900145167
Change-Id: I613c9fe171e97f8a4cd08c0c63e9706e09cbd202
2026-04-15 06:56:16 -07:00
Haroon Qureshi f24f9ef44d Allow submeshes to be set when adding meshes to a Renderable.
Also add support for blend order.

PiperOrigin-RevId: 900061778
Change-Id: I601757a8672fed23e45defd4cdbe4e9526ea3b70
2026-04-15 03:25:55 -07:00
Matija Kecman 9289905c9a Make StepControlGui a reusable component and refactor/simplify the implementation
PiperOrigin-RevId: 900045404
Change-Id: I9976ece042710ddce0a7c5d99a6ac85a0ef06d2f
2026-04-15 02:48:11 -07:00
Haroon Qureshi d913e0b1e9 Add ReadPixels function to RenderTarget.
PiperOrigin-RevId: 900017779
Change-Id: I0632b66124632558ea19157e4ca319e4b0d10617
2026-04-15 01:39:54 -07:00
Haroon Qureshi 08bb6e66f1 Small fixes to decor rendering.
Use an unlit material for decorative elements and do not render them
in the reflection pass.

PiperOrigin-RevId: 899560291
Change-Id: I3b035d556432c850ce8240e0c4c4c2d6645d7bf2
2026-04-14 06:50:51 -07:00
Haroon Qureshi aef0589442 Allow Light objects to be image based lights.
PiperOrigin-RevId: 899488765
Change-Id: I3b56fc6499404bb011f9361c03dba23b736ad4bc
2026-04-14 03:49:26 -07:00
Haroon Qureshi fd5a7004f8 Remove Drawable abstraction.
Instead, use a set of functions to create/update a Renderable
from an mjvGeom.

This completely isolates mjvScene/mjvGeom from SceneView,
making SceneView a more general purpose class.

PiperOrigin-RevId: 899475268
Change-Id: I48a3a45bc8fff3e1f514847c7a1ca8ab3a1ff16e
2026-04-14 03:13:55 -07:00
Michael Moss 171e6dc177 Automated rollback of PiperOrigin-RevId: 899009633.
*** Original change description ***

Add protocols for authoring simulation environments. This is for preview only, we discourage users from using this in production code.

PiperOrigin-RevId: 899425542
Change-Id: Ifb6c5d3b762789d821bfa9826f5d6d983e8af7d3
2026-04-14 01:16:35 -07:00