Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my project I want to deform a complex mesh, using a simpler 'proxy' mesh.

In effect, each vertex of the proxy/collision mesh will be a control point/bone, which should deform the vertices of the main mesh attached to it depending on weight, but where the weight is not dependant on the absolute distance from the control point but rather distance relative to the other affecting control points.

The point of this is to preserve complex three dimensional features of the main mesh while using physics implementations which expect something far simpler, low resolution, single surface, etc. Therefore, the vertices must deform linearly with their respective weighted control points (i.e. no falloff fields or all the mesh features will end up collapsed) - as if each vertex was linked to a point on the plane created by the attached control points and deformed with it.

I have tried implementing the weight computation algorithm in this paper (page 4) but it is not working as expected and I am wondering if it is really the best way to do what I want.

What is the simplest way to 'skin'* an arbitrary mesh, to another arbitrary mesh?

*By skin I mean I need an algorithm to determine the best control points for a vertex, and their weights.

share|improve this question
    
Although an excellent question, I fear there is no answer for what you want. Admittedly, there are some papers on the issue.. the solution is just too complicated for a simple answer. I would go for nice (vector field deformations)[vc.cs.ovgu.de/files/publications/Archive/….. they're cool but hard to implement. One other idea is to morph the meshes.. which is in itself an MSc thesis topic.. Perhaps I'm wrong and seeing only the complicated side of things. Anyhow, great topic and question for the curious developer! –  teodron Apr 22 '12 at 9:25
    
@teodron, Thanks for that link! (to anyone else, remove the ] at the end of the url to read it) Those results are a lot more impressive than previous papers' use of vector fields. I am understanding more and more just what the scope of this subject is as I research it for my problem. At the moment I calculate the inverse of the proportion of each distance, to the sum of the distances of the control points to the vertex, then normalise the results to get the weights. –  sebf Apr 22 '12 at 11:16
    
This has the best results of anything I have tried so far, but this is without a proper 'physics mesh' (its just the main mesh with me culling everything with the wrong normal). Experimentation will tell how much milage this will have when I figure out how to generate the physical mesh... (At least this application of it should be an interesting write-up if I ever get it to work! ;)) –  sebf Apr 22 '12 at 11:16
add comment

1 Answer 1

up vote 1 down vote accepted

One thing you could do, is generate the 3D Voronoi diagram of the vertices of the simple mesh. This will partition space into a number of cells, where everything inside a cell is closer to the vertex corresponding to that cell, than to any other vertex. You can then compute a 3D equivalent of the Delaunay triangulation, which will give you a set of tetrahedrons. Every point inside such a tetrahedron can be expressed as a linear combination of the four vertices of the tetrahedron.

For every vertex p in the high-resolution mesh, you can look up the tetrahedron that the point is in, which will give you four vertices of the simple mesh (call them v0, v1, v2, v3). If you translate every vector by -v0, it is possible to write the new point p' = p - v0 as a linear combination of v1', v2', and v3'. This gives you a new eqation for p', namely p' = u * v1' + v * v2' + w * v3', where u, v and w are the weights. Now you can write the point p as v0 + u * (v1 - v0) + v * (v2 - v0) + w * (v3 - v0). If the simple mesh is deformed, v0, v1, v2 and v3 will change, and p will change accordingly. This deformation will depend on at most fourr nearby simple vertices, and thus a deformation on one side of the simple mesh will have no effect on the other side of the high-resolution mesh (unlike the distance-based falloff, where every simple vertex still affects every high-resolution vertex).

Please note that this is not a simple way to skin the mesh. If you are looking for a simpler solution, I would suggest manually assigning weights to the vertices. (A package like Blender allows you to weight-paint vertices.)

share|improve this answer
    
Great answer! This is how I ended up doing it, with the exception that the vertices of the tetrahedra moved independently (perhaps you meant the same, and I misunderstood the part about the translation of every vector by -v0) in my control mesh. I should also say for anyone interested, the weights are just the normalised distances of 'p' from v0 to v3 (i.e. the weight is the proportion of that relationship to the sum of the distances). The results are high quality and this method does everything I require esp. in my key area of feature preservation. –  sebf Oct 15 '12 at 18:00
    
For the translation part, I meant doing the translation temporarily, to simplify the process of finding the weights. Good point about the weights, that way you can skip the translation part altogether. –  Ruud v A Oct 15 '12 at 19:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.