reckfellENGINE

LightmapGI

Computes and stores baked lightmaps for fast global illumination.

On this page
class LightmapGIReckfellSharpInherits VisualInstance3D

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 LightmapGI.Directional is enabled. Dynamic objects can receive indirect lighting thanks to light probes, which can be automatically placed by setting LightmapGI.GenerateProbesSubdiv to a value other than LightmapGI.GenerateProbes.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.SdfgiEnabled). 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.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

LightmapGIConstructor
# LightmapGI
C#
public LightmapGI();

Properties23

BiasProperty
# Bias
C#
public float Bias { get; set; }

The bias to use when computing shadows. Increasing LightmapGI.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 LightmapGI.Bias property.

BounceIndirectEnergyProperty
# BounceIndirectEnergy
C#
public float BounceIndirectEnergy { get; set; }

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 LightmapGI.Bounces then increasing LightmapGI.BounceIndirectEnergy. Note: LightmapGI.BounceIndirectEnergy only has an effect if LightmapGI.Bounces is set to a value greater than or equal to 1.

BouncesProperty
# Bounces
C#
public int Bounces { get; set; }

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.

CameraAttributesProperty
# CameraAttributes
C#
public CameraAttributes CameraAttributes { get; set; }

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.

DenoiserRangeProperty
# DenoiserRange
C#
public int DenoiserRange { get; set; }

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 LightmapGI.UseDenoiser is true and ProjectSettings.rendering/lightmapping/denoising/denoiser is set to JNLM.

DenoiserStrengthProperty
# DenoiserStrength
C#
public float DenoiserStrength { get; set; }

The strength of denoising step applied to the generated lightmaps. Only effective if LightmapGI.UseDenoiser is true and ProjectSettings.rendering/lightmapping/denoising/denoiser is set to JNLM.

DirectionalProperty
# Directional
C#
public bool Directional { get; set; }

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.LightBakeMode set to Light3D.BakeMode.Static and with Light3D.EditorOnly 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. LightmapGI.Directional works with all light types.

EnvironmentCustomColorProperty
# EnvironmentCustomColor
C#
public Color EnvironmentCustomColor { get; set; }

The color to use for environment lighting. Only effective if LightmapGI.EnvironmentMode is LightmapGI.EnvironmentModeEnum.CustomColor.

EnvironmentCustomEnergyProperty
# EnvironmentCustomEnergy
C#
public float EnvironmentCustomEnergy { get; set; }

The color multiplier to use for environment lighting. Only effective if LightmapGI.EnvironmentMode is LightmapGI.EnvironmentModeEnum.CustomColor.

EnvironmentCustomSkyProperty
# EnvironmentCustomSky
C#
public Sky EnvironmentCustomSky { get; set; }

The sky to use as a source of environment lighting. Only effective if LightmapGI.EnvironmentMode is LightmapGI.EnvironmentModeEnum.CustomSky.

EnvironmentModeProperty
# EnvironmentMode
C#
public LightmapGI.EnvironmentModeEnum EnvironmentMode { get; set; }

The environment mode to use when baking lightmaps.

GenerateProbesSubdivProperty
# GenerateProbesSubdiv
C#
public LightmapGI.GenerateProbes GenerateProbesSubdiv { get; set; }

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 LightmapGI.GenerateProbesSubdiv, direct lighting on dynamic objects is always applied using Light3D nodes in real-time.

InteriorProperty
# Interior
C#
public bool Interior { get; set; }

If true, ignore environment lighting when baking lightmaps.

LightDataProperty
# LightData
C#
public LightmapGIData LightData { get; set; }

The LightmapGIData associated to this LightmapGI node. This resource is automatically created after baking, and is not meant to be created manually.

MaxTextureSizeProperty
# MaxTextureSize
C#
public int MaxTextureSize { get; set; }

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 LightmapGI.MaxTextureSize at its default value of 16384 if unsure.

QualityProperty
# Quality
C#
public LightmapGI.BakeQuality Quality { get; set; }

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 LightmapGI.Bounces, disable LightmapGI.UseDenoiser and/or decrease LightmapGI.TexelScale. To further increase quality, enable LightmapGI.Supersampling and/or increase LightmapGI.TexelScale.

