Add ability to specify a material assignment to a mesh asset.
This extends both the spec and the XML definition to allow specification of a material name on a mesh. This material acts as a fallback in the case that the referencing geom element does not specify a material of it's own. PiperOrigin-RevId: 798232378 Change-Id: Iaf300c727732744ea1b613e64334ee505ac6e209
This commit is contained in:
committed by
Copybara-Service
parent
42d8454555
commit
1fb1810b07
+14
-7
@@ -1424,6 +1424,11 @@ The full list of processing steps applied by the compiler to each mesh is as fol
|
||||
The parameters used to generate a builtin mesh. The number and type of parameters and their semantic depends on the
|
||||
mesh type. See :ref:`mesh/builtin<asset-mesh-builtin>` for details.
|
||||
|
||||
.. _asset-mesh-material:
|
||||
|
||||
:at:`material`: :at-val:`string, optional`
|
||||
Fallback material for mesh geoms that do not specify their own material.
|
||||
|
||||
.. _mesh-plugin:
|
||||
|
||||
:el-prefix:`mesh/` |-| **plugin** (?)
|
||||
@@ -2553,13 +2558,15 @@ helps clarify the role of bodies and geoms in MuJoCo.
|
||||
.. _body-geom-material:
|
||||
|
||||
:at:`material`: :at-val:`string, optional`
|
||||
If specified, this attribute applies a material to the geom. The material determines the visual properties of the
|
||||
geom. The only exception is color: if the rgba attribute below is different from its internal default, it takes
|
||||
precedence while the remaining material properties are still applied. Note that if the same material is referenced
|
||||
from multiple geoms (as well as sites and tendons) and the user changes some of its properties at runtime, these
|
||||
changes will take effect immediately for all model elements referencing the material. This is because the compiler
|
||||
saves the material and its properties as a separate element in mjModel, and the elements using this material only
|
||||
keep a reference to it.
|
||||
If specified, this attribute applies a material to the geom. Otherwise, if unspecified and the type of the geom is
|
||||
a **mesh** the compiler will apply the mesh asset :ref:`material <asset-mesh-material>` if present.
|
||||
|
||||
The material determines the visual properties of the geom. The only exception is color: if the rgba attribute below
|
||||
is different from its internal default, it takes precedence while the remaining material properties are still
|
||||
applied. Note that if the same material is referenced from multiple geoms (as well as sites and tendons) and the user
|
||||
changes some of its properties at runtime, these changes will take effect immediately for all model elements
|
||||
referencing the material. This is because the compiler saves the material and its properties as a separate element in
|
||||
mjModel, and the elements using this material only keep a reference to it.
|
||||
|
||||
.. _body-geom-rgba:
|
||||
|
||||
|
||||
@@ -105,6 +105,8 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`maxhullvert<asset-mesh-maxhullvert>` | :ref:`inertia<asset-mesh-inertia>` | :ref:`builtin<asset-mesh-builtin>` | :ref:`params<asset-mesh-params>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`material<asset-mesh-material>` | | | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_2| mesh |br| |_2| |L| | | .. table:: |
|
||||
| :ref:`plugin | \* | :class: mjcf-attributes |
|
||||
|
||||
@@ -31,6 +31,9 @@ General
|
||||
- Added support for shells with a curved reference configuration. See this `example
|
||||
<https://github.com/google-deepmind/mujoco/blob/main/model/flex/basket.xml>`__.
|
||||
|
||||
- Added support for assigning a default material to a mesh asset using the :ref:`mesh/material <asset-mesh-material>`
|
||||
attribute.
|
||||
|
||||
MJX
|
||||
^^^
|
||||
- Promote ``ten_length`` to the public MJX API. Add Warp support for ``mjx.tendon``.
|
||||
|
||||
@@ -2144,6 +2144,7 @@ typedef struct mjsMesh_ { // mesh specification
|
||||
mjIntVec* userface; // user vertex indices
|
||||
mjIntVec* userfacetexcoord; // user texcoord indices
|
||||
mjsPlugin plugin; // sdf plugin
|
||||
mjString* material; // name of material
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsMesh;
|
||||
typedef struct mjsHField_ { // height field specification
|
||||
|
||||
Reference in New Issue
Block a user