Realtime object disintegration

Depends on if you want it a dynamic of baked simulation. If you’re working in cryengine (not sure about unreal) you can use the alembic cache to bake a simulation. Its one draw call per mesh so it can get pretty expensive unless you merge all the meshes into one animated mesh. (cant have changing topology) If you want it dynamic you can use an alpha erosion using a gradient ramp across the mesh to dissolve the material and then spawn particles over top to blend it all together.

If you wanted to use a gizmo to control the disolve instead of an alpha ramp then unreal would be the way to go for that. (cryengine doesnt have a shader editor :frowning:) There are a few threads on the forums here that have material effects controlled by the distance the gizmo is to the material it is controlling. You could use that to set up the gradient ramp via a shader. I have no idea about the process for setting that up however. :stuck_out_tongue:

Cryengine doesnt have any sort of emit particles from texture option. (not sure about unreal.) If your using unreal perhaps you can spawn particles on the surface of the mesh, however only have them move/become visible when the gizmo gets close to it. In cryengine you would probably have to set it up as a time based thing.

4 Likes

Thanks this was really useful. Looking at Unity I discovered is possible achieve the same effect using Amplify Shader.
Now I’m really near in obtaining what I need if I will be able to emit particles from the border texture.
Unfortunately this appear to be not possible neither in Unity, Unreal or CryEngine.
Considering Unreal this thread

state from official Unreal staff the feature will be available in the upcoming Niagara particle system (no way to know when will be released).
I can’t find another way to achieve it, maybe someone more experienced can have a different idea.

Quick test i whipped up. This is using an alembic cache in cryengine.

1 Like

Wonderful. Do you do the animation in Maya?

I used 3ds max with script called PolyFX, i also used the exocortex crate plugin for exporting the alembic cache. (max 2014 doesn’t have a native alembic exporter) There should be other ways to achieve a similar result in other packages though. :slight_smile:

This is not fair :slight_smile: I didn’t own your machinery. Exploring right now also Houdini Apprentice, this isn’t able to export alembic or fbx.
I suppose no way to simulate this dynamic in Unreal. Otherwise custom shader is perfect, the only problem is particle emission.

Unfortunately i dont know much about unreal engine. :frowning:

I’m just brainstorming here…

What if you used the mesh as an emitter. Spawn particles on the surface of the mesh. Then use a localized wind volume or something similar to blow them away from the surface of the mesh. Just animate the volume to move roughly the same speed as your dissolve. Is it possible to control the particle size or alpha based on its speed? If so you can have them set at 0 size or alpha until they start moving from the wind force. If you can offset the particles from the surface based on the surface normal you could also give it a slight negative offset so they are hidden within the mesh.

Could work…

1 Like

Yes the real problem is in fact only the way controlling the particle emission.
Looking at your first video, do you think there is any way to generate particles from the intersection of the object with a plane or another object?
Connecting this with the custom shader will solve the problem.

Yeah i understand your issue, unfortunately i’m not aware of any way to spawn the particles only at the intersection. That’s why im wondering if instead of emitting particles where the intersection happens, you have all the particles there the whole time, you just move/uncover them roughly where the intersection happens.

Here is another quick test i whipped up. Ignore the animation sync issues, i slapped this together in a few mins just to demonstrate what i mean. Basically i have a plane of geom with a simple alpha ramp. Im using trackview (cryengines animation editor, same as matinee in ue4) to adjust the alpha erosion. I also have the wind volume in trackview and animated to roughly follow along with the alpha erosion. The particles are being spawned on the mesh and are always there, they are just hidden by the mesh until the erosion uncovers them.

1 Like

You’r grate. I need to experiment a bit, starting from Unreal since CryEngine always scare me (even if I adore the result I see and the many features does have out of the box).

Im curious to see your results when your done. You should be able to do that setup i described above in any of those engines, not just cryengine. :slight_smile:

Looking at your experience for sure I’ll need much more than the few minutes you needed :smiley:
I’ll need to in fact learn many things, but this is all fun, time is the real problem.
Regarding the test I’m in doubt if testing on Unity I did knnow better (but I’ll probably need to purchase some third party asset such as Amplify shader) or Unreal I did messed around a bit.
I’ll be eager to test on CryEngine but I suppose you obtained the latest result also working manually on shaders, I suppose Unreal Blueprint will help a lot.
Anyway will keep updated my progress.

I’ve worked on an approximation of this on our current game. Sadly I can’t share source code, but I can share the approach.

The method I worked on (Inside of Unity) had two components, a shader and a particle system. You’d set the effects origin, and the maximum extents of the mesh to be dissolved.

You’d then ‘grow’ the effect from it’s origin, to it’s extents, emitting particles from the verts of the mesh, and alpha’ing out the mesh via shader.

It’s kinda vague, but basically you have an effect with you can throw on nearly anything static which works without any baking. The denser the mesh, the less performant the effect, so I added some scaling based upon client framerate to load balance it. So if there’s already a couple of effects running, or the FPS is too low, or the object dissolving too distant, I’d only run the shader dissolve, not the particles.

Not sure if this helps you out, but it can be done at run time :slight_smile:

4 Likes

Thanks! Did you use Amplify Shader, Shader Forge or something similar?
I’m currently experimenting with the shader in Unreal (easier vs Unity using Blueprint out of the box).

I wrote this shader myself, but it would be pretty straightforward to write in either Amplify or Shader Forge.

I can appreciate why you’d use blueprint, I’ve never used it, but I remember the hurdle when I first started with Unity, and I had some coding experience - it wasn’t easy.

However once you can get the logic nailed with blueprint (or some visual scripting tool), it’s not such a difficult transition. That’s more or less how I started writing shaders, with Shader Forge, then after a while it clicked

2 Likes

Are you emitting particles from every mesh vertex with the same shader? Or you somehow emitting particles only from vertices on the edge of a growing sphere?

The particle emission is dealt with by a c# script. There’s a ‘buffer’ range on the sphere and frame by frame, any verts which fall within that range are used as points for particle emission. The script then loops through those positions emitting a configurable number of partiles each step. These points are then discarded from the list so we’re not emitting from them again next frame.

The script updates the ‘growth’ on the shader in sync with the effects progress. The shader uses this growth value which is then used against a noise texutre

oh wow. that’s just amazing. how i didn’t know about that until just now? thanks for everything guys. it really looks amazing. i’ve been sitting at home because of health issues so i’m tired searching for online pharmacy and so i started to learn things and i found this forum. never thought that a forum can be that helpful. but also… could you help me a little bit if i would have some questions for ya’? ! i have some difficulties here to understand something.

This looks pretty expensive, basically, you need to check the distance of every vert on every mesh which can be disintegrated per frame, right? Is there a way to somehow optimize this a little?

But effect surely looks cool.

Yeah it’s not super cheap, but our assets are fairly low res, so it balances out. As we know the origin of the effect, and as that doesn’t change it would be possible to cache the distance between the dissolve point and each vert once then just compare against that each iteration.