Separating/Splitting a Mesh in Real Time
Posted 18 March 2011 - 03:24 PM
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.
Posted 18 March 2011 - 03:56 PM
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.
Posted 21 March 2011 - 01:48 AM
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?
Posted 21 March 2011 - 05:40 AM
would be insanely cool for a medieval sword+shield game tho :)
Posted 21 March 2011 - 04:32 PM
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`.
3. 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 Rnwhere 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.
Posted 21 March 2011 - 07:38 PM
It helps to draw a diagram and illustrate what you want to do.
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.
Posted 21 March 2011 - 09:14 PM
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.
**EDIT - I think I actually got this figured out. I'll get back to you :)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users