# panda3d.core.Light¶

from panda3d.core import Light

class Light

The abstract interface to all kinds of lights. The actual light objects also inherit from PandaNode, and can therefore be added to the scene graph at some arbitrary point to define the coordinate system of effect.

Inheritance diagram

asNode() → PandaNode
Return type

PandaNode

isAmbientLight() → bool

Returns true if this is an AmbientLight, false if it is some other kind of light.

getColor() → LColor

Returns the basic color of the light.

Return type

LColor

setColor(color: LColor) → None

Sets the basic color of the light.

hasColorTemperature() → bool

Returns true if the color was specified as a temperature in kelvins, and get_color_temperature is defined.

New in version 1.10.0.

getColorTemperature() → float

Returns the basic color temperature of the light, assuming hasColorTemperature() returns true.

New in version 1.10.0.

setColorTemperature(temperature: float) → None

Sets the color temperature of the light in kelvins. This will recalculate the light’s color.

The default value is 6500 K, corresponding to a perfectly white light assuming a D65 white point.

New in version 1.10.0.

getExponent() → float

For spotlights, returns the exponent that controls the amount of light falloff from the center of the spotlight. For other kinds of lights, returns 0.

getSpecularColor() → LColor

Returns the color of specular highlights generated by the light. This value is meaningless for ambient lights.

Return type

LColor

getAttenuation() → LVecBase3

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.

Return type

LVecBase3

setPriority(priority: int) → None

Changes the relative importance of this light relative to the other lights that are applied simultaneously.

The priority number is used to decide which of the requested lights are to be selected for rendering when more lights are requested than the hardware will support. The highest-priority n lights are selected for rendering.

This is similar to TextureStage.setPriority().

getPriority() → int

Returns the priority associated with this light. See setPriority().

getClassPriority() → int
static getClassType() → TypeHandle
Return type

TypeHandle

property color
Getter

Returns the basic color of the light.

Setter

Sets the basic color of the light.

Return type

LColor

property color_temperature
Getter

Returns the basic color temperature of the light, assuming hasColorTemperature() returns true.

New in version 1.10.0.

Setter

Sets the color temperature of the light in kelvins. This will recalculate the light’s color.

The default value is 6500 K, corresponding to a perfectly white light assuming a D65 white point.

New in version 1.10.0.

Return type

float

property priority
Getter

Returns the priority associated with this light. See setPriority().

Setter

Changes the relative importance of this light relative to the other lights that are applied simultaneously.

The priority number is used to decide which of the requested lights are to be selected for rendering when more lights are requested than the hardware will support. The highest-priority n lights are selected for rendering.

This is similar to TextureStage.setPriority().

Return type

int