Spotlight

from panda3d.core import Spotlight
class Spotlight

Bases:

Bases: LightLensNode

A light originating from a single point in space, and shining in a particular direction, with a cone-shaped falloff.

The Spotlight frustum is defined using a Lens, so it can have any of the properties that a camera lens can have.

Note that the class is named Spotlight instead of SpotLight, because “spotlight” is a single English word, instead of two words.

Inheritance diagram

Inheritance diagram of Spotlight

__init__(name: str)
property attenuation LVecBase3

Returns/Sets the terms of the attenuation equation for the light. These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

clear_specular_color()

Clears a custom specular color setting, meaning that the specular color will now come from the color.

property exponent float
Getter

Returns the exponent that controls the amount of light falloff from the center of the spotlight. See set_exponent().

Setter

Sets the exponent that controls the amount of light falloff from the center of the spotlight. The light is attenuated by the cosine of the angle between the direction of the light and the direction of the point being lighted, raised to the power of this exponent. Thus, higher exponents result in a more focused light source, regardless of the field-of-view of the lens.

static get_class_type() TypeHandle
get_max_distance() float

Returns the maximum distance at which the light has any effect, as previously specified by set_max_distance().

static make_spot(pixel_width: int, full_radius: float, fg: LColor, bg: LColor) Texture

Returns a newly-generated Texture that renders a circular spot image as might be cast from the spotlight. This may be projected onto target geometry (for instance, via NodePath.project_texture()) instead of actually enabling the light itself, as a cheesy way to make a high- resolution spot appear on the geometry.

pixel_width specifies the height and width of the new texture in pixels, full_radius is a value in the range 0..1 that indicates the relative size of the fully bright center spot, and fg and bg are the colors of the interior and exterior of the spot, respectively.

property max_distance float
Getter

Returns the maximum distance at which the light has any effect, as previously specified by set_max_distance().

Setter

Sets the radius of the light’s sphere of influence. Beyond this distance, the light may be attenuated to zero, if this is supported by the shader.

set_attenuation(attenuation: LVecBase3)

Sets the terms of the attenuation equation for the light. These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

set_exponent(exponent: float)

Sets the exponent that controls the amount of light falloff from the center of the spotlight. The light is attenuated by the cosine of the angle between the direction of the light and the direction of the point being lighted, raised to the power of this exponent. Thus, higher exponents result in a more focused light source, regardless of the field-of-view of the lens.

set_max_distance(max_distance: float)

Sets the radius of the light’s sphere of influence. Beyond this distance, the light may be attenuated to zero, if this is supported by the shader.

set_specular_color(color: LColor)

Sets the color of specular highlights generated by the light.

property specular_color LColor
Getter

Returns the color of specular highlights generated by the light. This is usually the same as get_color().

Setter

Sets the color of specular highlights generated by the light.