Quick Start

Please note that the asset has two different versions.

Lite version which only supports Built-In RP and Pro version which supports Built-In + URP + HDRP.

The manual is identical for both versions.

Before proceeding with the next steps, please read the instructions in the "General Settings" section. This is a necessary step before using the plugin.

If you have purchased a version for the built-in rendering pipeline, then a set of test scenes is available for you in the Magic Lightmap Switcher Examples Scenes folder.

If you have purchased the version for SRP, then before proceeding you need to import one of the SRP support packages (URP or HDRP). It's available in the Magic Lightmap Switcher Support Packages folder. Import the package you need, after that the corresponding scene will be available in the Magic Lightmap Switcher Examples Scenes folder.

1. Adding An Instance

Go to Magic Lightmap Switcher Examples Scenes folder and open the Quick Start scene.

Go to the editor menu Tools Magic Tools Magic Ligtmap Switcher MLS Manager

After selecting a menu item, the dockable MLS Manager window will open. You can move it to a place convenient for you.

Scene must contain an instance of the Magic Lightmap Switcher. This is necessary for the plugin to process scene objects.

Click the "Add Instance" button, the Magic Lightmap Switcher object will be added to the scene in the "Magic Tools" group of objects (if there is no such object on the scene, it will be automatically created)

The manager window will look like this.

2. Creating Presets

Now you can prepare some lighting presets for your scene and save it. Click the "Create New..." button to create a new preset. The preset manager window will open automatically.

You can name the presets whatever you like. These names will then be used to display the saved lightmaps.

Click on the light source, it is in the "Scene Lights" object in hierarchy. After that, the "No Selected Lights" button in the "Light Sources" category of the manager will change to "Add Selected Light". Click on it.

You can also select multiple lights and add them with one click, if needed.

The light source will be added to the list and you will have access to editing its main properties. To simplify the example, we will only change the rotation of the light source to simulate the movement of the sun across the sky.

Change the Rotation values ​​like this: X: 20; Y: -30; Z: 0

The settings will be automatically saved. Now press the "Duplicate And Edit" button - the preset will be duplicated.

Change the Rotation values ​​like this: X: 20; Y: -90; Z: 0

Repeat the action and change the values ​​like this: X: 20; Y: -150; Z: 0

You can also edit light source directly from the scene. Any changes you make will be automatically saved by the preset manager. However, this only works while the manager window is open and the appropriate preset is selected.

Now you have three presets, you can switch between them and edit them.

3. Baking

Change the "Storing Mode" to "Queue", check the "Create Lightmap Scenario" option and click the "Bake and And Store Lightmaps Queue" button. This will start the automatic process of baking and storing the lightmaps for all added presets.

When baking is complete, all saved lightmaps will be displayed in the manager window, and the scene will be lit by the first stored lightmap.

4. Testing The Scenario

Lightmap Scenario will be created automatically only if you have checked the "Create Lightmap Scenario" option, if the option is not checked, then you need to do it manually.

4.1 Lightmap Switching

If you have not completed the shader patch, then initially the scenario interface will look like this for you.

You can patch shaders using Tools ➞ Magic Tools ➞ Magic Lightmap Switcher ➞ Prepare Shaders... or continue working in lightmap switching only mode.

If you click the "Use Switching Only" button, the script interface will change as follows.

You can now switch between baked lightmaps. To test this, click one of the "Load" buttons in the "Blendable Lightmaps Queue".

After completing the setup, you can start switching lightmaps directly in the editor, however, this will not work in play mode, since this requires a call to a special API. You can call this API according to your own rules, however, to simplify the example, a simple script was created that is attached to the "Runtime Switching (0-2)" objects in the "Game Logic" object.

This script calls the Switching API and contains two options - "Lighting Scenario" and "Lightmap Index". Using the Unity selection window, select the appropriate scenario for script. The name of the scenario created for a particular scene begins with the name of this scene, for example, for Quick Start scene, this will be the scenario Quick Start_New Lightmap Scenario_0.

Assign a lighting scenario to all three objects.

You can now test switching lighting maps in play mode. Disable the "Runtime Blending" object as it is not configured and go to paly mode.

Move the Cube object along the Z axis. You will see the lightmaps switching.

4.2. Lightmap Blending

To check that everything is working correctly, switch to the Switching/Blending tab in the manager window. The plugin automatically created a default Lightmap Scenario for you and added all saved lightmaps to it.

Note! Reflection Blending Range and Lightmap Blending Range are important, these ranges should not be zero. Read more about how it works here.

Move the Global Blend slider. You should see the lighting data blend smoothly in real time.

After completing the setup, you can start switching and blending lightmaps directly in the editor, however, this will not work in play mode, since this requires a call to a special API. You can call this API according to your own rules, however, to simplify the example, a simple script was created that is attached to the "Runtime Blending" object in the "Game Logic" object.

This script calls the Cyclic Blend API and contains two options - "Lighting Scenario" and "Blending Length". Using the Unity selection window, select the appropriate scenario for script. The name of the scenario created for a particular scene begins with the name of this scene, for example, for Quick Start scene, this will be the scenario Quick Start_New Lightmap Scenario_0.

Now you can start playing. Once launched, the script will automatically run.

Last updated