BakedLightmap

Inherits: VisualInstance < Spatial < Node < Object

Prerendered indirect light map for a scene.

Description

Baked lightmaps are an alternative workflow for adding indirect (or baked) lighting to a scene. Unlike the GIProbe approach, baked lightmaps work fine on low-end PCs and mobile devices as they consume almost no resources in run-time.

Note: This node has many known bugs and will be rewritten for Godot 4.0. See GitHub issue #30929.

Tutorials

Properties

floatbake_cell_size0.25
floatbake_default_texels_per_unit20.0
floatbake_energy1.0
Vector3bake_extentsVector3( 10, 10, 10 )
boolbake_hdrfalse
BakeModebake_mode0
floatbake_propagation1.0
BakeQualitybake_quality1
floatcapture_cell_size0.5
Stringimage_path“.”
BakedLightmapDatalight_data 

Methods

BakeErrorbake ( Node from_node=null, bool create_visual_debug=false )
voiddebug_bake ( )

Enumerations

enum BakeQuality:

  • BAKE_QUALITY_LOW = 0 —- The lowest bake quality mode. Fastest to calculate.
  • BAKE_QUALITY_MEDIUM = 1 —- The default bake quality mode.
  • BAKE_QUALITY_HIGH = 2 —- The highest bake quality mode. Takes longer to calculate.

enum BakeMode:

  • BAKE_MODE_CONE_TRACE = 0 —- Less precise but faster bake mode.
  • BAKE_MODE_RAY_TRACE = 1 —- More precise bake mode but can take considerably longer to bake.

enum BakeError:

  • BAKE_ERROR_OK = 0 —- Baking was successful.
  • BAKE_ERROR_NO_SAVE_PATH = 1 —- Returns if no viable save path is found. This can happen where an image_path is not specified or when the save location is invalid.
  • BAKE_ERROR_NO_MESHES = 2 —- Currently unused.
  • BAKE_ERROR_CANT_CREATE_IMAGE = 3 —- Returns when the baker cannot save per-mesh textures to file.
  • BAKE_ERROR_USER_ABORTED = 4 —- Returns if user cancels baking.

Property Descriptions

Default0.25
Setterset_bake_cell_size(value)
Getterget_bake_cell_size()

Grid subdivision size for lightmapper calculation. The default value will work for most cases. Increase for better lighting on small details or if your scene is very large.


  • float bake_default_texels_per_unit
Default20.0
Setterset_bake_default_texels_per_unit(value)
Getterget_bake_default_texels_per_unit()

If a Mesh.lightmap_size_hint isn’t specified, the lightmap baker will dynamically set the lightmap size using this value. This value is measured in texels per world unit. The maximum lightmap texture size is 4096x4096.


Default1.0
Setterset_energy(value)
Getterget_energy()

Multiplies the light sources’ intensity by this value. For instance, if the value is set to 2, lights will be twice as bright. If the value is set to 0.5, lights will be half as bright.


DefaultVector3( 10, 10, 10 )
Setterset_extents(value)
Getterget_extents()

The size of the affected area.


Defaultfalse
Setterset_hdr(value)
Getteris_hdr()

If true, the lightmap can capture light values greater than 1.0. Turning this off will result in a smaller file size.


Default0
Setterset_bake_mode(value)
Getterget_bake_mode()

Lightmapping mode. See BakeMode.


Default1.0
Setterset_propagation(value)
Getterget_propagation()

Defines how far the light will travel before it is no longer effective. The higher the number, the farther the light will travel. For instance, if the value is set to 2, the light will go twice as far. If the value is set to 0.5, the light will only go half as far.


Default1
Setterset_bake_quality(value)
Getterget_bake_quality()

Three quality modes are available. Higher quality requires more rendering time. See BakeQuality.


Default0.5
Setterset_capture_cell_size(value)
Getterget_capture_cell_size()

Grid size used for real-time capture information on dynamic objects. Cannot be larger than bake_cell_size.


Default“.”
Setterset_image_path(value)
Getterget_image_path()

The location where lightmaps will be saved.


Setterset_light_data(value)
Getterget_light_data()

The calculated light data.

Method Descriptions

Bakes the lightmaps within the currently edited scene. Returns a BakeError to signify if the bake was successful, or if unsuccessful, how the bake failed.


  • void debug_bake ( )

Executes a dry run bake of lightmaps within the currently edited scene.