Commit Graph

62 Commits

Author SHA1 Message Date
Haroon Qureshi 0399bfd058 Allow custom getProcAddress for glad resolution.
PiperOrigin-RevId: 908587023
Change-Id: Idc4dcc5ee8d2d67f83486ca2ff4667f2b4b283eb
2026-05-01 00:18:26 -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 35c0a25cf4 No-op implementation for mjr_ functions.
This can be useful, e.g. writing tests that don't depend on rendering.

PiperOrigin-RevId: 879012859
Change-Id: Ifb8d7d5bb06a2456c1b4543f0bf4945fe8155039
2026-03-05 05:34:19 -08:00
Haroon Qureshi aef44210cb Rename render to render/classic.
This will allow us to add additional renderers to the `render` folder.

PiperOrigin-RevId: 878913300
Change-Id: I205ae41250cbbcded406ad303d4e801d4cff892e
2026-03-05 01:43:21 -08:00
Yuval Tassa 30b903b6c0 Migrate mjModel size fields from int to mjtSize.
This change updates all size-related members within the `mjModel` struct from `int` to `mjtSize`. This allows MuJoCo to handle models with a larger number of elements. Corresponding changes were made to macros, function signatures, and I/O routines to accommodate the new `mjtSize` type.

PiperOrigin-RevId: 860144595
Change-Id: I701c6d607715d240766b6210a9773cd9e4258c59
2026-01-23 09:41:49 -08:00
Haroon Qureshi 7190bd4912 Add flag for depth rendering.
PiperOrigin-RevId: 846203691
Change-Id: I5ec494446bcfc1f7c81536a87dd24f9967973563
2025-12-18 04:36:26 -08:00
Yuval Tassa 85e6f6de3c Ignore unsupported light types in GL3 renderer.
PiperOrigin-RevId: 842271116
Change-Id: I632f7ed8e2a6488d5a8eb228928e26c8fcbdff66
2025-12-09 09:22:29 -08:00
Yuval Tassa 735b31fc89 Fix triangle lighting in native renderer.
PiperOrigin-RevId: 841796563
Change-Id: I778e0e02aa8b4033531d4fadc091610418ab909e
2025-12-08 09:27:04 -08:00
Yuval Tassa 1c6a05de98 Snap Y-axis range to nice decimal bounds in gl2 figures.
PiperOrigin-RevId: 830355030
Change-Id: I2e9f145fb8c626dd671d286560c8334202586c6b
2025-11-10 03:01:30 -08:00
Yuval Tassa 681f5767b2 Remove -Wno-extra-semi, add workaround for mjSORT confusing some IDEs
PiperOrigin-RevId: 808689636
Change-Id: Ia091fb597c171a33842e62690d06f32614fbe4eb
2025-09-18 12:28:09 -07:00
Google DeepMind 931036adda Always try to find the skybox texture, even if there are no materials in the MJCF. Fixes #2412
Before the fix this only occured if the MJCF contained 0 materials.

PiperOrigin-RevId: 795510952
Change-Id: I0a36c275e6006f80dc9a5ba6b9c6040ce21187c9
2025-08-15 09:53:37 -07:00
Alessio Quaglino 80befd64ae Do not cull mjGEOM_TRIANGLE.
PiperOrigin-RevId: 789723631
Change-Id: I8a5aaa78a9fe63458c07b823c7550846c14413b1
2025-08-01 05:28:30 -07:00
Google DeepMind 74cc904edc Convert light directional boolean into a type enum.
PiperOrigin-RevId: 761983728
Change-Id: Id5bf93c103e5358d9c5cd9f1176532a978e0b3a8
2025-05-22 08:51:18 -07:00
Google DeepMind 3e9bc79b54 Adds color space to textures.
PiperOrigin-RevId: 761907261
Change-Id: Iec546d1d5907a15e57ef809ec31850640fc52915
2025-05-22 04:33:40 -07:00
Saran Tunyasuvunakool 1663867cba Add GL_EXT_texture_sRGB to MuJoCo's GLAD stubs.
PiperOrigin-RevId: 761025068
Change-Id: I9197f206666adf547aa5fcd0e06b54d7d4c415fa
2025-05-20 04:38:20 -07:00
Google DeepMind 40393f460a Fix shadow flickering artefacts on platforms that do not support ARB_clip_control.
PiperOrigin-RevId: 743112447
Change-Id: Ibb727685605c0a257547162703f61e5232ff544c
2025-04-02 06:34:27 -07:00
Google DeepMind ac2a324fbd Reduce "shadow acne" artifacts
PiperOrigin-RevId: 725640931
Change-Id: I95df97d6076b99c12e291f69e8e54bbe70538293
2025-02-11 08:28:12 -08:00
Yuval Tassa 893a993bf6 Fix typos.
PiperOrigin-RevId: 716211176
Change-Id: Ibadfe13db89ed9047832b977e918faa3c5c6d9f1
2025-01-16 06:28:54 -08:00
Yuval Tassa 5c23ae11ef Fix bug in material texrepeat attribute, fixes #2223.
Was mistakenly cast from float to int, bug introduced in 3.2.0

