property Light.exponent[source]#

Return or set the exponent of the cosine used for spotlights.

With a spotlight (a positional light with cone angle less than 90 degrees) the shape of the light beam within the light cone varies with the angle from the light’s axis, and the variation of the intensity depends as the cosine of this angle raised to an exponent, which is 1 by default. Increasing the exponent makes the beam sharper (more focused around the axis), decreasing it spreads the beam out.

Note that since the angular dependence defined by this property and the truncation performed by the cone_angle are independent, for spotlights with narrow beams (small cone_angle) it is harder to see the angular variation of the intensity, and a lot higher exponent might be necessary to visibly impact the angular distribution of the beam.


Plot three planes lit by three spotlights with exponents of 1, 2 and 5. The one with the lowest exponent has the broadest beam.

>>> import pyvista as pv
>>> plotter = pv.Plotter(lighting='none')
>>> for offset, exponent in zip([0, 1.5, 3], [1, 2, 5]):
...     _ = plotter.add_mesh(
...         pv.Plane((offset, 0, 0)), color='white'
...     )
...     light = pv.Light(
...         position=(offset, 0, 0.1),
...         focal_point=(offset, 0, 0),
...     )
...     light.exponent = exponent
...     light.positional = True
...     light.cone_angle = 80
...     plotter.add_light(light)
>>> plotter.view_xy()