Documentation
¶
Overview ¶
The graphics.gd/classdb/LightmapGI node is used to compute and store baked lightmaps. Lightmaps are used to provide high-quality indirect lighting with very little light leaking. graphics.gd/classdb/LightmapGI can also provide rough reflections using spherical harmonics if Instance.Directional is enabled. Dynamic objects can receive indirect lighting thanks to light probes, which can be automatically placed by setting Instance.GenerateProbesSubdiv to a value other than GenerateProbesDisabled. Additional lightmap probes can also be added by creating graphics.gd/classdb/LightmapProbe nodes. The downside is that lightmaps are fully static and cannot be baked in an exported project. Baking a graphics.gd/classdb/LightmapGI node is also slower compared to graphics.gd/classdb/VoxelGI.
Procedural generation: Lightmap baking functionality is only available in the editor. This means graphics.gd/classdb/LightmapGI is not suited to procedurally generated or user-built levels. For procedurally generated or user-built levels, use graphics.gd/classdb/VoxelGI or SDFGI instead (see graphics.gd/classdb/Environment.Instance.SdfgiEnabled).
Performance: graphics.gd/classdb/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 [graphics.gd/classdb/CSGShape3D]s and [graphics.gd/classdb/PrimitiveMesh]es is not supported, as these cannot store UV2 data required for baking.
Note: If no custom lightmappers are installed, graphics.gd/classdb/LightmapGI can only be baked from devices that support the Forward+ or Mobile renderers.
Note: The graphics.gd/classdb/LightmapGI node only bakes light data for child nodes of its parent. Nodes further up the hierarchy of the scene will not be baked.
Index ¶
- type Advanced
- type Any
- type BakeError
- type BakeQuality
- type EnvironmentMode
- type Extension
- type GenerateProbes
- type ID
- type Instance
- func (self Instance) AsLightmapGI() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) Bias() Float.X
- func (self Instance) BounceIndirectEnergy() Float.X
- func (self Instance) Bounces() int
- func (self Instance) CameraAttributes() CameraAttributes.Instance
- func (self Instance) DenoiserRange() int
- func (self Instance) DenoiserStrength() Float.X
- func (self Instance) Directional() bool
- func (self Instance) EnvironmentCustomColor() Color.RGBA
- func (self Instance) EnvironmentCustomEnergy() Float.X
- func (self Instance) EnvironmentCustomSky() Sky.Instance
- func (self Instance) EnvironmentMode() EnvironmentMode
- func (self Instance) GenerateProbesSubdiv() GenerateProbes
- func (self Instance) ID() ID
- func (self Instance) Interior() bool
- func (self Instance) LightData() LightmapGIData.Instance
- func (self Instance) MaxTextureSize() int
- func (self Instance) Quality() BakeQuality
- func (self Instance) SetBias(value Float.X)
- func (self Instance) SetBounceIndirectEnergy(value Float.X)
- func (self Instance) SetBounces(value int)
- func (self Instance) SetCameraAttributes(value CameraAttributes.Instance)
- func (self Instance) SetDenoiserRange(value int)
- func (self Instance) SetDenoiserStrength(value Float.X)
- func (self Instance) SetDirectional(value bool)
- func (self Instance) SetEnvironmentCustomColor(value Color.RGBA)
- func (self Instance) SetEnvironmentCustomEnergy(value Float.X)
- func (self Instance) SetEnvironmentCustomSky(value Sky.Instance)
- func (self Instance) SetEnvironmentMode(value EnvironmentMode)
- func (self Instance) SetGenerateProbesSubdiv(value GenerateProbes)
- func (self Instance) SetInterior(value bool)
- func (self Instance) SetLightData(value LightmapGIData.Instance)
- func (self Instance) SetMaxTextureSize(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetQuality(value BakeQuality)
- func (self Instance) SetShadowmaskMode(value LightmapGIData.ShadowmaskMode)
- func (self Instance) SetSupersampling(value bool)
- func (self Instance) SetSupersamplingFactor(value Float.X)
- func (self Instance) SetTexelScale(value Float.X)
- func (self Instance) SetUseDenoiser(value bool)
- func (self Instance) SetUseTextureForBounces(value bool)
- func (self Instance) ShadowmaskMode() LightmapGIData.ShadowmaskMode
- func (self Instance) Supersampling() bool
- func (self Instance) SupersamplingFactor() Float.X
- func (self Instance) TexelScale() Float.X
- func (self Instance) UseDenoiser() bool
- func (self Instance) UseTextureForBounces() bool
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type BakeError ¶
type BakeError int //gd:LightmapGI.BakeError
const ( // Lightmap baking was successful. BakeErrorOk BakeError = 0 // Lightmap baking failed because the root node for the edited scene could not be accessed. BakeErrorNoSceneRoot BakeError = 1 // Lightmap baking failed as the lightmap data resource is embedded in a foreign resource. BakeErrorForeignData BakeError = 2 // Lightmap baking failed as there is no lightmapper available in this Godot build. BakeErrorNoLightmapper BakeError = 3 // Lightmap baking failed as the [graphics.gd/classdb/LightmapGIData] save path isn't configured in the resource. BakeErrorNoSavePath BakeError = 4 // Lightmap baking failed as there are no meshes whose [graphics.gd/classdb/GeometryInstance3D.Instance.GiMode] is [Geometryinstance3d.GiModeStatic] 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. BakeErrorNoMeshes BakeError = 5 // Lightmap baking failed as the lightmapper failed to analyze some of the meshes marked as static for baking. BakeErrorMeshesInvalid BakeError = 6 // Lightmap baking failed as the resulting image couldn't be saved or imported by Godot after it was saved. BakeErrorCantCreateImage BakeError = 7 // The user aborted the lightmap baking operation (typically by clicking the Cancel button in the progress dialog). BakeErrorUserAborted BakeError = 8 // Lightmap baking failed as the maximum texture size is too small to fit some of the meshes marked for baking. BakeErrorTextureSizeTooSmall BakeError = 9 // Lightmap baking failed as the lightmap is too small. BakeErrorLightmapTooSmall BakeError = 10 // Lightmap baking failed as the lightmap was unable to fit into an atlas. BakeErrorAtlasTooSmall BakeError = 11 )
type BakeQuality ¶
type BakeQuality int //gd:LightmapGI.BakeQuality
const ( // Low bake quality (fastest bake times). The quality of this preset can be adjusted by changing [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/low_quality_ray_count" and [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/low_quality_probe_ray_count". BakeQualityLow BakeQuality = 0 // Medium bake quality (fast bake times). The quality of this preset can be adjusted by changing [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/medium_quality_ray_count" and [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/medium_quality_probe_ray_count". BakeQualityMedium BakeQuality = 1 // High bake quality (slow bake times). The quality of this preset can be adjusted by changing [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/high_quality_ray_count" and [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/high_quality_probe_ray_count". BakeQualityHigh BakeQuality = 2 // Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/ultra_quality_ray_count" and [graphics.gd/classdb/ProjectSettings] "rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count". BakeQualityUltra BakeQuality = 3 )
type EnvironmentMode ¶
type EnvironmentMode int //gd:LightmapGI.EnvironmentMode
const ( // Ignore environment lighting when baking lightmaps. EnvironmentModeDisabled EnvironmentMode = 0 // Use the scene's environment lighting when baking lightmaps. // // Note: If baking lightmaps in a scene with no [graphics.gd/classdb/WorldEnvironment] node, this will act like [EnvironmentModeDisabled]. The editor's preview sky and sun is not taken into account by [graphics.gd/classdb/LightmapGI] when baking lightmaps. EnvironmentModeScene EnvironmentMode = 1 // Use [Instance.EnvironmentCustomSky] as a source of environment lighting when baking lightmaps. EnvironmentModeCustomSky EnvironmentMode = 2 // Use [Instance.EnvironmentCustomColor] multiplied by [Instance.EnvironmentCustomEnergy] as a constant source of environment lighting when baking lightmaps. EnvironmentModeCustomColor EnvironmentMode = 3 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsLightmapGI ¶
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type GenerateProbes ¶
type GenerateProbes int //gd:LightmapGI.GenerateProbes
const ( // Don't generate lightmap probes for lighting dynamic objects. GenerateProbesDisabled GenerateProbes = 0 // Lowest level of subdivision (fastest bake times, smallest file sizes). GenerateProbesSubdiv4 GenerateProbes = 1 // Low level of subdivision (fast bake times, small file sizes). GenerateProbesSubdiv8 GenerateProbes = 2 // High level of subdivision (slow bake times, large file sizes). GenerateProbesSubdiv16 GenerateProbes = 3 // Highest level of subdivision (slowest bake times, largest file sizes). GenerateProbesSubdiv32 GenerateProbes = 4 )
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.LightmapGI
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsLightmapGI ¶
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) BounceIndirectEnergy ¶
func (Instance) CameraAttributes ¶
func (self Instance) CameraAttributes() CameraAttributes.Instance
func (Instance) DenoiserRange ¶
func (Instance) DenoiserStrength ¶
func (Instance) Directional ¶
func (Instance) EnvironmentCustomColor ¶
func (Instance) EnvironmentCustomEnergy ¶
func (Instance) EnvironmentCustomSky ¶
func (Instance) EnvironmentMode ¶
func (self Instance) EnvironmentMode() EnvironmentMode
func (Instance) GenerateProbesSubdiv ¶
func (self Instance) GenerateProbesSubdiv() GenerateProbes
func (Instance) LightData ¶
func (self Instance) LightData() LightmapGIData.Instance
func (Instance) MaxTextureSize ¶
func (Instance) Quality ¶
func (self Instance) Quality() BakeQuality
func (Instance) SetBounceIndirectEnergy ¶
func (Instance) SetBounces ¶
func (Instance) SetCameraAttributes ¶
func (self Instance) SetCameraAttributes(value CameraAttributes.Instance)
func (Instance) SetDenoiserRange ¶
func (Instance) SetDenoiserStrength ¶
func (Instance) SetDirectional ¶
func (Instance) SetEnvironmentCustomColor ¶
func (Instance) SetEnvironmentCustomEnergy ¶
func (Instance) SetEnvironmentCustomSky ¶
func (Instance) SetEnvironmentMode ¶
func (self Instance) SetEnvironmentMode(value EnvironmentMode)
func (Instance) SetGenerateProbesSubdiv ¶
func (self Instance) SetGenerateProbesSubdiv(value GenerateProbes)
func (Instance) SetInterior ¶
func (Instance) SetLightData ¶
func (self Instance) SetLightData(value LightmapGIData.Instance)
func (Instance) SetMaxTextureSize ¶
func (Instance) SetQuality ¶
func (self Instance) SetQuality(value BakeQuality)
func (Instance) SetShadowmaskMode ¶
func (self Instance) SetShadowmaskMode(value LightmapGIData.ShadowmaskMode)
func (Instance) SetSupersampling ¶
func (Instance) SetSupersamplingFactor ¶
func (Instance) SetTexelScale ¶
func (Instance) SetUseDenoiser ¶
func (Instance) SetUseTextureForBounces ¶
func (Instance) ShadowmaskMode ¶
func (self Instance) ShadowmaskMode() LightmapGIData.ShadowmaskMode