Custom Blendable

The plugin allows you to switch/blend not only standard lighting data, but also your own.

In the current version of the plugin, Float, Color and Cubemap types are available.

1. Adding parameters

In order for the plugin to take into account your own variables that need to be included in the Lightmap Scenario, you need to mark its accordingly in your script. Please note that your class must be an extension of the base class "MLSCustomBlendable".

public class YourClassName: MLSCustomBlendable
{
    public Light light1;
    public Light light2;
    public float light_1_Intensity;
    public float light_2_Intensity;
    public float mls_b_currentTimeOfDay;
    
    .
    .
    .
}

mls_b_ prefix means that the parameter will be taken into account by the system to participate in blending/switching.

2. Custom Blendable Section

After baking, the parameters will be displayed in a special section of the Lightmap Scenario.

This section displays all scripts in which the saved variables were marked, and in the drop-down list the variables of a specific script.

The "Blending Sync" option allows you to choose in which range to interpolate the variable. There are three options available - With Global Blend, With Reflections, With Lightmaps.

Maybe I'll find the right words to explain later. For now, just try how it works. It is quite easy to understand, but rather difficult to explain.

3. Scene Example

You can find a scene showing how the Custom Blendable works in the Magic Lightmap Switcher Examples Scenes Custom Blendable folder. The scene is fully configured, you just need to click the "Bake And Store Lightmaps Queue" button.

The scene contains two spheres with an emissive material, an Emissive Custom Blendable script is attached to each sphere object. This allows objects to be added to the preset manager and then blending in real time between different emission colors.

Last updated