Add intensity and range parameters to lights.
PiperOrigin-RevId: 758603199 Change-Id: I74e88bdfeedd9224e84d953f237d68eca79e6cb7
This commit is contained in:
committed by
Copybara-Service
parent
a6c3a287d6
commit
fa95fe0c59
+57
-37
@@ -2866,11 +2866,15 @@ and the +Y axis points up. Thus the frame position and orientation are the key a
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This element creates a light, which moves with the body where it is defined. To create a fixed light, define it in the
|
||||
world body. The lights created here are in addition to the default headlight which is always defined and is adjusted via
|
||||
the :ref:`visual <visual>` element. MuJoCo relies on the standard lighting model in OpenGL (fixed functionality)
|
||||
augmented with shadow mapping. The effects of lights are additive, thus adding a light always makes the scene brighter.
|
||||
The maximum number of lights that can be active simultaneously is 8, counting the headlight. The light is shining along
|
||||
the direction specified by the dir attribute. It does not have a full spatial frame with three orthogonal axes.
|
||||
world body. The lights created here are in addition to the headlight which is always defined and is configured via the
|
||||
:ref:`visual <visual>` element. Lights shine along the direction specified by the dir attribute. They do not have
|
||||
a full spatial frame with three orthogonal axes.
|
||||
|
||||
By default, MuJoCo uses the standard OpenGL (fixed functional) Phong lighting model for its rendering, with augmented
|
||||
with shadow mapping. (See the OpenGL documentation for more information, including details about various attributes.)
|
||||
|
||||
MJCF also supports alternative lighting models (e.g. physically-based rendering) by providing additional attributes.
|
||||
Attributes may be applied or ignored depending on the lighting model being used.
|
||||
|
||||
|
||||
.. _body-light-name:
|
||||
@@ -2919,12 +2923,6 @@ the direction specified by the dir attribute. It does not have a full spatial fr
|
||||
these clipping planes bound the cone or box shadow volume in the light direction. As a result, some shadows
|
||||
(especially those very close to the light) may be clipped.
|
||||
|
||||
.. _body-light-bulbradius:
|
||||
|
||||
:at:`radius`: :at-val:`real, "0.02"`
|
||||
Radius of the light, affects shadow softness. This attribute has no effect in MuJoCo's native renderer, but it can be
|
||||
useful when rendering scenes with an external renderer.
|
||||
|
||||
.. _body-light-active:
|
||||
|
||||
:at:`active`: :at-val:`[false, true], "true"`
|
||||
@@ -2941,11 +2939,45 @@ the direction specified by the dir attribute. It does not have a full spatial fr
|
||||
:at:`dir`: :at-val:`real(3), "0 0 -1"`
|
||||
Direction of the light.
|
||||
|
||||
.. _body-light-diffuse:
|
||||
|
||||
:at:`diffuse`: :at-val:`real(3), "0.7 0.7 0.7"`
|
||||
The color of the light. For the Phong (default) lighting model, this defines the diffuse color of
|
||||
the light.
|
||||
|
||||
.. _body-light-intensity:
|
||||
|
||||
:at:`intensity`: :at-val:`real, "1000.0"`
|
||||
The intensity of the light source, measured in candela, used for physically-based lighting models.
|
||||
This is unused by the default Phong lighting model.
|
||||
|
||||
.. _body-light-ambient:
|
||||
|
||||
:at:`ambient`: :at-val:`real(3), "0 0 0"`
|
||||
The ambient color of the light, used by the default Phong lighting model.
|
||||
|
||||
.. _body-light-specular:
|
||||
|
||||
:at:`specular`: :at-val:`real(3), "0.3 0.3 0.3"`
|
||||
The specular color of the light, used by the default Phong lighting model.
|
||||
|
||||
.. _body-light-range:
|
||||
|
||||
:at:`range`: :at-val:`real, "10.0"`
|
||||
The effective range of the light. Objects further than this distance from the light position
|
||||
will not be illuminated by this light. This only applies to spotlights.
|
||||
|
||||
.. _body-light-bulbradius:
|
||||
|
||||
:at:`bulbradius`: :at-val:`real, "0.02"`
|
||||
The radius of the light source which can affect shadow softness depending on the
|
||||
renderer. This only applies to spotlights.
|
||||
|
||||
.. _body-light-attenuation:
|
||||
|
||||
:at:`attenuation`: :at-val:`real(3), "1 0 0"`
|
||||
These are the constant, linear and quadratic attenuation coefficients in OpenGL. The default corresponds to no
|
||||
attenuation. See the OpenGL documentation for more information on this and all other OpenGL-related properties.
|
||||
These are the constant, linear and quadratic attenuation coefficients for Phong lighting.
|
||||
The default corresponds to no attenuation.
|
||||
|
||||
.. _body-light-cutoff:
|
||||
|
||||
@@ -2957,22 +2989,6 @@ the direction specified by the dir attribute. It does not have a full spatial fr
|
||||
:at:`exponent`: :at-val:`real, "10"`
|
||||
Exponent for spotlights. This setting controls the softness of the spotlight cutoff.
|
||||
|
||||
.. _body-light-ambient:
|
||||
|
||||
:at:`ambient`: :at-val:`real(3), "0 0 0"`
|
||||
The ambient color of the light.
|
||||
|
||||
.. _body-light-diffuse:
|
||||
|
||||
:at:`diffuse`: :at-val:`real(3), "0.7 0.7 0.7"`
|
||||
The diffuse color of the light.
|
||||
|
||||
.. _body-light-specular:
|
||||
|
||||
:at:`specular`: :at-val:`real(3), "0.3 0.3 0.3"`
|
||||
The specular color of the light.
|
||||
|
||||
|
||||
.. _body-composite:
|
||||
|
||||
:el-prefix:`body/` |-| **composite** (*)
|
||||
@@ -8257,26 +8273,30 @@ if omitted.
|
||||
|
||||
.. _default-light-dir:
|
||||
|
||||
.. _default-light-bulbradius:
|
||||
|
||||
.. _default-light-directional:
|
||||
|
||||
.. _default-light-castshadow:
|
||||
|
||||
.. _default-light-active:
|
||||
|
||||
.. _default-light-diffuse:
|
||||
|
||||
.. _default-light-intensity:
|
||||
|
||||
.. _default-light-ambient:
|
||||
|
||||
.. _default-light-specular:
|
||||
|
||||
.. _default-light-bulbradius:
|
||||
|
||||
.. _default-light-range:
|
||||
|
||||
.. _default-light-attenuation:
|
||||
|
||||
.. _default-light-cutoff:
|
||||
|
||||
.. _default-light-exponent:
|
||||
|
||||
.. _default-light-ambient:
|
||||
|
||||
.. _default-light-diffuse:
|
||||
|
||||
.. _default-light-specular:
|
||||
|
||||
.. _default-light-mode:
|
||||
|
||||
:el-prefix:`default/` |-| **light** (?)
|
||||
|
||||
+8
-6
@@ -317,9 +317,11 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`active<body-light-active>` | :ref:`pos<body-light-pos>` | :ref:`dir<body-light-dir>` | :ref:`bulbradius<body-light-bulbradius>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`attenuation<body-light-attenuation>` | :ref:`cutoff<body-light-cutoff>` | :ref:`exponent<body-light-exponent>` | :ref:`ambient<body-light-ambient>` | |
|
||||
| | | | :ref:`intensity<body-light-intensity>` | :ref:`range<body-light-range>` | :ref:`attenuation<body-light-attenuation>` | :ref:`cutoff<body-light-cutoff>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`diffuse<body-light-diffuse>` | :ref:`specular<body-light-specular>` | :ref:`mode<body-light-mode>` | :ref:`target<body-light-target>` | |
|
||||
| | | | :ref:`exponent<body-light-exponent>` | :ref:`ambient<body-light-ambient>` | :ref:`diffuse<body-light-diffuse>` | :ref:`specular<body-light-specular>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`mode<body-light-mode>` | :ref:`target<body-light-target>` | | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| body |br| |_| |L| | | .. table:: |
|
||||
@@ -1457,13 +1459,13 @@
|
||||
| :ref:`light | ? | :class: mjcf-attributes |
|
||||
| <default-light>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`pos<default-light-pos>` | :ref:`dir<default-light-dir>` | :ref:`bulbradius<default-light-bulbradius>` | :ref:`directional<default-light-directional>` | |
|
||||
| | | | :ref:`pos<default-light-pos>` | :ref:`dir<default-light-dir>` | :ref:`bulbradius<default-light-bulbradius>` | :ref:`intensity<default-light-intensity>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`castshadow<default-light-castshadow>` | :ref:`active<default-light-active>` | :ref:`attenuation<default-light-attenuation>` | :ref:`cutoff<default-light-cutoff>` | |
|
||||
| | | | :ref:`range<default-light-range>` | :ref:`directional<default-light-directional>` | :ref:`castshadow<default-light-castshadow>` | :ref:`active<default-light-active>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`exponent<default-light-exponent>` | :ref:`ambient<default-light-ambient>` | :ref:`diffuse<default-light-diffuse>` | :ref:`specular<default-light-specular>` | |
|
||||
| | | | :ref:`attenuation<default-light-attenuation>` | :ref:`cutoff<default-light-cutoff>` | :ref:`exponent<default-light-exponent>` | :ref:`ambient<default-light-ambient>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`mode<default-light-mode>` | | | | |
|
||||
| | | | :ref:`diffuse<default-light-diffuse>` | :ref:`specular<default-light-specular>` | :ref:`mode<default-light-mode>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| default |br| |_| |L| | | .. table:: |
|
||||
|
||||
@@ -1178,6 +1178,8 @@ struct mjModel_ {
|
||||
mjtByte* light_directional; // directional light (nlight x 1)
|
||||
mjtByte* light_castshadow; // does light cast shadows (nlight x 1)
|
||||
float* light_bulbradius; // light radius for soft shadows (nlight x 1)
|
||||
float* light_intensity; // intensity, in candela (nlight x 1)
|
||||
float* light_range; // range of effectiveness (nlight x 1)
|
||||
mjtByte* light_active; // is light on (nlight x 1)
|
||||
mjtNum* light_pos; // position rel. to body frame (nlight x 3)
|
||||
mjtNum* light_dir; // direction rel. to body frame (nlight x 3)
|
||||
@@ -2030,7 +2032,9 @@ typedef struct mjsLight_ { // light specification
|
||||
mjtByte active; // is light active
|
||||
mjtByte directional; // is light directional or spot
|
||||
mjtByte castshadow; // does light cast shadows
|
||||
double bulbradius; // bulb radius, for soft shadows
|
||||
float bulbradius; // bulb radius, for soft shadows
|
||||
float intensity; // intensity, in candelas
|
||||
float range; // range of effectiveness
|
||||
float attenuation[3]; // OpenGL attenuation (quadratic model)
|
||||
float cutoff; // OpenGL cutoff
|
||||
float exponent; // OpenGL exponent
|
||||
@@ -2838,6 +2842,8 @@ struct mjvLight_ { // OpenGL light
|
||||
mjtByte directional; // directional light
|
||||
mjtByte castshadow; // does light cast shadows
|
||||
float bulbradius; // bulb radius for soft shadows
|
||||
float intensity; // intensity, in candelas
|
||||
float range; // range of effectiveness
|
||||
};
|
||||
typedef struct mjvLight_ mjvLight;
|
||||
struct mjvOption_ { // abstract visualization options
|
||||
@@ -3055,6 +3061,8 @@ struct mjvSceneState_ {
|
||||
mjtByte* light_directional;
|
||||
mjtByte* light_castshadow;
|
||||
float* light_bulbradius;
|
||||
float* light_intensity;
|
||||
float* light_range;
|
||||
mjtByte* light_active;
|
||||
float* light_attenuation;
|
||||
float* light_cutoff;
|
||||
|
||||
Reference in New Issue
Block a user