Impact Deformable - Dynamic mesh deformation by collision [released]

Impact Deformable reached version 2.0, just published on Unity Asset Store, with full Unity 5 compatibility, optimizations, faster and preciser deformations. Please, check the online documentation (PDF) for more details.

View in the Unity3d Asset Store

Please let me know if any help is needed on using it in your projects.
Thank you.

really nice! i guess a nice next step could be speciying the resistance of specific part of an object ( vertex alpha, RGB map, alpha ???) No?
Great work!! :slight_smile:
Edit : maybe i didn’t read correctly your desciption : “- Maximum vertex distance from original position can be specified.”
Could you tell how ?

Hi!

There is a float property at script (MaxVertexMov) that sets maximum vertex deform distance (in object space) from its original position (0 specifies no limit).
It affects the whole mesh.

A map to configure resistance for specific parts would be a nice idea, and not too hard to implement.

Then i think you should really consider implementing that since many guys would use this for real time deformation in racing games and cars usually don’t deform evenly everywhere, parts are more or less flexible etc… You have a really nice thing here! Keep it up!

Yes, I will definitely implement in next release.
Thank you!

Really impressive!

Bookmarked!

Nice work! Will keep this one in mind. Does it run on mobile devices (iOS/Android)?

Gigi

There are some flags to tweak deformation process and make it use less CPU power like disabling collider deformation and setting to update mesh and collider only at determined intervals (instead of every impact). So there should be no problem. Also it was tested on XPeria Play (Android) and runs smooth.

This is one of those things that makes you wish you had a game to implement it in. Awesome job.

I don’t see a video/webplayer with an object that has a texture, though. They all seem to just be single colors. Does it handle that well, too? (I’d assume so, but thought I’d better ask.)

Thank you!

Yes. UVs are tied to vertices so it works fine.
There is a faint texture at cube in the first demo. Lets change it with a test texture:

Hi all.

Just to show another Impact Deformable use case: Hard.Point, built for Ludum Dare game competition #28 and growth to a full project.
In this game Impact Deformable was used to deform/repair vehicles with damage.

1627954--100049--$Impact.png

This is interesting, are you still working on it at all?

I would be interested in using this for something like flesh. I’m pretty sure I could figure out how to make it return to its usual shape after impact by looking at your repair function and just making it automatic (maybe, I don’t know if that would look right).

But what about “preserving volume” - for example if something is impacting your object in the X direction it should expand in the Y and Z direction proportional to how much X is being pressed (squish).

Yes, if you keep calling repair each frame the reform process behaves like soft body. This is because its applied by a proportion of current deformation. One could achieve different effects on that matter playing with lerp / smoothdamp.

Now that’s not trivial… Volume involves integral calculus and lot of heavy work on tuning it to be real time.
I’ve been reading some alternatives like described here Microsoft Research – Emerging Technology, Computer, and Software Research but not tested it yet.

Interesting. But I guess for my needs, and most users I would imagine, a very simple approximation - or even just faking it somehow - would be all we need. Maybe something like the hardness map, where we could paint areas (and intensity) that behave inversely (if one direction contracts, the other expands, etc). But maybe that’s more complicated than it needs to be, I don’t know.
…
My goal is to have a fat blob of a monster that can press flat against things, or squeeze through tight spaces believably - but I can also think of a number of interesting ways to use this…

I see. The repair function let you specify (optionally) the point and area to apply reformation so one could set it to other side of mesh (since from impact point) calculated by ray casting - that way, if you call it in the same time that deformation happens on the other side of the mesh you could get somewhat the rubber/squeeze effect, maybe it would look really cool on high detailed meshes but honestly is hard to predict.

You can specify a hardness map but is designed to let you specify softer and harder pieces on mesh by a control texture… What you suggest would be nice but then again not trivial.

So here we are talking also about collider deformation (the monster must update its collider to squeeze like that and it must be mesh collider)… This is possible and working out of the box with Impact Deformable but a high CPU usage is involved (PhysX).

All in all, Impact Deformable works best with Rigid Body deformation (it was built for this after all). It can be tweaked and customized to simulate some of effects that you described but true is that to achieve 100% of the monster squeezing thing a full soft body/fluid solver would be needed (one that I would love to see in Asset Store).

Oh I understand the concept of the hardness map, I just meant that maybe a similar additional map might help artists tweak the effect we were talking about.

Hmm, I didn’t think about the Rigid Body vs Collider deformation thing. High CPU cost might be acceptable, worst case maybe I would have to limit it to cut scenes or something… but then again we’re supposed to get updated, faster PhysX with Unity5 (which I’m waiting for anyway).

I think I’ll buy this anyway and try playing around with collider deformation when I get some free time (maybe in a year or so, haha).

New version 2.1 gains an optional vertex color change with deformation:

Unity standard shader does not support vertex color. You will need a custom shader that does. For example, there is a cool modification of the Unity standard shader made by defaxer, that supports vertex color, freely available here on Unity forums.

Hi , how can i use this with ontrigger enter ?

1 Like

Hello, I just got your e-mail and answered there with a working example.
To anyone also needing this:

    private void OnTriggerStay(Collider other)
    {
        // Get the impact deformable on object we are colliding with (exit if none)
        ImpactDeformable impactDeformable = other.gameObject.GetComponent<ImpactDeformable>();
        if (impactDeformable == null)
            return;

        // Get a Y Align vector of both colliders position
        Vector3 p = transform.position;
        p.y = 0.25f;

        Vector3 o = other.transform.position;
        o.y = 0.25f;

        // Call deformation process, from this position to collider position, Radius scaled
        impactDeformable.Deform(p, (o - p).normalized * DeformationRadius);
    }

Well received , thank you very much for the fast and very helpful reply

1 Like