Search Unity

Impact Deformable - Dynamic mesh deformation by collision [released]

Discussion in 'Assets and Asset Store' started by L-Tyrosine, Oct 23, 2012.

  1. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    Last edited: Jun 10, 2015
  2. rosor

    rosor

    Joined:
    Nov 15, 2009
    Posts:
    3,615
    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!! :)
    Edit : maybe i didn't read correctly your desciption : "- Maximum vertex distance from original position can be specified."
    Could you tell how ?
     
  3. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    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.
     
  4. rosor

    rosor

    Joined:
    Nov 15, 2009
    Posts:
    3,615
    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!
     
  5. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    Yes, I will definitely implement in next release.
    Thank you!
     
  6. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    920
    Really impressive!

    Bookmarked!
     
  7. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Nice work! Will keep this one in mind. Does it run on mobile devices (iOS/Android)?

    Gigi
     
  8. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    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.
     
  9. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,038
    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.)
     
  10. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    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:

    $CubeTexture.png
     
  11. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    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.

    $Impact.png
     
  12. Hrothvitnir

    Hrothvitnir

    Joined:
    Apr 26, 2013
    Posts:
    109
    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).
     
  13. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    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 http://research.microsoft.com/en-us/um/people/chazhang/publications/icip01_ChaZhang.pdf but not tested it yet.
     
  14. Hrothvitnir

    Hrothvitnir

    Joined:
    Apr 26, 2013
    Posts:
    109
    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...
     
    Last edited: May 16, 2014
  15. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    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).
     
  16. Hrothvitnir

    Hrothvitnir

    Joined:
    Apr 26, 2013
    Posts:
    109
    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).
     
  17. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
  18. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    294
    Last edited: Dec 18, 2015