Light#

class blueprints.Light[source]#

Bases: LightType, CyclicalThing, MoveableThing

This class is available through the shortcut blueprints.Light.

Most attribute descriptions are partially taken from Mujoco.

Attributes Summary

active

The light is active if this attribute is “true”.

ambient

The ambient color of the light (RGB).

attenuation

These are the constant, linear and quadratic attenuation coefficients in OpenGL.

castshadow

If this attribute is True the Light will cast shadows.

cutoff

Cutoff angle for spotlights in radians.

diffuse

The diffuse color of the light (RGB).

dir

Direction of the light.

directional

The light is directional if this attribute is “true”, otherwise it is a spotlight.

exponent

Exponent for spotlights.

mode

This argument works identically to blueprints.camera.Camera.mode.

specular

The specular color of the light (RGB).

target

The target attribute specifies a Body that is tracked by the camera.

Attributes Documentation

active#

The light is active if this attribute is “true”. This can be used at runtime to turn lights on and off.

Return type:

bool

ambient#

The ambient color of the light (RGB).

Return type:

np.ndarray

attenuation#

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.

Return type:

np.ndarray

castshadow#

If this attribute is True the Light will cast shadows. More precisely, the geoms illuminated by the light will cast shadows, however this is a property of Lights rather than geoms. Since each shadow-casting light causes one extra rendering pass through all geoms, this attribute should be used with caution.

Return type:

bool

cutoff#

Cutoff angle for spotlights in radians.

Return type:

float

diffuse#

The diffuse color of the light (RGB).

Return type:

np.ndarray

dir#

Direction of the light.

Return type:

np.ndarray

directional#

The light is directional if this attribute is “true”, otherwise it is a spotlight.

Return type:

bool

exponent#

Exponent for spotlights. This setting controls the softness of the spotlight cutoff.

Return type:

float

mode#

This argument works identically to blueprints.camera.Camera.mode. Possible values are:

  • 'fixed': Position and orientation will change w.r.t. the parents frame of reference.

  • 'track': Position is at a constant offset from the parent in world coordinates, while the camera orientation is constant in world coordinates.

  • 'trackcom': is similar to 'track' but the constant spatial offset is defined relative to the center of mass of the kinematic subtree starting at the parent Body. This can be used to keep an entire mechanism in view. Note that the subtree center of mass for the World is the center of mass of the entire model.

  • 'targetbody': the Camera position is fixed in the parent Body, while the Camera orientation is adjusted so that it always points towards the targeted Body (which is specified with the target attribute)

  • 'targetbodycom': is the same as 'targetbody' but the Camera is oriented towards the center of mass of the subtree starting at the target Cody.

Returns:

When setting this value manually, it must be one of those specified above, otherwise an error is raised.

Return type:

str

specular#

The specular color of the light (RGB).

Return type:

np.ndarray

target#

The target attribute specifies a Body that is tracked by the camera. Compatible mode values are (‘targetbody’, ‘targetbodycom’).

Return type:

blue.BodyType | None

__init__(pos=[0.0, 0.0, 0.0], dir=[0.0, 0.0, -1.0], attenuation=[1.0, 0.0, 0.0], ambient=[0.0, 0.0, 0.0], diffuse=[0.7, 0.7, 0.7], specular=[0.3, 0.3, 0.3], mode='fixed', directional=False, castshadow=True, active=True, cutoff=6.283185307179586, exponent=10.0, name=None, x=None, y=None, z=None, **kwargs)[source]#
Parameters:
  • pos (np.ndarray | list[int | float], optional) – Represents the position of the Light. Changing this attribute also changes the properties x, y and z.

  • dir (np.ndarray | list[int | float], optional) – Direction of the Light.

  • attenuation (np.ndarray | list[int | float], optional) – 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.

  • ambient (np.ndarray | list[int | float], optional) – The ambient color of the Light.

  • diffuse (np.ndarray | list[int | float], optional) – The diffuse color of the Light.

  • specular (np.ndarray | list[int | float], optional) – The specular color of the Light.

  • mode (str, optional) – The mode defines who the position and orientation is changed over time. See mode for a detailed description.

  • directional (bool, optional) – The light is directional if this attribute is True, otherwise it is a spotlight.

  • castshadow (bool, optional) – If this attribute is True the Light will cast shadows. More precisely, the geoms illuminated by the light will cast shadows, however this is a property of Lights rather than geoms. Since each shadow-casting light causes one extra rendering pass through all geoms, this attribute should be used with caution.

  • active (bool, optional) – The Light is active if this attribute is True. This can be used at runtime to turn Lights on and off.

  • cutoff (float, optional) – Cutoff angle for spotlights in radians.

  • exponent (float, optional) – Exponent for spotlights. This setting controls the softness of the spotlight cutoff.

  • name (str | None, optional) – The user specified name of the Camera. It might change in the case of a naming conflict.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • **kwargs – Keyword arguments are passed to super().__init__.

classmethod __new__(*args, **kwargs)#