ShadowmaskModeProperty
# ShadowmaskMode
C#
public LightmapGIData.ShadowmaskMode ShadowmaskMode { get; set; }

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.DirectionalShadowMaxDistance 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 LightmapGI.ShadowmaskMode is not LightmapGIData.ShadowmaskMode.None. To see a difference, you need to bake lightmaps again after switching from LightmapGIData.ShadowmaskMode.None to any other mode.

SpecularIntensityProperty
# SpecularIntensity
C#
public float SpecularIntensity { get; set; }

The strength of the lightmap's approximated specular lobe. This helps make lightmapped scenes look closer to real-time lighting, which is particularly noticeable for lights that use the Light3D.BakeMode.Static bake mode. Only effective if LightmapGI.Directional is true. Note: The lightmap is only able to represent one light direction per texel, which means that the specular direction may appear to be incorrect in certain cases. This can manifest as specular lobes appearing to warp around as the camera moves.

SupersamplingProperty
# Supersampling
C#
public bool Supersampling { get; set; }

If true, lightmaps are baked with the texel scale multiplied with LightmapGI.SupersamplingFactor 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.

SupersamplingFactorProperty
# SupersamplingFactor
C#
public float SupersamplingFactor { get; set; }

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 LightmapGI.Supersampling for more information.

TexelScaleProperty
# TexelScale
C#
public float TexelScale { get; set; }

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 LightmapGI.TexelScale doubles the lightmap texture resolution for all objects on each axis, so it will quadruple the texel count.

UseDenoiserProperty
# UseDenoiser
C#
public bool UseDenoiser { get; set; }

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.

UseTextureForBouncesProperty
# UseTextureForBounces
C#
public bool UseTextureForBounces { get; set; }

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 LightmapGI.UseTextureForBounces at its default value of true if unsure. Note: LightmapGI.UseTextureForBounces only has an effect if LightmapGI.Bounces is set to a value greater than or equal to 1.

Methods46

