Commit Graph

96 Commits

Author SHA1 Message Date
Haroon Qureshi a8545ac7cc Improve flex rendering.
RenderableManager is responsible for rendering the "skinned" flexes
which represent the correct "final" look of a flex. This now includes
1D flexes which are rendered as a sequence of capsules (similar to
tendons).

SceneDecorator is responsible for rendering the debug (unskinned)
versions of flexes. This includes the vertices (small spheres for each
vertex), edges (thin cynlinders for each edge), and faces (triangles
for each face, including sublayers).

PiperOrigin-RevId: 951595046
Change-Id: Iebc6fd7a747a602813b6457333bd9fa5915e28d3
2026-07-21 11:15:37 -07:00
Copybara-Service 7bfa10e1e2 Merge pull request #3354 from Nas01010101:fix/ktx-classic-renderer-skip
PiperOrigin-RevId: 951520219
Change-Id: Ib6a1a8c553140e2e6c99055a579facf51e0d7f5a
2026-07-21 09:01:02 -07:00
Copybara-Service b75470a1e0 Merge pull request #3387 from bd-pmorais:pmorais/renderer-live-mat-texid
PiperOrigin-RevId: 949427127
Change-Id: I607af41aefdefd6d22602889e6982d64df8b380b
2026-07-17 01:23:40 -07:00
Haroon Qureshi 3b63fbc6ba Correctly apply visibility state from mjvOption.
PiperOrigin-RevId: 948792559
Change-Id: Ic0357c7841519e8e5c903b45f045831745f0b2b3
2026-07-16 00:24:04 -07:00
Pedro Morais 0a6b631d4b Make change non-breaking per haroonq's feedback 2026-07-15 11:53:22 -04:00
Copybara-Service 6c78c8664e Merge pull request #3340 from devshahofficial:devshahofficial/mjr-renderer-info
PiperOrigin-RevId: 948183711
Change-Id: I28b256eca22e86ec0ba05a4fa26458d678aca130
2026-07-15 01:37:11 -07:00
Haroon Qureshi 94132c75c7 Remove dead code.
PiperOrigin-RevId: 946289927
Change-Id: I4dc493b522f33c281511a8e6ad407e734e50734f
2026-07-11 13:13:32 -07:00
Haroon Qureshi 40feb498a1 Clear material instance assignments at start of frame.
PiperOrigin-RevId: 945623848
Change-Id: I983efa6a14d25e2cb0f46b8bd529086d84247a50
2026-07-10 03:56:52 -07:00
Pedro Morais d43c3ed426 Move texture block copy out of render context so it can be modified online via mjmodel 2026-07-09 11:08:43 -04:00
devshahofficial d23ff84c59 Add renderer info query API 2026-07-07 11:44:46 -07:00
Haroon Qureshi 4ab8617429 Get mjrfContext from the ModelObjects.
PiperOrigin-RevId: 943888955
Change-Id: Icfe6230e531a100ad5a09efe582977fd3de8f076
2026-07-07 07:44:47 -07:00
Haroon Qureshi 6d02ee4756 Merge GetRenderable and GetSelectedRenderable
PiperOrigin-RevId: 943844092
Change-Id: Ia3888ea6c289d491ddb2fba0ea4f5799c367ef2c
2026-07-07 07:15:10 -07:00
Haroon Qureshi 10d6c01dce Increase filament buffer sizes.
PiperOrigin-RevId: 942496954
Change-Id: I9e53bf48b7c56cf76992140fc372d88c6d2a9752
2026-07-04 07:43:45 -07:00
Haroon Qureshi fb259a5edd Implement RenderableManager.
Similar to LightManager, the RenderableManager manages
renderables based on an mjModel and its mjData.

PiperOrigin-RevId: 941510745
Change-Id: I97b44cc857f136aa7c90ceb85a42e299fc759b73
2026-07-02 00:03:05 -07:00
Haroon Qureshi 79f6deac99 Update bounds when updating the mesh.
PiperOrigin-RevId: 938628053
Change-Id: Ibd3d952d62614fc1eb049893937e6fb2d661da56
2026-06-26 09:25:06 -07:00
Haroon Qureshi 07e292bc6b Make mjrf types opaque in header.
PiperOrigin-RevId: 938409081
Change-Id: I8b9680dcb04f56aadf9ffd601b08025fc624c656
2026-06-25 23:41:49 -07:00
Haroon Qureshi 3d09a46d61 Use bulbradius as the vsm_blur_width as well.
PiperOrigin-RevId: 937286692
Change-Id: I03502da45951f90979b8f8d58915c80656a5eac7
2026-06-24 06:00:31 -07:00
Haroon Qureshi 3e33f93ddc Remove unused material instances before rendering frame.
Also ensure material texture hashes are unique so that the material
cleanup works correctly.

