> For the complete documentation index, see [llms.txt](https://motiongamesstudio.gitbook.io/magic-lightmap-switcher/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://motiongamesstudio.gitbook.io/magic-lightmap-switcher/integrations-1/bakery.md).

# Bakery - GPU Lightmapper

## Lightmapper Selection

The plugin can work with Bakery. If Bakery is installed in the project, then an additional option will be available in the manager window - "**Lightmapper**". You can choose which one to use for baking the scene.

![](/files/-MWQPagp6smqoc_DVnvV)

## Skybox/Skylight

Bakery uses its own skybox shader and sets it automatically when you click one of the matching buttons in the interface of the "**Bakery Sky Light**" component.

![](/files/-MX92BWBhkYUzkcYBDcI)

MLS uses the parameters (property) of the Bakery material for blending.&#x20;

There are two options to capture the parameters:

* If you use presets to set up a scene, MLS will automatically record the material parameters as soon as you press the **"Match scene skybox to this light"** button in preset recording mode.&#x20;
* If you are setting up a scene without using presets, then you need to mark the Bakery Skybox material as manually tracked using [Tracking Overlay](/magic-lightmap-switcher/using/tracking-object-parameters.md).&#x20;

## Bakery Sector

{% hint style="info" %}
The Bakery Volume in the workflow with the Bakery Sector should be inside this sector and cannot be global. The current Bakery architecture in this case uses Property Blocks, which is not compatible with MLS.
{% endhint %}

MLS provides a convenient workflow for Bakery Sectors. Depending on the selected **Storage Mode**, different approaches will be available to you. To activate the options for working with Bakery Sector, check the **Use Bakery Sectors** option in the [MLS Manager](/magic-lightmap-switcher/system-components/mls-manager-window.md).

### Once

<figure><img src="/files/2kegv5UdCP9obyGALjXw" alt=""><figcaption></figcaption></figure>

In this mode, you have two workflow options available:

* Click the **"Bake"** button to bake a specific Bakery Sector. When the required sectors are baked, click the **"Store Baked Lightmap"** button. After that, the lightmap data will be saved with the specified name.
* Press the **"Bake And Store Sectors"** button to bake all sectors in turn in automatic mode. When all sectors are baked, the process of saving the lightmap data will be started automatically.

{% hint style="info" %}
Please note that in the case of automatic baking, only the marked sectors will be baked.
{% endhint %}

### Queue

<figure><img src="/files/bGbIc3M9KvVNsKs4xn4H" alt=""><figcaption></figcaption></figure>

In this mode, after clicking the **"Bake And Store Lightmaps Queue"** button, the process of automatically baking all marked presets and all marked Bakery Sectors for each preset will be started. This is a fully automatic process, at the end of which you will get sets of stored lightmap data for each preset and a lighting scenario if the **"Create Lightmap Scenario"** option is checked.

## Bakery Prefab

{% hint style="info" %}
At the moment, the prefab can be added to the stage and can be controlled by a separate lighting scenario, but it cannot be duplicated.
{% endhint %}

You can bake lighting options for the Bakery  Prefab in a separate scene and then add it to the main one.

* Create a separate scene and add a prefab there
* Add the **MLSBakeryLightmappedPrefab** component to the prefab

<figure><img src="/files/qQp5dznnYa0D89grq7gp" alt=""><figcaption></figcaption></figure>

* Add the MLS instance to the scene
* Adjust the lighting using presets or manually
* If you have used presets and selected Create Lightmap Scenario option, then after baking in the Switching/Blending tab you will see a fully configured lighting scenario for the prefab

<figure><img src="/files/xO3gUN4fpSWUXzkbXppq" alt=""><figcaption></figcaption></figure>

* If you have baked and saved the lighting data manually, then you need to select the prefab object on the scene and click the **Create Lighting Scenario** button in the **MLSBakeryLightmappedPrefab** component
* Now you can add a prefab to another scene and link the prefab lighting scenario to the MLS instance on the active scene. Press "**Link Lighting Scenario**" button.

<figure><img src="/files/0AFjLnh3ncAmWFQLh36d" alt=""><figcaption></figcaption></figure>

## Possible Issues

Bakery uses its own lightmap array and tries to load it at runtime during edit playback. If you baked a scene using the Bakery, and then for some reason decided to use the built-in lightmapper, then you need to clear the scene data. Otherwise it will break lightmaps. Use **Bakery ➞ Utilites ➞ Clear Baked Data**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://motiongamesstudio.gitbook.io/magic-lightmap-switcher/integrations-1/bakery.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