PiperOrigin-RevId: 697993181
Change-Id: I643a07e2b0866a4af56d7cbd3344e764a7caf56f
2024-11-19 06:30:55 -08:00
Kyle Bayes c168ac3397 Add source code links in docs for remaining API functions.
PiperOrigin-RevId: 692728907
Change-Id: I145eb47453e6aa017505d53d3e17215959252e3d
2024-11-03 11:09:56 -08:00
Kyle Bayes 2b0629d75f Replace mjQUICKSORT with faster, native sorting function. fixes #1638
PiperOrigin-RevId: 688519096
Change-Id: I05ab1576703c2458968ef81915ac682a8beac391
2024-10-22 06:05:12 -07:00
Alessio Quaglino 0e8c0b80eb add content_type to model in the XML schema.
PiperOrigin-RevId: 670961443
Change-Id: I98cd6bb61b50029cdd4f5b31e23d268989d136da
2024-09-04 07:25:55 -07:00
Taylor Howell 82c27165f2 mjQUICKSORT uses std::sort with C++.
fixes #1638

PiperOrigin-RevId: 660887790
Change-Id: Ia3b493feda98b246d963aa749bc81b96c42fddaa
2024-08-08 10:24:34 -07:00
Nimrod Gileadi 4dc8f884de Check for texid >= 0 before accessing texture arrays.
PiperOrigin-RevId: 659567553
Change-Id: Ia4aaa85b85e3f27e632c03a9f50b10894d29a97b
2024-08-05 08:47:50 -07:00
Tom Erez 33e5960653 Allow multiple textures per material in MJCF.
PiperOrigin-RevId: 654795013
Change-Id: I418b72533484d00accaf801a342aa183e602a2d0
2024-07-22 09:57:51 -07:00
Tom Erez 796173170c Add support in mjModel for tagging textures with different roles, and use the slot index of a texture to designate its role.
PiperOrigin-RevId: 654030065
Change-Id: I34a5b132a7f91a6bb8f260500c1b9c128a03b596
2024-07-19 09:29:22 -07:00
Tom Erez e92af73cbf Add mjmodel support for textures with different number of channels.
PiperOrigin-RevId: 653974959
Change-Id: Ia280e0bdb21027646249f104f21bedee792ba7e5
2024-07-19 05:22:19 -07:00
Tom Erez df7ea3ed33 Add support for multiple textures in one material (mjModel).
PiperOrigin-RevId: 648732764
Change-Id: I29b60dd62a069789a32017ff0d55e36b57e0052b
2024-07-02 08:50:23 -07:00
Tom Erez 3b73dfe33b Add textured materials to render context, and refactor mjvGeom to refer to those textures.
PiperOrigin-RevId: 648719103
Change-Id: Idb4425bdeea3cbc1133cda3e4366574ed3bb5ccc
2024-07-02 08:01:40 -07:00
Yuval Tassa 07fc95ca9a Add orthographic cameras.
Orthographic cameras are specified by setting the `orthographic` attribute of the `<camera>` element. The `fovy` attribute is still used to specify the field-of-view, but its semantic is different for orthographic cameras. For orthographic cameras, the field-of-view is expressed in units of length, rather than degrees.

Other related changes:

* Fix bug in the ordering of `cam_xxx` elements in `mjModel`.
* Make camera visualization translucent only when the frustum is visualized.
* Added a button to `simulate` to toggle between perspective and orthographic free cameras.

https://youtu.be/ZXBTEIDWHhs

PiperOrigin-RevId: 642293435
Change-Id: Id090a421ad88ab404b5b27ddbbd6bfc81ad49bc5
2024-06-11 09:23:18 -07:00
Nimrod Gileadi e3dc54f609 Emit only one warning about ARB_depth_buffer_float or ARB_clip_control.
This code was warning on every frame, which was unhelpful.

PiperOrigin-RevId: 604267726
Change-Id: Ied1d46e3d84d58f3b21201e3752e3c2d43ea3ba9
2024-02-05 03:36:23 -08:00
Yuval Tassa 38fa756a20 Add mjGEOM_LINEBOX, used in visualization of collision trees.
PiperOrigin-RevId: 591224734
Change-Id: I09ad8c4b711021ff4dd5548ba5381d25d5a3d7f8
2023-12-15 05:36:35 -08:00
Nimrod Gileadi e3df84ec3f Include the size limit in error message from mjr_addAux.
This is to help debug #1274.

