Quick Start
Last updated
Was this helpful?
Last updated
Was this helpful?
Please note that the asset has two different versions.
version which only supports Built-In RP and version which supports Built-In + URP + HDRP.
The manual is identical for both versions.
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
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.
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.
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.
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
Now you have three presets, you can switch between them and edit them.
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.
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.
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.
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.
After selecting a menu item, the dockable window will open. You can move it to a place convenient for you.
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 .
Note! Reflection Blending Range and Lightmap Blending Range are important, these ranges should not be zero. Read more about how it works .