Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- AudioListener3D
- AudioStreamPlayer3D
- BoneAttachment3D
- Camera3D (1)
- CollisionObject3D (2)
- CollisionPolygon3D
- CollisionShape3D
- GridMap
- ImporterMeshInstance3D
- Joint3D (5)
- LightmapProbe
- Marker3D
- NavigationLink3D
- NavigationObstacle3D
- NavigationRegion3D
- OpenXRCompositionLayer (3)
- OpenXRHand
- Path3D
- PathFollow3D
- RayCast3D
- RemoteTransform3D
- ShapeCast3D
- Skeleton3D
- SkeletonModifier3D (7)
- SpringArm3D
- SpringBoneCollision3D (3)
- VehicleWheel3D
- VisualInstance3D (13)
- XRFaceModifier3D
- XRNode3D (2)
- XROrigin3D
- Decal
- FogVolume
- GPUParticlesAttractor3D (3)
- GPUParticlesCollision3D (4)
- GeometryInstance3D (7)
- Light3D (3)
- LightmapGI
- OccluderInstance3D
- OpenXRVisibilityMask
- ReflectionProbe
- RootMotionView
- VisibleOnScreenNotifier3D (1)
- VoxelGI
Table of contents
-
var bias: float = 0.0005 -
var bounce_indirect_energy: float = 1.0 -
var bounces: int = 3 -
var camera_attributes: CameraAttributes -
var denoiser_range: int = 10 -
var denoiser_strength: float = 0.1 -
var directional: bool = false -
var environment_custom_color: Color = Color(1, 1, 1, 1) -
var environment_custom_energy: float = 1.0 -
var environment_custom_sky: Sky -
var environment_mode = ENVIRONMENT_MODE_SCENE -
var generate_probes_subdiv = GENERATE_PROBES_SUBDIV_8 -
var interior: bool = false -
var light_data: LightmapGIData -
var max_texture_size: int = 16384 -
var quality = BAKE_QUALITY_MEDIUM -
var shadowmask_mode = SHADOWMASK_MODE_NONE -
var supersampling: bool = false -
var supersampling_factor: float = 2.0 -
var texel_scale: float = 1.0 -
var use_denoiser: bool = true -
var use_texture_for_bounces: bool = true -
const BAKE_QUALITY_LOW = 0 enum BakeQuality -
const BAKE_QUALITY_MEDIUM = 1 enum BakeQuality -
const BAKE_QUALITY_HIGH = 2 enum BakeQuality -
const BAKE_QUALITY_ULTRA = 3 enum BakeQuality -
const GENERATE_PROBES_DISABLED = 0 enum GenerateProbes -
const GENERATE_PROBES_SUBDIV_4 = 1 enum GenerateProbes -
const GENERATE_PROBES_SUBDIV_8 = 2 enum GenerateProbes -
const GENERATE_PROBES_SUBDIV_16 = 3 enum GenerateProbes -
const GENERATE_PROBES_SUBDIV_32 = 4 enum GenerateProbes -
const BAKE_ERROR_OK = 0 enum BakeError -
const BAKE_ERROR_NO_SCENE_ROOT = 1 enum BakeError -
const BAKE_ERROR_FOREIGN_DATA = 2 enum BakeError -
const BAKE_ERROR_NO_LIGHTMAPPER = 3 enum BakeError -
const BAKE_ERROR_NO_SAVE_PATH = 4 enum BakeError -
const BAKE_ERROR_NO_MESHES = 5 enum BakeError -
const BAKE_ERROR_MESHES_INVALID = 6 enum BakeError -
const BAKE_ERROR_CANT_CREATE_IMAGE = 7 enum BakeError -
const BAKE_ERROR_USER_ABORTED = 8 enum BakeError -
const BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL = 9 enum BakeError -
const BAKE_ERROR_LIGHTMAP_TOO_SMALL = 10 enum BakeError -
const BAKE_ERROR_ATLAS_TOO_SMALL = 11 enum BakeError -
const ENVIRONMENT_MODE_DISABLED = 0 enum EnvironmentMode -
const ENVIRONMENT_MODE_SCENE = 1 enum EnvironmentMode -
const ENVIRONMENT_MODE_CUSTOM_SKY = 2 enum EnvironmentMode -
const ENVIRONMENT_MODE_CUSTOM_COLOR = 3 enum EnvironmentMode -
enum BakeQuality -
enum GenerateProbes -
enum BakeError -
enum EnvironmentMode
LightmapGI #
is_instantiable, Node3D, Node, core, not_builtin_classes
Computes and stores baked lightmaps for fast global illumination.
The LightmapGI node is used to compute and store baked lightmaps. Lightmaps are used to provide high-quality indirect lighting with very little light leaking. LightmapGI can also provide rough reflections using spherical harmonics if directional is enabled. Dynamic objects can receive indirect lighting thanks to light probes, which can be automatically placed by setting generate_probes_subdiv to a value other than GENERATE_PROBES_DISABLED. Additional lightmap probes can also be added by creating LightmapProbe nodes. The downside is that lightmaps are fully static and cannot be baked in an exported project. Baking a LightmapGI node is also slower compared to VoxelGI.
Procedural generation: Lightmap baking functionality is only available in the editor. This means LightmapGI is not suited to procedurally generated or user-built levels. For procedurally generated or user-built levels, use VoxelGI or SDFGI instead (see Environment.sdfgi_enabled).
Performance: LightmapGI provides the best possible run-time performance for global illumination. It is suitable for low-end hardware including integrated graphics and mobile devices.
Note: Due to how lightmaps work, most properties only have a visible effect once lightmaps are baked again.
Note: Lightmap baking on CSGShape3Ds and PrimitiveMeshes is not supported, as these cannot store UV2 data required for baking.
Note: If no custom lightmappers are installed, LightmapGI can only be baked from devices that support the Forward+ or Mobile renderers.
Note: The LightmapGI node only bakes light data for child nodes of its parent. Nodes further up the hierarchy of the scene will not be baked.
Members #
var bias: float = 0.0005#
The bias to use when computing shadows. Increasing bias can fix shadow acne on the resulting baked lightmap, but can introduce peter-panning (shadows not connecting to their casters). Real-time Light3D shadows are not affected by this bias property.
var bounce_indirect_energy: float = 1.0#
The energy multiplier for each bounce. Higher values will make indirect lighting brighter. A value of 1.0 represents physically accurate behavior, but higher values can be used to make indirect lighting propagate more visibly when using a low number of bounces. This can be used to speed up bake times by lowering the number of bounces then increasing bounce_indirect_energy.
Note: bounce_indirect_energy only has an effect if bounces is set to a value greater than or equal to 1.
var bounces: int = 3#
Number of light bounces that are taken into account during baking. Higher values result in brighter, more realistic lighting, at the cost of longer bake times. If set to 0, only environment lighting, direct light and emissive lighting is baked.
var camera_attributes: CameraAttributes#
The CameraAttributes resource that specifies exposure levels to bake at. Auto-exposure and non exposure properties will be ignored. Exposure settings should be used to reduce the dynamic range present when baking. If exposure is too high, the LightmapGI will have banding artifacts or may have over-exposure artifacts.
var denoiser_range: int = 10#
The distance in pixels from which the denoiser samples. Lower values preserve more details, but may give blotchy results if the lightmap quality is not high enough. Only effective if use_denoiser is true and ProjectSettings.rendering/lightmapping/denoising/denoiser is set to JNLM.
var denoiser_strength: float = 0.1#
The strength of denoising step applied to the generated lightmaps. Only effective if use_denoiser is true and ProjectSettings.rendering/lightmapping/denoising/denoiser is set to JNLM.
var directional: bool = false#
If true, bakes lightmaps to contain directional information as spherical harmonics. This results in more realistic lighting appearance, especially with normal mapped materials and for lights that have their direct light baked (Light3D.light_bake_mode set to Light3D.BAKE_STATIC and with Light3D.editor_only set to false). The directional information is also used to provide rough reflections for static and dynamic objects. This has a small run-time performance cost as the shader has to perform more work to interpret the direction information from the lightmap. Directional lightmaps also take longer to bake and result in larger file sizes.
Note: The property's name has no relationship with DirectionalLight3D. directional works with all light types.
var environment_custom_color: Color = Color(1, 1, 1, 1)#
The color to use for environment lighting. Only effective if environment_mode is ENVIRONMENT_MODE_CUSTOM_COLOR.
var environment_custom_energy: float = 1.0#
The color multiplier to use for environment lighting. Only effective if environment_mode is ENVIRONMENT_MODE_CUSTOM_COLOR.
var environment_custom_sky: Sky#
The sky to use as a source of environment lighting. Only effective if environment_mode is ENVIRONMENT_MODE_CUSTOM_SKY.
var environment_mode = ENVIRONMENT_MODE_SCENE#
The environment mode to use when baking lightmaps.
var generate_probes_subdiv = GENERATE_PROBES_SUBDIV_8#
The level of subdivision to use when automatically generating LightmapProbes for dynamic object lighting. Higher values result in more accurate indirect lighting on dynamic objects, at the cost of longer bake times and larger file sizes.
Note: Automatically generated LightmapProbes are not visible as nodes in the Scene tree dock, and cannot be modified this way after they are generated.
Note: Regardless of generate_probes_subdiv, direct lighting on dynamic objects is always applied using Light3D nodes in real-time.
var interior: bool = false#
If true, ignore environment lighting when baking lightmaps.
var light_data: LightmapGIData#
The LightmapGIData associated to this LightmapGI node. This resource is automatically created after baking, and is not meant to be created manually.
var max_texture_size: int = 16384#
The maximum texture size for the generated texture atlas. Higher values will result in fewer slices being generated, but may not work on all hardware as a result of hardware limitations on texture sizes. Leave max_texture_size at its default value of 16384 if unsure.
var quality = BAKE_QUALITY_MEDIUM#
The quality preset to use when baking lightmaps. This affects bake times, but output file sizes remain mostly identical across quality levels.
To further speed up bake times, decrease bounces, disable use_denoiser and/or decrease texel_scale.
To further increase quality, enable supersampling and/or increase texel_scale.
var shadowmask_mode = SHADOWMASK_MODE_NONE#
The shadowmasking policy to use for directional shadows on static objects that are baked with this LightmapGI instance.
Shadowmasking allows DirectionalLight3D nodes to cast shadows even outside the range defined by their DirectionalLight3D.directional_shadow_max_distance property. This is done by baking a texture that contains a shadowmap for the directional light, then using this texture according to the current shadowmask mode.
Note: The shadowmask texture is only created if shadowmask_mode is not LightmapGIData.SHADOWMASK_MODE_NONE. To see a difference, you need to bake lightmaps again after switching from LightmapGIData.SHADOWMASK_MODE_NONE to any other mode.
var supersampling: bool = false#
If true, lightmaps are baked with the texel scale multiplied with supersampling_factor and downsampled before saving the lightmap (so the effective texel density is identical to having supersampling disabled).
Supersampling provides increased lightmap quality with less noise, smoother shadows and better shadowing of small-scale features in objects. However, it may result in significantly increased bake times and memory usage while baking lightmaps. Padding is automatically adjusted to avoid increasing light leaking.
var supersampling_factor: float = 2.0#
The factor by which the texel density is multiplied for supersampling. For best results, use an integer value. While fractional values are allowed, they can result in increased light leaking and a blurry lightmap.
Higher values may result in better quality, but also increase bake times and memory usage while baking.
See supersampling for more information.
var texel_scale: float = 1.0#
Scales the lightmap texel density of all meshes for the current bake. This is a multiplier that builds upon the existing lightmap texel size defined in each imported 3D scene, along with the per-mesh density multiplier (which is designed to be used when the same mesh is used at different scales). Lower values will result in faster bake times.
For example, doubling texel_scale doubles the lightmap texture resolution for all objects on each axis, so it will quadruple the texel count.
var use_denoiser: bool = true#
If true, uses a GPU-based denoising algorithm on the generated lightmap. This eliminates most noise within the generated lightmap at the cost of longer bake times. File sizes are generally not impacted significantly by the use of a denoiser, although lossless compression may do a better job at compressing a denoised image.
var use_texture_for_bounces: bool = true#
If true, a texture with the lighting information will be generated to speed up the generation of indirect lighting at the cost of some accuracy. The geometry might exhibit extra light leak artifacts when using low resolution lightmaps or UVs that stretch the lightmap significantly across surfaces. Leave use_texture_for_bounces at its default value of true if unsure.
Note: use_texture_for_bounces only has an effect if bounces is set to a value greater than or equal to 1.
Methods #
Annotations #
Constants #
const BAKE_QUALITY_LOW = 0 enum BakeQuality#
Low bake quality (fastest bake times). The quality of this preset can be adjusted by changing ProjectSettings.rendering/lightmapping/bake_quality/low_quality_ray_count and ProjectSettings.rendering/lightmapping/bake_quality/low_quality_probe_ray_count.
const BAKE_QUALITY_MEDIUM = 1 enum BakeQuality#
Medium bake quality (fast bake times). The quality of this preset can be adjusted by changing ProjectSettings.rendering/lightmapping/bake_quality/medium_quality_ray_count and ProjectSettings.rendering/lightmapping/bake_quality/medium_quality_probe_ray_count.
const BAKE_QUALITY_HIGH = 2 enum BakeQuality#
High bake quality (slow bake times). The quality of this preset can be adjusted by changing ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count and ProjectSettings.rendering/lightmapping/bake_quality/high_quality_probe_ray_count.
const BAKE_QUALITY_ULTRA = 3 enum BakeQuality#
Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_ray_count and ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count.
const GENERATE_PROBES_DISABLED = 0 enum GenerateProbes#
Don't generate lightmap probes for lighting dynamic objects.
const GENERATE_PROBES_SUBDIV_4 = 1 enum GenerateProbes#
Lowest level of subdivision (fastest bake times, smallest file sizes).
const GENERATE_PROBES_SUBDIV_8 = 2 enum GenerateProbes#
Low level of subdivision (fast bake times, small file sizes).
const GENERATE_PROBES_SUBDIV_16 = 3 enum GenerateProbes#
High level of subdivision (slow bake times, large file sizes).
const GENERATE_PROBES_SUBDIV_32 = 4 enum GenerateProbes#
Highest level of subdivision (slowest bake times, largest file sizes).
const BAKE_ERROR_OK = 0 enum BakeError#
Lightmap baking was successful.
const BAKE_ERROR_NO_SCENE_ROOT = 1 enum BakeError#
Lightmap baking failed because the root node for the edited scene could not be accessed.
const BAKE_ERROR_FOREIGN_DATA = 2 enum BakeError#
Lightmap baking failed as the lightmap data resource is embedded in a foreign resource.
const BAKE_ERROR_NO_LIGHTMAPPER = 3 enum BakeError#
Lightmap baking failed as there is no lightmapper available in this Godot build.
const BAKE_ERROR_NO_SAVE_PATH = 4 enum BakeError#
Lightmap baking failed as the LightmapGIData save path isn't configured in the resource.
const BAKE_ERROR_NO_MESHES = 5 enum BakeError#
Lightmap baking failed as there are no meshes whose GeometryInstance3D.gi_mode is GeometryInstance3D.GI_MODE_STATIC and with valid UV2 mapping in the current scene. You may need to select 3D scenes in the Import dock and change their global illumination mode accordingly.
const BAKE_ERROR_MESHES_INVALID = 6 enum BakeError#
Lightmap baking failed as the lightmapper failed to analyze some of the meshes marked as static for baking.
const BAKE_ERROR_CANT_CREATE_IMAGE = 7 enum BakeError#
Lightmap baking failed as the resulting image couldn't be saved or imported by Godot after it was saved.
const BAKE_ERROR_USER_ABORTED = 8 enum BakeError#
The user aborted the lightmap baking operation (typically by clicking the Cancel button in the progress dialog).
const BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL = 9 enum BakeError#
Lightmap baking failed as the maximum texture size is too small to fit some of the meshes marked for baking.
const BAKE_ERROR_LIGHTMAP_TOO_SMALL = 10 enum BakeError#
Lightmap baking failed as the lightmap is too small.
const BAKE_ERROR_ATLAS_TOO_SMALL = 11 enum BakeError#
Lightmap baking failed as the lightmap was unable to fit into an atlas.
const ENVIRONMENT_MODE_DISABLED = 0 enum EnvironmentMode#
Ignore environment lighting when baking lightmaps.
const ENVIRONMENT_MODE_SCENE = 1 enum EnvironmentMode#
Use the scene's environment lighting when baking lightmaps.
Note: If baking lightmaps in a scene with no WorldEnvironment node, this will act like ENVIRONMENT_MODE_DISABLED. The editor's preview sky and sun is not taken into account by LightmapGI when baking lightmaps.
const ENVIRONMENT_MODE_CUSTOM_SKY = 2 enum EnvironmentMode#
Use environment_custom_sky as a source of environment lighting when baking lightmaps.
const ENVIRONMENT_MODE_CUSTOM_COLOR = 3 enum EnvironmentMode#
Use environment_custom_color multiplied by environment_custom_energy as a constant source of environment lighting when baking lightmaps.
Constructors #
Enums #
BakeQuality#
enum BakeQuality {
BAKE_QUALITY_LOW = 0,
BAKE_QUALITY_MEDIUM = 1,
BAKE_QUALITY_HIGH = 2,
BAKE_QUALITY_ULTRA = 3,
}GenerateProbes#
enum GenerateProbes {
GENERATE_PROBES_DISABLED = 0,
GENERATE_PROBES_SUBDIV_4 = 1,
GENERATE_PROBES_SUBDIV_8 = 2,
GENERATE_PROBES_SUBDIV_16 = 3,
GENERATE_PROBES_SUBDIV_32 = 4,
}BakeError#
enum BakeError {
BAKE_ERROR_OK = 0,
BAKE_ERROR_NO_SCENE_ROOT = 1,
BAKE_ERROR_FOREIGN_DATA = 2,
BAKE_ERROR_NO_LIGHTMAPPER = 3,
BAKE_ERROR_NO_SAVE_PATH = 4,
BAKE_ERROR_NO_MESHES = 5,
BAKE_ERROR_MESHES_INVALID = 6,
BAKE_ERROR_CANT_CREATE_IMAGE = 7,
BAKE_ERROR_USER_ABORTED = 8,
BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL = 9,
BAKE_ERROR_LIGHTMAP_TOO_SMALL = 10,
BAKE_ERROR_ATLAS_TOO_SMALL = 11,
}EnvironmentMode#
enum EnvironmentMode {
ENVIRONMENT_MODE_DISABLED = 0,
ENVIRONMENT_MODE_SCENE = 1,
ENVIRONMENT_MODE_CUSTOM_SKY = 2,
ENVIRONMENT_MODE_CUSTOM_COLOR = 3,
}