PiperOrigin-RevId: 590215990
Change-Id: I356675be84f9cb2892d31d4dc7639adf49fe4a0f
2023-12-12 08:41:10 -08:00
Yuval Tassa b39cca725a Move headlight pos/dir computation from mjr_render to mjv_updateScene.
PiperOrigin-RevId: 586630110
Change-Id: Ia44ea944016ccfe081682375cdb975342695d826
2023-11-30 04:15:05 -08:00
Alessio Quaglino 1a47a97040 Disable shadows for geoms of category mjCAT_DECOR. Fixes #1114.
Added `frustum` to `rgba` and `scale` in the `visual` section.

PiperOrigin-RevId: 576547599
Change-Id: I69bf528680e3d4a59d6e04f6db99a6d345001d1d
2023-10-25 09:08:20 -07:00
Copybara-Service 59164702ab Merge pull request #978 from aftersomemath:depth-precision-in-place
PiperOrigin-RevId: 572961667
Change-Id: I69011ddf835ae286e30e7f84cca67867cfe94fa4
2023-10-12 11:18:36 -07:00
Saran Tunyasuvunakool 86859ad382 Restore shadows when flex is present.
PiperOrigin-RevId: 572936749
Change-Id: I57f8d486810767422bc2874433497eb5073bf63b
2023-10-12 09:58:59 -07:00
Alessio Quaglino 5a70ad08ab Add Flex component.
PiperOrigin-RevId: 572830650
Change-Id: I6908228087b7b9683be3506c8d9cdc725ed5dcd5
2023-10-12 10:49:35 +01:00
Levi Burner c6961b77d7 Fallback for if GL_ARB_clip_control not available
If GL_ARB_clip_control not available then [znear, zfar] -> [1, -1] instead of [1, 0] in normalized device coordinates

Thus, Z is still reversed, but not shifted, clipping should still work properly, and conversion to window coordinates does not cause accuracy regression compared to non-reversed Z rendering.
2023-10-02 18:30:57 -04:00
Yuval Tassa 177aec68dc Add overlay positions in the center of viewport edges, move PAUSE and LOADING... overlays to the top center.
PiperOrigin-RevId: 570054949
Change-Id: If0046df382e67ad3a48e7138a75e9e200c0626b9
2023-10-02 07:05:50 -07:00
Levi Burner 9e51f20ce2 More fixups to mjtDepthMap names 2023-09-29 19:53:58 -04:00
Levi Burner 56403b4dce Fixups to comments and flags for reversed Z rendering 2023-09-29 19:53:58 -04:00
Levi Burner 2e52bf807b Add flag to mjrContext to support legacy depth mapping by default 2023-09-29 19:53:57 -04:00
Levi Burner d32eb6bd12 In place change to reverse Z rendering and 32 bit float offscreen depth buffer 2023-09-29 19:53:47 -04:00
Levi Burner fc7b212369 Support reversed Z rendering and float32 offscreen depth buffer
Combined, both options greatly improve camera depth accuracy compared to
OpenGL default Z mapping and int24 depth buffer.

Requires GL_ARB_clip_control and ARB_depth_buffer_float extensions
2023-09-29 19:52:09 -04:00
Alessio Quaglino 36d2ffe4f2 Specify camera parameters using standard robotics conventions.
PiperOrigin-RevId: 569147555
Change-Id: I3443f95e5de56a17024f5e5c03f33888dd583edb
2023-09-28 05:19:19 -07:00
Yuval Tassa dfd48dd821 Replace mjMIN and mjMAX with mju_min and mju_max, where possible.
PiperOrigin-RevId: 566602924
Change-Id: I2d24183d0d9df3e647bb2d7d7544473582f38128
2023-09-19 05:40:41 -07:00
Saran Tunyasuvunakool 329ed193ac Disallow variable-length arrays and turn on -Wpedantic in Clang and GCC.
PiperOrigin-RevId: 562832747
Change-Id: I0532624cee31e089a47426305d885687eb0fc5c5
2023-09-05 11:05:04 -07:00
Alessio Quaglino fdb041580c Add Signed Distance Field to collision geometries.
PiperOrigin-RevId: 557507088
Change-Id: I358a642407aee1ba8dfc9d405eb9a4f609435fe9
2023-08-16 09:15:23 -07:00
Yuval Tassa d1c6561f1c Add spaces around comparison operators in render/ and ui/ source files.
PiperOrigin-RevId: 536001297
Change-Id: Ia0d97bf9f886aea03b8363e4d97e18301520909f
2023-05-28 07:04:49 -07:00