What's the cleanest way to create an effect where a texture is "eaten away"?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jeff
:warning: Old Version Published before Godot 3 was released.

Think of like, an acid or a flame eating away at a parchment. What I’m looking for is for a texture to become transparent in increasing bits and chunks.

To me, this sounded like a job for both a masking effect, and particles. The plan was to have a particle node emit white particles with a long lifetime, and somehow, using a shader, ensure that the areas that are opaque from the particles are then rendered transparent in the underlying texture.

As you can tell from this explanation, I barely have a passing understanding of how shaders work, and a brief fiddling with the engine suggests that this method isn’t doable with the built in particle engine.

Does anyone have any ideas on how this effect could be achieved?

Currently, I can only think of writing my own particle-lite engine for this effect, but I’m hoping one of you clever folks has an idea.

Thanks for your time.

:bust_in_silhouette: Reply From: timoschwarzer

Something like this?

This is done with a shader using a mask texture. These textures are easy to create using GIMP (Filters → Render → Clouds → Solid Noise),

The effect gained from this shader can easily be changed by using different textures than plain noise textures.

Here is a working example project. Just start the AnimationPlayer and take a look at the Sprite’s CanvasItemMaterial and its corresponding CanvasItemShader.

A nice example, thanks for sharing it.

avencherus | 2017-07-03 05:33

Clean solution, thanks a ton.

jeff | 2017-07-03 05:47