- Baking a lightmap using exact unscaled UVs as they were in a modeling package.
- Grouping certain areas of the level to use single lightmap to facilitate resource streaming or to switch
different baked lighting at runtime via scripts.
- Using Render Selected button to only update grouped objects.
To manually define a group, you create Lightmap Group Assets, either by using Assets->Create menu, or
using the Create New button in the component. When using the Create New button, new asset will be created
based on these forms:
- Name: name of the Lightmap Group Asset to create.
- Packing mode: this selector defines the packing mode of the Lightmap Group. There are 3 modes:
- Original UV: object and its children will be baked with unmodified UVs. No packing is performed.
This is useful for models when multiple meshes share the same already packed UV layout.
- Pack Atlas: object and its children are packed into a dedicated texture atlas. Before v1.3 every
packable child needed to have the component, but it’s no longer necessary. Every child will be
packed as its own rectangle, except when Bakery auto-detects a child having non-overlapping
sub-children, in which case multiple objects can use a single rectangle.
- Vertex: object and its children will use vertex-colored baked lighting instead of textures. Note
that you’ll need a custom shader for this to work, like Bakery Shader. One simple shader
("Bakery/Simple Vertex Lightmapped") is also included for demonstration and reference. See
notes.
- Directional mode: allows you to override directional mode on the group. Options are the same except
for Auto, which will simply use the global setting.
- Resolution: desired lightmap resolution.
- Bitmask: a list of toggles used to exclude light sources from affecting the lightmap. Every Bakery light
source also has a bitmask setting. Lights only affects Lightmap Groups with which they share at least
one of these toggles. Default settings mean all lights affect all lightmaps.
If you have a Lightmap Group with the Pack Atlas mode assigned, additional settings will appear on the
component:
- Override resolution: override the resolution this object and its children occupy in the lightmap.
- Resolution: manually defined resolution. For example, if you have a lightmap with a
resolution of 512 and it is assigned to 4 objects with override resolution set to 256,
Bakery will generate a single 512x512 lightmap where each object takes exactly
256x256 square.
Bakery Lightmapped Prefab
Introduced in v1.45, this component allows prefabs to store lightmapping metadata. Such prefabs can be then
instantiated in any scene, both in editor and at runtime.
The component should be added directly to the root object of the prefab. Because the prefab is going to be
overwritten after bake (the same way as when the “Apply” button is pressed), it is required that the prefab does
not have any unapplied changes (child objects shouldn’t be moved, materials and script parameters should be
unchanged, etc). If such changes are detected, a error will be shown in the component UI, and no metadata
will be saved after bake. If “Lightmapped prefab validation” warning is enabled, all prefab errors will be also
shown in a window before the bake.
Lightmapped prefabs support all Bakery features, such as LODs, terrains, directional lightmaps, RNM, SH,
per-vertex modes and shadowmasks. For shadowmasks to work, you need lights to also be a part of the same
prefab.
● Note that prefab shadowmasks only work on Unity 2017.4 or newer due to API limitations.
After baking, an object named “BakeryPrefabLightmapData” will be added to the prefab. This object holds a
script with all necessary data to apply the lightmaps.
Controls:
- Save current render settings to prefab: stores a copy of current Render Settings on this prefab. This is
not required, but can be useful to quickly copy settings between scenes.
- Load render settings from prefab: sets current Render Settings to those stored on the prefab..