talk.bindpose.com has been shut down on the 6th of March 2021. You can read a bit more about it here.

You are currently reading an archived copy of the latest content, with all the usernames deleted.

Collision deformer

by user41 posted 19-11-2017 | 4 comments

Does anybody know of any good papers or websites for a real time collision deformer? Thanks.

 

by user3 posted 20-11-2017

I was looking into it at one point and these are some of the resources I remember off the top of my head.

https://www.highend3d.com/maya/plugin/jlcollisiondeformer-for-maya - You can look at the source code http://oaktrust.library.tamu.edu/bitstream/handle/1969.1/155037/WANG-THESIS-2015.pdf?sequence=1

What it basically boils down to is finding intersections between meshes and then calculating how to respond to those intersections. A good thing is that a lot of game developers have struggled with this problem, so there are a lot of topics on forums around the web.

The way I've done it in the past was, finding intersections by casting a ray from the vertex along it's normal and checking how many intersections with the collider mesh there are. It works only for closed geometries. If there is an odd number of intersections that means that the current vert is inside of the collider geometry.

Then for responding, to it, I used three methods for different cases

  1. casting a ray from the vert in the negative normal direction and finding the first intersection with the collider. That becomes my deformed vert position.
  2. finding the closest point to the vert on the collider mesh.
  3. using the first method I find the intersected face of the collider and then I project the current vert along that face's normal to get an intersection with the collider.

The 3rd method had best results most of the time, but it was computationally more expensive.

Hope that helps!

Oh, and recently a colleague showed me the membrane node in Maya, which acts as a collision deformer, if you want to just have a play with something and maybe compare your results, though, im not sure how much you should trust it to be a good one.

 

by user41 posted 21-11-2017

Do you know how to get the bounding box of the input geometry in python Maya api deformer class? Or would I have to get this externally by connecting the deforming mesh's bounding box as an input attribute?

 

by user3 posted 22-11-2017

So, there's this Maya docs page about a bounding box deformer that gets it by using the MBoundingBox class and passing all the verts to it. Here it is http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_GUID_10CE99A6_2C32_49E1_85ED_2E2F6782CF23_htm

The other thing you can try is getting the bounding box directly from the mesh, as MFnMesh inherits from MFnDagNode so you can use the boundingBox function.

To be honest, I would probably do it one of those two ways, but I haven't thought about getting it from the mesh as an input attribute, so it might be worth giving it a go and checking if there is any performance benefit.

 

by user41 posted 21-11-2017

Thanks for your help. :)