pygfx.objects.DirectionalLight
- class pygfx.objects.DirectionalLight(color='#ffffff', intensity=3, *, cast_shadow=False, target=None, **kwargs)
Bases:
Light
Directional light source.
A light that gets emitted in a direction, specified by its position and a target. This is equivalent to an infinitely large softbox.
- Parameters:
color (Color) – The color of the light emitted.
intensity (float) – The light intensity. A value of
3
corresponds to a well lit scene.cast_shadow (bool) – If True, the light can cast shadows. Otherwise it doesn’t.
target (WorldObject) – The object used to determine the light’s direction. The light will shine from it’s position toward’s the direction of the target except when the light’s parent is a camera, in which case target is ignored.
Notes
If this light is attached to a camera it’s direction will follow the camera view direction.
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 target
The object to direct the light at. The light direction is from its position to its target.
However, if the light’s parent is a camera, it follows the camera direction instead (thus ignoring the target).