Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

GLTFLight

Inherits: Resource < RefCounted < Object

Represents a GLTF light.

Description

Represents a light as defined by the KHR_lights_punctual GLTF extension.

Tutorials

Properties

Color

color

Color(1, 1, 1, 1)

float

inner_cone_angle

0.0

float

intensity

1.0

String

light_type

""

float

outer_cone_angle

0.785398

float

range

inf

Methods

GLTFLight

from_dictionary ( Dictionary dictionary ) static

GLTFLight

from_node ( Light3D light_node ) static

Dictionary

to_dictionary ( ) const

Light3D

to_node ( ) const


Property Descriptions

Color color = Color(1, 1, 1, 1)

  • void set_color ( Color value )

  • Color get_color ( )

The Color of the light. Defaults to white. A black color causes the light to have no effect.


float inner_cone_angle = 0.0

  • void set_inner_cone_angle ( float value )

  • float get_inner_cone_angle ( )

The inner angle of the cone in a spotlight. Must be less than or equal to the outer cone angle.

Within this angle, the light is at full brightness. Between the inner and outer cone angles, there is a transition from full brightness to zero brightness. When creating a Godot SpotLight3D, the ratio between the inner and outer cone angles is used to calculate the attenuation of the light.


float intensity = 1.0

  • void set_intensity ( float value )

  • float get_intensity ( )

The intensity of the light. This is expressed in candelas (lumens per steradian) for point and spot lights, and lux (lumens per m²) for directional lights. When creating a Godot light, this value is converted to a unitless multiplier.


String light_type = ""

  • void set_light_type ( String value )

  • String get_light_type ( )

The type of the light. The values accepted by Godot are "point", "spot", and "directional", which correspond to Godot's OmniLight3D, SpotLight3D, and DirectionalLight3D respectively.


float outer_cone_angle = 0.785398

  • void set_outer_cone_angle ( float value )

  • float get_outer_cone_angle ( )

The outer angle of the cone in a spotlight. Must be greater than or equal to the inner angle.

At this angle, the light drops off to zero brightness. Between the inner and outer cone angles, there is a transition from full brightness to zero brightness. If this angle is a half turn, then the spotlight emits in all directions. When creating a Godot SpotLight3D, the outer cone angle is used as the angle of the spotlight.


float range = inf

  • void set_range ( float value )

  • float get_range ( )

The range of the light, beyond which the light has no effect. GLTF lights with no range defined behave like physical lights (which have infinite range). When creating a Godot light, the range is clamped to 4096.


Method Descriptions

GLTFLight from_dictionary ( Dictionary dictionary ) static

Creates a new GLTFLight instance by parsing the given Dictionary.


GLTFLight from_node ( Light3D light_node ) static

Create a new GLTFLight instance from the given Godot Light3D node.


Dictionary to_dictionary ( ) const

Serializes this GLTFLight instance into a Dictionary.


Light3D to_node ( ) const

Converts this GLTFLight instance into a Godot Light3D node.