Skip to content

pytha.create_point_light_source

fabian-flassig edited this page May 21, 2026 · 1 revision

Creates a new point light source in PYTHA as a new part at the given position. Depending on the flags in options, the same function also creates spot lights, extended (area-style) lights and infinite (directional) lights.

Similar to the Lights -> Point Light function in the PYTHA user interface.

pytha.create_point_light_source(position [,options])
Parameter Type Description
position {x,y,z} Position of the light source
options {...} Optional: a table that may contain the following options:
options.aperture number Cone aperture in degrees, in [0, 180]. Only used if spot = true
options.cast_shadow boolean Whether this light casts shadows
options.color_srgb {r,g,b} Light color as sRGB, each component in [0,1]
options.color_temperature number Color temperature in Kelvin. 0 means no color temperature is applied (the color_srgb value is used instead)
options.direction {x,y,z} Light direction. Defaults to {0,0,-1}. Only used for spot and infinite lights
options.extended boolean true makes the light an area-style (extended) light source with a finite radius
options.infinite boolean true makes the light an infinite (directional) light
options.intensity number Light intensity, >= 0
options.name string Name of the new part (UTF-8)
options.radius number Radius of the light source. Only used if extended = true
options.spot boolean true makes the light a spot light (uses direction and aperture)
options.state boolean true switches the light on, false off

The light type is composed from the spot, extended and infinite flags. All three are independent and may be combined.

Return value

Type Description
element_handle An element handle of the newly created light source part

Version Support:

Minimum PYTHA Version: V26

See also:

pytha, element handles, set_element_face_light

Clone this wiki locally