Commit Graph

53 Commits

Author SHA1 Message Date
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
Saran Tunyasuvunakool f887c1e928 Add ASAN and MSAN instrumentation for arena and mjData stack.
PiperOrigin-RevId: 535635490
Change-Id: Ia1e58771bae25bf72c861f57452fb8faa2b918fb
2023-05-26 09:17:26 -07:00
Saran Tunyasuvunakool b362cb4972 Expose a handle for the Python viewer.
This change also requires user scripts to explicitly synchronize changes to physics state to the viewer. The Simulate class was reconfigured so that certain UI events are handled during this sync operation, outside of the render loop on the main thread. These correspond to operations that require access to the full mjModel/mjData.

To support other, more interactive operations (e.g. camera movements), a new mjvSceneState struct is introduced which captures only the portion of the physics state required for scene re-rendering. The mjvSceneState is updated from mjModel/mjData during the viewer sync operation, and is significantly cheaper than a full mj_copyModel and mj_copyData.

Fixes https://github.com/deepmind/mujoco/issues/796

PiperOrigin-RevId: 525723636
Change-Id: Id08d0210a2c067d5afe85e2bf104f276aeddd75e
2023-04-20 05:59:19 -07:00
Nimrod Gileadi 145fe7f354 Declare loop variables inside for loop declaration where possible.
PiperOrigin-RevId: 518846098
Change-Id: Icdb2e5894bd80110552e29270472eeb242e6cf2c
2023-03-23 06:49:09 -07:00
Yuval Tassa fe18e58ad2 Rendering of mjGEOM_LINE respects size[0] (width argument of mjv_makeconnector), denominated in pixels.
- Before this change, line width was hardcoded to 3 pixels and the width argument of mjv_makeConnector was ignored.
- After this change, the width argument is respected and interpreted in units of pixel. The non-standard width unit is ok since lines can only be drawn programmatically.

PiperOrigin-RevId: 516529265
Change-Id: I27bffabba69cde415d2ada67263a887c9240efbf
2023-03-14 08:17:36 -07:00
Kyle Bayes d3d789cf7d Convert mju_error and mju_warning to variadic functions, supporting printf-like arguments. The functions mju_error_i, mju_error_s, mju_warning_i, and mju_warning_s are now deprecated.
PiperOrigin-RevId: 515431052
Change-Id: I440de0cb417ce216b6d636a5d86dc9ef6cc1fc06
2023-03-09 13:51:27 -08:00
Alessio Quaglino 9756ed0d80 Read normals and textures from OBJ, do not duplicate vertices.
PiperOrigin-RevId: 510461549
Change-Id: I19245d691e722a8371e61153383f275f599353d6
2023-02-17 10:15:25 -08:00
Saran Tunyasuvunakool 1215067f5c Add an option in mjrContext for mjr_readPixels output format.
PiperOrigin-RevId: 500342924
Change-Id: I43e8c6208db341e2bdbef10382b7293c35bdca65
2023-01-07 00:11:01 -08:00
Levi Burner 581f009c02 Cull face flag 2022-08-05 11:53:46 -04:00
Saran Tunyasuvunakool 807097148e Add internal-only API for creating mjrContext with custom offscreen FBO size.
PiperOrigin-RevId: 463048634
Change-Id: I195cbbf0e13a6c032e86070e8e4c11ad53af8a71
2022-07-25 03:47:02 -07:00