# Sandbox.BakedLightmap

A scene's baked lightmap, [Sandbox.Scene.Lightmap](/api/Sandbox.Scene/Lightmap): how it's baked and what the last bake made, saved with the
scene. One lightmap for every mesh and static model in the scene, traced on the GPU with a compute BVH. A model
whose materials can't sample one casts shadows into it and is lit from the light probes it fills.
Directional lights and lights on static objects become baked lights: the lightmap holds how much of each
reaches a luxel, and the light they and the skybox bounce around the scene.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Modifiers: sealed

## Properties

- [`AmbientOcclusion`](/api/Sandbox.BakedLightmap/AmbientOcclusion): Darken indirect light where other surfaces are nearer than this, in units. 0 bakes no ambient occlusion.
- [`BakeFog`](/api/Sandbox.BakedLightmap/BakeFog): Bake the light volumetric fog scatters inside the scene's [Sandbox.VolumetricFogVolume](/api/Sandbox.VolumetricFogVolume)s: indirect light, and the baked lights' own, the sun's too, which then light no fog while the game runs.
- [`BakeProgress`](/api/Sandbox.BakedLightmap/BakeProgress): The current bake stage and fraction of tracing passes completed. Null when the bake is idle.
- [`Bounces`](/api/Sandbox.BakedLightmap/Bounces): How many times light bounces off surfaces. With none, only the sky and glowing surfaces light a luxel indirectly.
- [`Denoise`](/api/Sandbox.BakedLightmap/Denoise): Smooth the noise out of indirect light and soft shadows, so a lower [Sandbox.BakedLightmap.Quality](/api/Sandbox.BakedLightmap/Quality) does.
- [`FittedProbes`](/api/Sandbox.BakedLightmap/FittedProbes): The probe volume a bake made around the scene, which every bake fits to it again.
- [`LuxelSize`](/api/Sandbox.BakedLightmap/LuxelSize): Size of a luxel in units in the last bake.
- [`PreviewEnabled`](/api/Sandbox.BakedLightmap/PreviewEnabled): Show this bake in the scene preview. Switching it off uses realtime lighting and preserves the bake.
- [`ProbeSpacing`](/api/Sandbox.BakedLightmap/ProbeSpacing): Minimum distance in world units between the light probes that light what isn't lightmapped. They're baked into the scene's [Sandbox.LightProbeVolume](/api/Sandbox.LightProbeVolume)s. One is made around the scene if there are none.
- [`Quality`](/api/Sandbox.BakedLightmap/Quality): How many rays are traced from each luxel, for soft shadows and for indirect light. Higher takes longer to bake.
- [`RealtimeSunShadows`](/api/Sandbox.BakedLightmap/RealtimeSunShadows): Directional lights' cascaded shadow maps take in static geometry too, so its shadows are sharp up close, over the ones baked into the lightmap, which carry on past the cascades. Off, a baked sun's shadow maps leave static geometry out. Baking sets each directional light's Include Static Shadow Casters to this, and turns its Mixed Shadows on with it.
- [`Size`](/api/Sandbox.BakedLightmap/Size): The widest and tallest the lightmap can be. Luxels are as small as still lets the scene fit.
- [`Textures`](/api/Sandbox.BakedLightmap/Textures): The textures the last bake made. Every mesh and model with a place in the lightmap is lit from them.

## Methods

- [`Bake`](/api/Sandbox.BakedLightmap/Bake): Bake every mesh and lightmapped model in the scene into one lightmap, saved beside the scene. Throws if it can't or it's cancelled.
- [`Clear`](/api/Sandbox.BakedLightmap/Clear): Remove the lightmaps and make every light dynamic again.
- [`Stop`](/api/Sandbox.BakedLightmap/Stop): Cancel the bake that's running, if one is.