GetBakeQualityLightmapGI.BakeQuality
# GetBakeQuality
C#
public LightmapGI.BakeQuality GetBakeQuality();
Returns LightmapGI.BakeQuality
GetBiasfloat
# GetBias
C#
public float GetBias();
Returns float
GetBounceIndirectEnergyfloat
# GetBounceIndirectEnergy
C#
public float GetBounceIndirectEnergy();
Returns float
GetBouncesint
# GetBounces
C#
public int GetBounces();
Returns int
GetCameraAttributesCameraAttributes
# GetCameraAttributes
C#
public CameraAttributes GetCameraAttributes();
Returns CameraAttributes
GetDenoiserRangeint
# GetDenoiserRange
C#
public int GetDenoiserRange();
Returns int
GetDenoiserStrengthfloat
# GetDenoiserStrength
C#
public float GetDenoiserStrength();
Returns float
GetEnvironmentCustomColorColor
# GetEnvironmentCustomColor
C#
public Color GetEnvironmentCustomColor();
Returns Color
GetEnvironmentCustomEnergyfloat
# GetEnvironmentCustomEnergy
C#
public float GetEnvironmentCustomEnergy();
Returns float
GetEnvironmentCustomSkySky
# GetEnvironmentCustomSky
C#
public Sky GetEnvironmentCustomSky();
Returns Sky
GetEnvironmentModeLightmapGI.EnvironmentModeEnum
# GetEnvironmentMode
C#
public LightmapGI.EnvironmentModeEnum GetEnvironmentMode();
Returns LightmapGI.EnvironmentModeEnum
GetGenerateProbesLightmapGI.GenerateProbes
# GetGenerateProbes
C#
public LightmapGI.GenerateProbes GetGenerateProbes();
Returns LightmapGI.GenerateProbes
GetLightDataLightmapGIData
# GetLightData
C#
public LightmapGIData GetLightData();
Returns LightmapGIData
GetMaxTextureSizeint
# GetMaxTextureSize
C#
public int GetMaxTextureSize();
Returns int
GetShadowmaskModeLightmapGIData.ShadowmaskMode
# GetShadowmaskMode
C#
public LightmapGIData.ShadowmaskMode GetShadowmaskMode();
Returns LightmapGIData.ShadowmaskMode
GetSpecularIntensityfloat
# GetSpecularIntensity
C#
public float GetSpecularIntensity();
Returns float
GetSupersamplingFactorfloat
# GetSupersamplingFactor
C#
public float GetSupersamplingFactor();
Returns float
GetTexelScalefloat
# GetTexelScale
C#
public float GetTexelScale();
Returns float
IsDirectionalbool
# IsDirectional
C#
public bool IsDirectional();
Returns bool
IsInteriorbool
# IsInterior
C#
public bool IsInterior();
Returns bool
IsSupersamplingEnabledbool
# IsSupersamplingEnabled
C#
public bool IsSupersamplingEnabled();
Returns bool
IsUsingDenoiserbool
# IsUsingDenoiser
C#
public bool IsUsingDenoiser();
Returns bool
IsUsingTextureForBouncesbool
# IsUsingTextureForBounces
C#
public bool IsUsingTextureForBounces();
Returns bool
SetBakeQualityvoid
# SetBakeQuality
C#
public void SetBakeQuality(LightmapGI.BakeQuality bakeQuality);
Parameters
NameTypeDefault
bakeQualityLightmapGI.BakeQuality—
SetBiasvoid
# SetBias
C#
public void SetBias(float bias);
Parameters
NameTypeDefault
biasfloat—
SetBounceIndirectEnergyvoid
# SetBounceIndirectEnergy
C#
public void SetBounceIndirectEnergy(float bounceIndirectEnergy);
Parameters
NameTypeDefault
bounceIndirectEnergyfloat—
SetBouncesvoid
# SetBounces
C#
public void SetBounces(int bounces);
Parameters
NameTypeDefault
bouncesint—
SetCameraAttributesvoid
# SetCameraAttributes
C#
public void SetCameraAttributes(CameraAttributes cameraAttributes);
Parameters
NameTypeDefault
cameraAttributesCameraAttributes—
SetDenoiserRangevoid
# SetDenoiserRange
C#
public void SetDenoiserRange(int denoiserRange);
Parameters
NameTypeDefault
denoiserRangeint—
SetDenoiserStrengthvoid
# SetDenoiserStrength
C#
public void SetDenoiserStrength(float denoiserStrength);
Parameters
NameTypeDefault
denoiserStrengthfloat—
SetDirectionalvoid
# SetDirectional
C#
public void SetDirectional(bool directional);
Parameters
NameTypeDefault
directionalbool—
SetEnvironmentCustomColorvoid
# SetEnvironmentCustomColor
C#
public void SetEnvironmentCustomColor(Color color);
Parameters
NameTypeDefault
colorColor—
SetEnvironmentCustomEnergyvoid
# SetEnvironmentCustomEnergy
C#
public void SetEnvironmentCustomEnergy(float energy);
Parameters
NameTypeDefault
energyfloat—
SetEnvironmentCustomSkyvoid
# SetEnvironmentCustomSky
C#
public void SetEnvironmentCustomSky(Sky sky);
Parameters
NameTypeDefault
skySky—
SetEnvironmentModevoid
# SetEnvironmentMode
C#
public void SetEnvironmentMode(LightmapGI.EnvironmentModeEnum mode);
Parameters
NameTypeDefault
modeLightmapGI.EnvironmentModeEnum—
SetGenerateProbesvoid
# SetGenerateProbes
C#
public void SetGenerateProbes(LightmapGI.GenerateProbes subdivision);
Parameters
NameTypeDefault
subdivisionLightmapGI.GenerateProbes—
SetInteriorvoid
# SetInterior
C#
public void SetInterior(bool enable);
Parameters
NameTypeDefault
enablebool—
SetLightDatavoid
# SetLightData
C#
public void SetLightData(LightmapGIData data);
Parameters
NameTypeDefault
dataLightmapGIData—
SetMaxTextureSizevoid
# SetMaxTextureSize
C#
public void SetMaxTextureSize(int maxTextureSize);
Parameters
NameTypeDefault
maxTextureSizeint—
SetShadowmaskModevoid
# SetShadowmaskMode
C#
public void SetShadowmaskMode(LightmapGIData.ShadowmaskMode mode);
Parameters
NameTypeDefault
modeLightmapGIData.ShadowmaskMode—
SetSpecularIntensityvoid
# SetSpecularIntensity
C#
public void SetSpecularIntensity(float specularIntensity);
Parameters
NameTypeDefault
specularIntensityfloat—
SetSupersamplingEnabledvoid
# SetSupersamplingEnabled
C#
public void SetSupersamplingEnabled(bool enable);
Parameters
NameTypeDefault
enablebool—
SetSupersamplingFactorvoid
# SetSupersamplingFactor
C#
public void SetSupersamplingFactor(float factor);
Parameters
NameTypeDefault
factorfloat—
SetTexelScalevoid
# SetTexelScale
C#
public void SetTexelScale(float texelScale);
Parameters
NameTypeDefault
texelScalefloat—
SetUseDenoiservoid
# SetUseDenoiser
C#
public void SetUseDenoiser(bool useDenoiser);
Parameters
NameTypeDefault
useDenoiserbool—
SetUseTextureForBouncesvoid
# SetUseTextureForBounces
C#
public void SetUseTextureForBounces(bool useTextureForBounces);
Parameters
NameTypeDefault
useTextureForBouncesbool—

