pygfx.objects.Light

class pygfx.objects.Light(color='#ffffff', intensity=1, *, cast_shadow=False, **kwargs)

Bases: WorldObject

Light Base Class.

Parameters:
  • color (Color) – The color of the light emitted.

  • intensity (float) – The light’s intensity. Its units depend on the type of light. For point and spot lights it represents the luminous intensity of the light measured in candela (cd).

  • cast_shadow (bool) – If True, the light can cast shadows. Otherwise it doesn’t.

Notes

The light’s intensity scales the color in the physical colorspace, as if scaling the number of photons. Note that an intensity of 0.5 is not equivalent to halving the color value. This is because the srgb color is perceptually linear, while intensity is physically linear. Values over 1.0 make perfect sense - it’s just a brighter light.

There are two booleans that control the behavior of shadow: cast_shadow on a Light, and receive_shadow on the illuminated object. Shadows will only be displayed if both are set to True.

property shadow

The shadow object for this light.

property color

The color of the light, in the srgb colorspace.

property intensity

The light intensity as a float, default 1.0. The units of intensity depend on the type of light. For point and spot lights it represents the luminous intensity of the light measured in candela (cd).

The intensity scales the color in the physical colorspace, as if scaling the number of photons. Note that an intensity of 0.5 is not equivalent to halving the color value. This is because the srgb color is perceptually linear, while intensity is physically linear. Values over 1.0 make perfect sense - it’s just a brighter light.

property cast_shadow

Whether or not this light will casts shadows on objects. Note that shadows are only cast on objects that have receive_shadow set to True.