Manual

From Bakery GPU Lightmapper: Wiki
Revision as of 21:52, 28 May 2019 by Mr F (talk | contribs)
Jump to navigation Jump to search

System requirements

To use Bakery you'll need:

  • Windows (7 or higher) PC.
  • Nvidia GPU. Minimum supported model is Kepler (GeForce 6xx or newer. For Quadro cards check the specs).
  • 64-bit Unity editor. Bakery was tested on all versions from 5.6 to 2019.1.

Prerequisites

  • Make sure your project does not have any script compilation errors, as it will prevent Bakery scripts from compiling as well.
  • Make sure you have the latest GPU driver. Update it if needed.

Installation

1. Import Bakery to your project via Asset Store.

2. Unity will show a list of files to import. If it's your first time using Bakery, it is recommended you just click Import. Experienced users may want to untick the examples folder for a more lightweight installation.

3. Unity will then import Bakery and compile the scripts. It may show a window like this:

Goahead.png

In which case you should click "Go Ahead".

You should now see Bakery menu added to the editor:

Bmenu.jpg


Quickstart

1. Add some model or primitive and mark it as Static.

Staticmarked.jpg


2. Select Directional Light (the one Unity created for you) and add Bakery Direct Light component to it.

Bulbgraph.png Bakery and Unity use separate light source components.


3. Bakery Direct Light has many options to tweak, but you can easily match it to Unity light. Click Match lightmapped to real-time. Now Bakery light should have the same yellowish color as Unity’s default Directional.

Matching.jpg

Bulbgraph.png Direct Light component may complain about project not using linear light intensity. The problem is that by default Unity applies gamma correction to light source colors incorrectly. Correct mode can be enabled by scripting, and that’s what the “Fix” button does. If you already have many light sources set up in non-linear intensity mode, and you don’t want to change them again, you may skip fixing. Even if you press “Fix”, you can always revert the change anytime.


4. To get shadowed ambient lighting, create Skylight (Bakery->Create->Skylight).

Menusky.jpg


5. Select Skylight, give it some bluish color and click Match scene skybox to this light. This will make scene skybox match lighting exactly.

Bulbgraph.png Matching Unity skybox to Bakery skylight is optional but useful for correctness, as to ensure that visible environment and in-engine reflection probes match baked lighting.


Skycomp.jpg


6. Click Bakery->Render Lightmap. By default, Full Lighting mode is active. It will bake both direct and indirect contribution from all lights. If you want to combine real-time shadows with baked GI, change it to Indirect.

Bakerywindow.jpg

Bulbgraph.png Bakery may complain that you are using old gamma mode and suggest to change it. If you care about quality of lighting, using Linear mode is highly recommended. You may ignore it if you already have a big project set up with incorrect gamma and don’t want to change it or when shipping to mobile devices that don't support it.

7. Click Render.

8. Done! You should now have baked GI:

Bakedgi.jpg

Render settings

All render settings can be accessed via Bakery->Render Lightmap. Settings are saved for every scene. The topmost option in Bakery window allows you to switch between Simple, Advanced and Experimental settings, each succeeding mode revealing more tweakable options. Simple mode is enough for most scenes and it's a good way to get started.


Render mode

Defines the type of lightmaps to bake.

Full Lighting

Complete direct and indirect lighting for all Bakery lights.

Bulbgraph.png On pre-2017.3 Unity versions if you have both Unity and Bakery components on the same object, you will need to disable Unity ones manually to avoid double brightness. On newer versions real-time effects are automatically disabled for baked lights, as with built-in lightmappers.
Indirect
Comparison of different render modes supported by Unity

Basic mixed mode. It will look at the Baked Contribution selector on every light: if it’s set to Direct And Indirect, the light is baked as in Full Lighting mode. If it’s set to Indirect Only, only indirect contribution (GI) from this light is baked. In latter case you should keep both Unity and Bakery lights on the object, one giving real-time direct contribution, and another for precomputed GI.

Indirectonly.jpg

Shadowmask
Left: completely baked light. Center: dynamic light with baked GI. Right: capsule shadow, bump and specular are dynamic, but cube shadow and GI are baked.
When camera gets far away enough or if dynamic shadows are disabled, the same scene will look like this

A more advanced mixed mode. It works by generating two types of lightmaps - one with baked color (as in Indirect mode), and another with shadows from static objects. It has several benefits:

  • Real-time shadows can render only a handful of dynamic objects, instead of the whole scene.
  • Real-time and baked shadows blend together properly.
  • Real-time lights can render bump, specular and other surface effects, while still being occluded by high-quality baked shadows.

More details

Currently only Direct, Point and Spot lights can interact with shadowmasking (because they are the only types Unity supports in real-time). To enable this behaviour, you must have both Unity and Bakery lights on the same object, with Baked Contribution set to Indirect and Shadowmask. Unmarked lights will be baked as in Indirect mode.

Smask22.jpg

Distance Shadowmask

This checkbox is only visible if you chose shadowmask and simply toggles equally named setting in project’s Quality Settings. More details.

Bulbgraph.png Checkbox is not visible on Unity 5.6.x due to the lack of corresponding scripting API. Instead you can toggle it in Window->Lighting->Mixed Lighting->Lighting Mode.
Bulbgraph.png Due to old Unity limitations, rendering Shadowmask lightmaps on versions prior to 2017.3 may clear the light probes. They will need to be re-rendered again after bake. It shouldn’t happen on 2017.3 and newer versions.

Directional mode

Defines how directional information is baked. Standard lightmaps only store a single color per texel, while directional lightmaps give shaders a hint of how lighting changes over a hemisphere around the texel. This data is required to combine fully lightmapped areas with normal maps. Plugging it into the built-in Bakery shader can also produce approximate specular response.