Spotlight

from panda3d.core import Spotlight
class Spotlight

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 attenuationLVecBase3
Getter

Returns 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.

Setter

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.

clearSpecularColor()None

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

property exponentfloat
Getter

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

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 getClassType()TypeHandle
getMaxDistance()float

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

static makeSpot(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.projectTexture()) 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_distancefloat
Getter

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

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.

setAttenuation(attenuation: LVecBase3)None

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.

setExponent(exponent: float)None

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.

setMaxDistance(max_distance: float)None

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.

setSpecularColor(color: LColor)None

Sets the color of specular highlights generated by the light.

property specular_colorLColor
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.