Separating/Splitting a Mesh in Real Time

827b37559d379b73635b91657e1b6005
0
Lokked 101 Mar 18, 2011 at 15:24

What is the term for this, or what should I be searching for:

A 3D Object fragmenting into independant objects
Getting a limb blown off
Showing other physical dismemberments

To be calculated in Real Time.

Let me know if my description is too vague.

6 Replies

Please log in or register to post a reply.

6837d514b487de395be51432d9cdd078
0
TheNut 179 Mar 18, 2011 at 15:56

They’re called giblets :happy:

Just take your mesh and break it down into parts. You most likely already did this if you created a skeleton for your mesh. If the part is already closed (no open holes for each part), then to simulate dismemberment you just have to render the part away from the body. If you want to do real-time slicing and dicing, then you need to loop-cut your mesh along the fracture or seam, close it (triangularize the open areas: see how to triangularize a polygon), provide UV coordinates and normals for the new triangles, and texture it. I don’t think there’s any tutorials on this. It’s all mathematical.

827b37559d379b73635b91657e1b6005
0
Lokked 101 Mar 21, 2011 at 01:48

I want to hack a limb off my model, and have it calculate in real time. The cut can be made anywhere, in any direction. Not necessarily at a bone joint.

My thoughts are:
1. Create verticies forming an elipse, equal to the plane the slice would form, around the limb.
2. Separate the cleaved Bone into 2 parts (I don’t know how this is accomplished in real time. I could shorten the original bone and create another, but this would end up shortening the whole mesh, and/or I’m lost).
3. Triangulate any quads that were created.
4. Treat the Separated Mesh with 6 DOF.

Does this sound like an accurate procedure?

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Mar 21, 2011 at 05:40

maybe it sounds ok? if a little unexplained just yet…

would be insanely cool for a medieval sword+shield game tho :)

827b37559d379b73635b91657e1b6005
0
Lokked 101 Mar 21, 2011 at 16:32

I haven’t actually tried this out yet, just bouncing ideas around :p

Defining Vertices of a Solid where Intersected by a Plane:

  1. Create a Transform T from the current coordinate system to a Frame A(x`, y`, z`) where:
    z` = Slicing Plane’s Normalized Velocity Vector Vn (Direction of Slicing Action)
    y` = Axis along which Plane intersects solid
    x` = Orthogonal to y` and z`

  2. Create a Plane R, such that the Plane’s equation in Frame A is:

    R(x, y, z) = (0, 0, 0)x + (0, 1, 0)y + (0, 0, 1)z

for all Real x`, y`, z`.

  1. Calculate the points where the Plane R intersects lines of the Solid.
    For each line, consisting of direction vector l extending from one end of the line lo, calculate the Point P where this line intersects the Plane R:

    d = ( (0, 0, 0) - lo ) DOT Rn _________ l DOT Rn

where Rn is a vector Normal to Plane R, which is (1, 0, 0), and d is the distance from lo to the Point P along the line vector l:

P(x`, y`, z`) = lo + (Rn * d)

Each of these points can be applied T(inverse) to be represented by the original coordinate frame.

6837d514b487de395be51432d9cdd078
0
TheNut 179 Mar 21, 2011 at 19:38

You’re on the right track. All you need is a point on the plane that will sever the object and the plane normal. Transform the plane into object space. Then proceed with your 3rd step. You can speed things by finding the first intersection point and then follow neighbouring edges to find new intersection data rather than test for intersections against all edges in the mesh.

It helps to draw a diagram and illustrate what you want to do.

loopcut.png

You will need to update your VBO to include new geometry data and you will also have to update any bone data (if there is one). I’m not sure what the best way of going about that is. The “upper” portion that was cut will need to fall down while the other half will have to play some sort of animation. You will need to find out which bone intersects the cutting plane and act accordingly on that. I would probably construct a new “hip bone” to replace the sliced bone and adjust the bone weights accordingly. I would then use the new hip bone to animate the part falling while the other half does whatever.

827b37559d379b73635b91657e1b6005
0
Lokked 101 Mar 21, 2011 at 21:14

Thank you for providing the visual, TheNut!

I thought about how to determine through which lines the Plane would intersect, and all I could come up with was a brute force search :(.

In your proposed method of “finding the first intersection point and then follow neighbouring edges to find new intersection data”, I am having touble understanding what this means.

The only sense I can make is to pick a direction (CW or CCW) from the Point of Contact (Known Vertex) and calculate the Plane created from the Triangle that’s been sliced. Then it’s simple algebra.

Programmatically, how do I determine the Vertices of a Triangle that I’ve intersected, using only 1 point on one of the lines of the Triangle? I’m using DirectX (in case there’s a function for this).

If this is not the approach you had in mind, please let me know.

Thanks much.

**EDIT - I think I actually got this figured out. I’ll get back to you :)