# Lightmapper

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/dfcc50fbbfba2388843041a875ec0ef5d1a586c5/src/framework/lightmapper/lightmapper.js#L65

The lightmapper is used to bake scene lights into textures.

## Methods

### bake

```ts
bake(nodes: Entity[] | null, mode?: number): void
```

Generates and applies the lightmaps.

**Parameters**

- `nodes` ([`Entity`](https://api.playcanvas.com/engine/classes/Entity.md)`[] | null`): An array of entities (with model or render components) to
  render lightmaps for. If not supplied, the entire scene will be baked.
- `mode` (`number`, optional, default `BAKE_COLORDIR`): Baking mode. Can be:

  - [BAKE_COLOR](https://api.playcanvas.com/engine/variables/BAKE_COLOR.md): single color lightmap
  - [BAKE_COLORDIR](https://api.playcanvas.com/engine/variables/BAKE_COLORDIR.md): single color lightmap + dominant light direction (used for
  bump/specular)

  Only lights with bakeDir=true will be used for generating the dominant light direction.
  Defaults to [BAKE_COLORDIR](https://api.playcanvas.com/engine/variables/BAKE_COLORDIR.md).
