The clip below was put together pretty quickly using Unity’s built in timeline editor along with a custom Unity Shader Graph download. This editor is much quicker than manually stringing together a bunch of animations and making sure the timing is all lined up.
For efficiency, the timeline is the best way to go.
The shader used in this short clip is a Shader Graph dissolve shader. You can download it for free here.
If you have yet to dig into the inner workings of a dissolve shader, the overall concept is relatively simple. The easiest way is to use simple noise and iterate over the full transition through an alpha clip threshold. In this example, we are going to change that value through a script. I prefer this approach because then we can easily add tweens to the timing with a single line, vs creating it in the shader.
The noise will be applied to the alpha channel, and an alpha clip threshold will be used (controlled via script) so that portions of the mesh will be visible and some will not. This depends on the value that is given by the noise.
As you step up through the noise, more and more of the texture will become above (or below, depending on if dissolving in vs dissolving out) the alpha clip threshold. This allows more of the mesh to become visible over the period you are changing the alpha clip value.
Here is the portion that is used for the alpha calculation:
A quick overview of how to use the shader:
Alpha Clip Dissolve: I am using a simple script to control the amount of dissolve. The Alpha Clip Dissolve is the variable that controls how much of the mesh is visible. This changes the location of the edge. To dissolve in (become visible), this value should start at 1 and end at 0. Or in other words, 1 means the object is dissolved completely, and 0 means there is no dissolve that is applied to the material.
To update the dissolve, I tween the value in the update function. The flag dissolvePlayed will be used to execute the one-time-only portion that runs when the dissolve starts. And the mats variable is a list of materials. I am using an amazing (and also free) tween plugin called DOTween.
You will find the following variables in the inspector for the shader:
Edge Width: The width of the emissive edge that animates across the mesh.
Edge Color: Change this to have a different color or more/less emissive edge.
Blink Intensity: The intensity of the blink that occurs, which covers the entire mesh. 1 is full intensity and 0 is off.
Blink Active: Toggle to turn on or off Blink. The blink is an emissive property that can make the material appear to be radiating energy. It’s literally just mixing the emissive color with the albedo that is visible. This allows for the blink to be used during the dissolve.
Active: Allows the dissolve to play operate in the controller script, and allows the blink to be used in the material.
The noise scale is the scale applied to the noise that is used to determine what parts are visible and what isn’t during the dissolve.