From 9db9df7380cd679480906756b6512e4707c154f3 Mon Sep 17 00:00:00 2001 From: Nimrod Gileadi Date: Tue, 6 Aug 2024 04:20:07 -0700 Subject: [PATCH] Increase material count limit to 1000. The texture limit used to be 1000, but when materials with multiple textures were introduced in 3.2.0, the limit was reduced to 100. Since there are model out there that already have more than 100 and fewer than 1000 textures/materials, we should maintain backwards compat. Fixes #1877 PiperOrigin-RevId: 659901629 Change-Id: If0f6d0500d1d808bc3ec2d87d4a3faf24007da59 --- doc/changelog.rst | 16 +++++++++------- include/mujoco/mjrender.h | 4 ++-- introspect/structs.py | 10 +++++----- unity/Runtime/Bindings/MjBindings.cs | 14 +++++++------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 721d968a..b5cc4caf 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -13,23 +13,25 @@ General 3. Added sub-elements to the MJCF :ref:`material` element, to allow specification of multiple textures for rendering (e.g., :ref:`occlusion-roughness-metallic`). Note that the MuJoCo renderer doesn't support these new features, and they are made available for use with external renderers. +4. Increase texture and material limit back to 1000. 3.2.0 inadvertently reduced this limit to 100, breaking some + existing models (:github:issue:`1877`). MJX ^^^ -4. Added more fields to ``mjx.Model`` and ``mjx.Data`` for further compatibility with the corresponding MuJoCo structs. -5. Added support for :ref:`fixed tendons `. -6. Added support for tendon length limits (``mjCNSTR_LIMIT_TENDON`` in :ref:`mjtConstraint`). -7. Added support for tendon equality constraints (``mjEQ_TENDON`` in :ref:`mjtEq`). -8. Added support for tendon actuator transmission (``mjTRN_TENDON`` in :ref:`mjtTrn`). +5. Added more fields to ``mjx.Model`` and ``mjx.Data`` for further compatibility with the corresponding MuJoCo structs. +6. Added support for :ref:`fixed tendons `. +7. Added support for tendon length limits (``mjCNSTR_LIMIT_TENDON`` in :ref:`mjtConstraint`). +8. Added support for tendon equality constraints (``mjEQ_TENDON`` in :ref:`mjtEq`). +9. Added support for tendon actuator transmission (``mjTRN_TENDON`` in :ref:`mjtTrn`). Python bindings ^^^^^^^^^^^^^^^ -9. Added support for asset dictionary argument in ``mujoco.spec.from_file``, ``mujoco.spec.from_string`` and +10. Added support for asset dictionary argument in ``mujoco.spec.from_file``, ``mujoco.spec.from_string`` and ``mujoco.spec.compile``. Bug fixes ^^^^^^^^^ -10. Fixed a bug where implicit integrators did not take into account disabled actuators (:github:issue:`1838`). +11. Fixed a bug where implicit integrators did not take into account disabled actuators (:github:issue:`1838`). Version 3.2.0 (Jul 15, 2024) ---------------------------- diff --git a/include/mujoco/mjrender.h b/include/mujoco/mjrender.h index 020ecc5d..ff9dbe34 100644 --- a/include/mujoco/mjrender.h +++ b/include/mujoco/mjrender.h @@ -22,8 +22,8 @@ extern "C" { #endif #define mjNAUX 10 // number of auxiliary buffers -#define mjMAXTEXTURE 100 // maximum number of textures -#define mjMAXMATERIAL 100 // maximum number of materials with textures +#define mjMAXTEXTURE 1000 // maximum number of textures +#define mjMAXMATERIAL 1000 // maximum number of materials with textures //---------------------------------- primitive types (mjt) ----------------------------------------- diff --git a/introspect/structs.py b/introspect/structs.py index 5c00f51e..1348f5a1 100644 --- a/introspect/structs.py +++ b/introspect/structs.py @@ -7967,7 +7967,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ name='mat_texid', type=ArrayType( inner_type=ValueType(name='int'), - extents=(1000,), + extents=(10000,), ), doc='material texture ids (-1: no texture)', ), @@ -7975,7 +7975,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ name='mat_texuniform', type=ArrayType( inner_type=ValueType(name='int'), - extents=(100,), + extents=(1000,), ), doc='texture repetition for 2d mapping', ), @@ -7983,7 +7983,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ name='mat_texrepeat', type=ArrayType( inner_type=ValueType(name='int'), - extents=(200,), + extents=(2000,), ), doc='texture repetition for 2d mapping', ), @@ -7996,7 +7996,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ name='textureType', type=ArrayType( inner_type=ValueType(name='int'), - extents=(100,), + extents=(1000,), ), doc='type of texture (mjtTexture) (ntexture)', ), @@ -8004,7 +8004,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ name='texture', type=ArrayType( inner_type=ValueType(name='unsigned int'), - extents=(100,), + extents=(1000,), ), doc='texture names', ), diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index d5cf1a77..e9d70b2d 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -54,8 +54,8 @@ public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJPLUGIN_H_ = true; public const bool mjEXTERNC = true; public const bool THIRD_PARTY_MUJOCO_MJRENDER_H_ = true; public const int mjNAUX = 10; -public const int mjMAXTEXTURE = 100; -public const int mjMAXMATERIAL = 100; +public const int mjMAXTEXTURE = 1000; +public const int mjMAXMATERIAL = 1000; public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJSPEC_H_ = true; public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJTHREAD_H_ = true; public const int mjMAXTHREAD = 128; @@ -5644,12 +5644,12 @@ public unsafe struct mjrContext_ { public fixed uint auxFBO_r[10]; public fixed uint auxColor[10]; public fixed uint auxColor_r[10]; - public fixed int mat_texid[1000]; - public fixed int mat_texuniform[100]; - public fixed int mat_texrepeat[200]; + public fixed int mat_texid[10000]; + public fixed int mat_texuniform[1000]; + public fixed int mat_texrepeat[2000]; public int ntexture; - public fixed int textureType[100]; - public fixed uint texture[100]; + public fixed int textureType[1000]; + public fixed uint texture[1000]; public uint basePlane; public uint baseMesh; public uint baseHField;