pyvista.Light.light_type#
- property Light.light_type[source]#
Return or set the light type.
The default light type is a scene light which lives in world coordinate space.
A headlight is attached to the camera and always points at the camera’s focal point.
A camera light also moves with the camera, but it can have an arbitrary relative position to the camera. Camera lights are defined in a coordinate space where the camera is located at (0, 0, 1), looking towards (0, 0, 0) at a distance of 1, with up being (0, 1, 0). Camera lights use the transform matrix to establish this space, i.e. they have a fixed
position
with respect to the camera, and moving the camera only affects theworld_position
via changes in thetransform_matrix
(and the same goes for the focal point).The property returns class constant values from an enum:
Light.HEADLIGHT == 1
Light.CAMERA_LIGHT == 2
Light.SCENE_LIGHT == 3
If setting the value, either an integer code or a class constant enum value must be used.
Examples
Check the type of lights for the first two lights of the default light kit of plotters.
>>> import pyvista as pv >>> plotter = pv.Plotter() >>> lights = plotter.renderer.lights[:2] >>> [light.light_type for light in lights] [<LightType.HEADLIGHT: 1>, <LightType.CAMERA_LIGHT: 2>]
Change the light type of the default light kit’s headlight to a scene light.
>>> import pyvista as pv >>> plotter = pv.Plotter() >>> lights = plotter.renderer.lights[:2] >>> lights[0].light_type = pv.Light.SCENE_LIGHT >>> [light.light_type for light in lights] [<LightType.SCENE_LIGHT: 3>, <LightType.CAMERA_LIGHT: 2>]