The Dissolve Shader is a dynamic disappearance effect for Unity that allows you to adjust the speed, colors, and bring your scene to life. This professional shader is ideal for creating realistic and visually appealing transitions in your game.
Key features include:
- Customizable main texture and color
- Random noise texture for dynamic dissolving effect
- Control over dissolve amount, edge color, and edge width
- Directional dissolve effect
- Range control for dissolve effect
The shader also includes standard lighting calculations and transparency, ensuring a realistic and smooth dissolve effect.
Additionally, the Dissolve Effect Script provides a simple way to control the dissolve effect, with features such as duration, delay, and trigger dissolve functionality.
Shader: Custom/DissolveShaderWithEdge
- _MainTex (Main Texture): The base texture of the object, customizable and determines the appearance of the object's surface.
- _MainColor (Main Color): A tint applied to the main texture, giving the object an overall color adjustment.
- _NoiseTex (Noise Texture): A texture used to create random noise that drives the dissolving effect.
- _DissolveAmount: Controls the amount of dissolve effect, ranging from 0 (no dissolve) to 2 (fully dissolved).
- _EdgeColor (Edge Color): The color of the dissolve's edge, creating a glowing outline effect where the object is dissolving.
- _EdgeWidth (Edge Width): Determines the width of the dissolve's edge, with smaller values creating thinner, more defined edges and larger values creating wider, softer edges.
- _DissolveDirection (Dissolve Direction): A vector defining the direction in which the dissolve effect spreads across the object.
- _DissolveRange (Dissolve Range): Defines the range of positions where the dissolve effect is active, helping control the starting and ending points of the dissolve process.
Shader Functionality:
- Dissolve Effect: The shader uses noise textures and the world position of each fragment to calculate how much of the object should be dissolved, progressing from the base texture outward, influenced by both noise and dissolve direction.
- Edge Effect: When dissolving, the shader calculates an edge effect where the object's boundary glows or highlights with a color, creating a nice transition between the object and the surrounding space.
- Lighting: Standard lighting calculations are included to ensure the object is lit realistically, factoring in light direction, ambient light, and object normals.
- Transparency: The final color is calculated based on the dissolve factor and edge effect, determining how much transparency is applied as the object dissolves.
Dissolve Effect Script:
- Duration: Controls how long the dissolve effect will take to complete.
- Delay: Specifies a wait time before the effect starts.
- TriggerDissolve(): Starts the dissolve effect when called.
Functionality:
- The script smoothly animates the dissolve effect over time using a coroutine, updating the _DissolveAmount property of the material to transition from fully visible to fully dissolved.