LightmapGI.BakeError

ValueDescription
AtlasTooSmall = 11

Lightmap baking failed as the lightmap was unable to fit into an atlas.

CantCreateImage = 7

Lightmap baking failed as the resulting image couldn't be saved or imported by Reckfell after it was saved.

ForeignData = 2

Lightmap baking failed as the lightmap data resource is embedded in a foreign resource.

LightmapTooSmall = 10

Lightmap baking failed as the lightmap is too small.

MeshesInvalid = 6

Lightmap baking failed as the lightmapper failed to analyze some of the meshes marked as static for baking.

NoLightmapper = 3

Lightmap baking failed as there is no lightmapper available in this Reckfell build.

NoMeshes = 5

Lightmap baking failed as there are no meshes whose GeometryInstance3D.GIMode is GeometryInstance3D.GIModeEnum.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.

NoSavePath = 4

Lightmap baking failed as the LightmapGIData save path isn't configured in the resource.

NoSceneRoot = 1

Lightmap baking failed because the root node for the edited scene could not be accessed.

Ok = 0

Lightmap baking was successful.

TextureSizeTooSmall = 9

Lightmap baking failed as the maximum texture size is too small to fit some of the meshes marked for baking.

UserAborted = 8

The user aborted the lightmap baking operation (typically by clicking the Cancel button in the progress dialog).

LightmapGI.BakeQuality

ValueDescription
High = 2

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.

Low = 0

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.

Medium = 1

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.

Ultra = 3

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.

LightmapGI.EnvironmentModeEnum

ValueDescription
CustomColor = 3

Use LightmapGI.EnvironmentCustomColor multiplied by LightmapGI.EnvironmentCustomEnergy as a constant source of environment lighting when baking lightmaps.

CustomSky = 2

Use LightmapGI.EnvironmentCustomSky as a source of environment lighting when baking lightmaps.

Disabled = 0

Ignore environment lighting when baking lightmaps.

Scene = 1

Use the scene's environment lighting when baking lightmaps. Note: If baking lightmaps in a scene with no WorldEnvironment node, this will act like LightmapGI.EnvironmentModeEnum.Disabled. The editor's preview sky and sun is not taken into account by LightmapGI when baking lightmaps.

LightmapGI.GenerateProbes

ValueDescription
Disabled = 0

Don't generate lightmap probes for lighting dynamic objects.

Subdiv16 = 3

High level of subdivision (slow bake times, large file sizes).

Subdiv32 = 4

Highest level of subdivision (slowest bake times, largest file sizes).

Subdiv4 = 1

Lowest level of subdivision (fastest bake times, smallest file sizes).

Subdiv8 = 2

Low level of subdivision (fast bake times, small file sizes).

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.