This effect is generally called the sand transition or sand storm transition. It turns an object into many smaller particles and then blows them away. Below is an example.
I was wondering if it was possible to recreate this effect in unity for an object or text? I was also thinking about turning objects into other things, like into slime, water or even flower petals. Like an object gets hit and just explodes into particles, or wind breaking down objects in an explosion of heat.
I don’t really know where to go looking for something like this, I’d appreciate any input.
Have two objects, the original one, and one created out of particles or objects. When your original object runs out of HP or whatever will happen, swap it in place for the particle version of that, and apply a force to those particles.
If you want to do it in 2d, then you could render the original object onto texture, then spawn a lot of particles that take shape of original object, and have them reference original “rendered texture”. Then have the particles fly away. So you’ll have pieces of object fly away this way.
In 3d, doing something like this will be very problematic.You’ll probably need to freeze the object, then, once again, spawn particles that take shape of the object, the problem here is that you’ll probably want particles inside the object as well, and determining default color for those will be problematic. After that, dissolve the skin of the object with an alphatest shader, and have particles fly away.
It’s fairly easy to get every pixel then replace it with a particle of the same colour. Then you can apply a variety of effects to the particle system.
I just tested if this approach is really feasible. I assumed an image size of 1000x200 pixels, which results in 200000 particles in this case. Using Unity’s default Particle System, I modified the following settings…
Max Particles = 200000
mission Rate over Time = 40000
Renderer Min/Max Size=0 (to rule out overdraw)
I tested this setup in a Windows Standalone 64bit Player, the profiler shows a CPU per-frame cost of about 40ms here.
Profiler
My conclusion is, while it would most likely be fairly easy to replace every pixel with a particle of the same color, depending on the resulting number of particles, this approach might not be suitable if the game should run at an acceptable frame-rate.
This. Just reduce the resolution until you get the performance you want.
The game I was working on actually had visible pixels. On a modern looking game you can’t actually see pixels, so it doesn’t make much sense to go that fine.
This is just a guess, but… for 3D I’d look at vertex shaders. Set your model up so that each triangle has its own copy of its verts, then offset them by some amount using a noise formula, either increasing or decreasing the offset over time depending on whether it’s blowing together or apart.
I’m pretty sure that’s something like what’s happening in the last few minutes of this video. Their individual fragments are huge, but they’re applying the effect to a whole environment where you presumably don’t need to do that.