World Dissolve

Overview

Dissolving objects is controlled by just two scripts: WorldDissolve.cs and Mask.cs. WorldDissolve.cs handles all the dissolve logic, while Mask.cs helps calculate how the dissolve looks using 3D signed distance fields. You can use up to four masks of the same type at once, but using different mask types together isn't supported.

How To Use It

Basic, step-by-step guide to help you begin. You can skip this and proceed to other sections if you prefer.

Add the WorldDissolve.cs script to any game object in your scene.

Add materials of all game objects that should be affected by the World Dissolve.

Create a new game object and add Mask.cs script.

Include the newly created mask in the Masks List.

Turn on the Control Material Properties option.

Decide which Dissolve Type you want to use

Select all materials from the previous steps.

Change their shader to World Dissolve Burn.

Turn on Alpha Clipping and adjust the threshold.

Depending on the Properties Type and Dissolve Type, you need to use different shaders. Refer to the info boxes in the Settings section of the inspector.

Now click the Refresh button.

And everything is properly set up.

Continue reading to get familiar with all settings and options that you can tweak.

General Properties

Refresh button: This updates all material properties, keywords, and mask properties. Use it when duplicating the script, adding new materials previously used in different World Dissolve instances, or when troubleshooting.

Masks List: Allows up to 4 different masks of the same type. See Masks(SDFs) for more details. If the active masks number is less than the number of masks in the masks list, the active masks are sorted by index number (0, 1, 2, etc.).

Properties Type: Choose how you want to pass mask information to materials: global or local keywords.

If unsure, local type is recommended. Global type reduces CPU impact when the World Dissolve script uses many materials. With the global property type selected, the script passes all mask information (position, rotation, etc.) to materials via Global properties.

Materials List: Lists materials controlled by the script. Every material affected by the World Dissolve logic should be listed here.

Global Properties Id: Choose a different ID for each World Dissolve script instance with global properties type. You can use up to 2 different World Dissolve scripts at once in a scene.

Keywords

Active Masks: Indicates the number of currently active masks.

Type: Specifies the type of World Dissolve mask used (Signed Distance Field). Mask type in each mask is handled automatically by the World Dissolve script.

Use Displacement: Enables displacement effects.

Settings

Control Materials Properties: Controls all dissolve properties of materials listed in the Materials List via the World Dissolve Inspector.

Properties Type: Local

The materials list is used only in the editor for testing purposes. At runtime, all materials are stored in a hash map. You can add or remove materials from the hash map in various ways.

You cannot enable copy editor lists and auto detection simultaneously.

Edge Properties

Properties controlling materials' appearance. Available when the dissolve type is burn, or smooth.

You can select a texture from the Textures Library as the guide texture.

When using Use Back Color, enable rendering of both faces of the materials.

Displacement Properties

Available when using displacement. Learn more in the Displacement section.

Dissolve Type

There are 3 different dissolve types: burn, smooth, and displacement only. Each type has its own dedicated shaders and appearance. For every material used with World Dissolve, change the shader to the appropriate dissolve shader depending on the dissolve type and properties type.

You can modify your own shader graphs, to support World Dissolve. See Shader Graph.

Last updated