PiperOrigin-RevId: 937206048
Change-Id: Ibed53457ee271f4faae3bcac5fb479b5ce9fc352
2026-06-24 02:46:33 -07:00
Haroon Qureshi 29b49991a2 Rename mjrf_getSamplerType to mjrf_getTextureSamplerType.
PiperOrigin-RevId: 937193469
Change-Id: I56f856e257fa1cf99b643f794139ef85817a0bb9
2026-06-24 02:18:07 -07:00
Anas ce025f0ec3 render: skip textures the classic renderer can't upload
KTX textures crash the classic OpenGL renderer and the Python viewer with
"Number of channels not supported: 1": mjCTexture::LoadKTX stores the file as
an opaque single-channel blob for the Filament renderer, and mjr_uploadTexture
aborts via mju_error because the classic path only handles 3- or 4-channel
textures.

Skip textures the classic renderer can't upload (nchannel not 3 or 4) with a
warning instead of aborting, so the model still loads and the other textures
render. LoadKTX and the Filament path are unchanged. The guard also covers the
cube/skybox path, which previously over-read a single-channel blob as RGB.

Add a render_test.py regression test that builds a model with a KTX texture and
constructs an MjrContext; it aborts before this change and passes after.

Addresses #3343.
2026-06-21 01:49:23 -04:00
Haroon Qureshi d93c102190 Move mjrfilament.h to mujoco/include.
PiperOrigin-RevId: 934931460
Change-Id: I63bf34b3a7197b277ea7a5caf3d84d840f6210a1
2026-06-19 08:01:05 -07:00
Haroon Qureshi 4ec843d70d Use int instead of mjtGeom for public API.
PiperOrigin-RevId: 934766146
Change-Id: Iefaf32834ecbe12fe03c932ff593153277fc8f48
2026-06-19 00:13:32 -07:00
Yuval Tassa e2afec9153 Make decorations lit, Rename unlit_decor material to decor.
PiperOrigin-RevId: 933693797
Change-Id: I37128b528296d978d4917ec65316d8d99ce017bb
2026-06-17 06:43:37 -07:00
Yuval Tassa e76afa7160 Reduce the opacity of the Filament selection outline.
PiperOrigin-RevId: 933665589
Change-Id: Ic55785568c0129c2f145bedc0cde7ec4bdc05dcf
2026-06-17 05:29:04 -07:00
Haroon Qureshi e1711529f2 Add RGBA8 support to RenderTarget::ReadColorPixels.
PiperOrigin-RevId: 933521511
Change-Id: Ic279fb8f86615cc4cfddef6ac27a502b22bafd79
2026-06-16 23:30:04 -07:00
Haroon Qureshi c0fa33f97f Rename mjrFilamentConfig to mjrfContextConfig.
PiperOrigin-RevId: 932996526
Change-Id: Ia81ee074471ab4ff41e0829fa5ba70203599fdb6
2026-06-16 03:36:22 -07:00
Haroon Qureshi ecee1e0c53 Rename nattributes to num_attributes for consistency.
PiperOrigin-RevId: 932973447
Change-Id: Idbf9a52c89e24f34ae360d1617cb72dfaa92aa4e
2026-06-16 02:40:13 -07:00
Copybara-Service c9ba1e452d Merge pull request #3338 from devshahofficial:devshahofficial/filament-emissive-factors
PiperOrigin-RevId: 932483570
Change-Id: If8ff968d2650551118a38ea4837063796bd85f66
2026-06-15 08:45:48 -07:00
Haroon Qureshi 7472440dbd Make mjrfilament.h conform to C standards.
PiperOrigin-RevId: 932424719
Change-Id: I1f8d8d91041ea1c2b77010761404bf0e519bcc29
2026-06-15 06:33:18 -07:00
Haroon Qureshi 9e45ce9801 Use num_ prefix consistently in API.
PiperOrigin-RevId: 932391786
Change-Id: I71c7f300fdb84ce1129ea3da6336df2fcffc5712
2026-06-15 05:08:34 -07:00
devshahofficial 7646a56e82 Fix Filament emissive material factors 2026-06-13 15:58:30 -07:00
Haroon Qureshi 2c125dd447 Add Update function to LightManager.
PiperOrigin-RevId: 931152006
Change-Id: I6fe5d4ab0dbc8032fe84fd12968666d755d1d7d5
2026-06-12 07:58:43 -07:00
Haroon Qureshi 01d5be61e3 Move ModelObjects and LightManager to filament/support.
PiperOrigin-RevId: 931136854
Change-Id: I3ce3b7265c5d3c9a49fa84be46e87a76c6e2c8b5
2026-06-12 07:18:07 -07:00
Haroon Qureshi 96781fa793 Move filament renderer out of experimental into src/render/filament.
Also:
- renames the main header file to mjrfilament.h.
- moves filament_util under a "support" folder.
PiperOrigin-RevId: 930448415
Change-Id: Iad89756aaf1ddf4c3e67e1afc3a13776f71fa20f
2026-06-11 04:43:20 -07:00
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