Animated Spider (IK),
Members - Reputation: 110
Posted 17 June 2012 - 03:46 PM
I decided to study some new techniques so I started a new project which is inspired by this interesting application:
Here's what i wanna do. Model (3dsmax) a six or eight-legged creature (texture, material, etc.), rig it and export it to a test application (OpenGL or DirectX, C++). I want the spider to walk on dynamically generated terrain (e.g., heightmap), which means the locations of the spider legs must be caculated in real-time as the spider follows an interactive path.
Im looking for example solutions, suitable APIs, hints, links, etc., anything bascially that would help me to get started and "build a bridge" between max bones and an IK solver in my own environment.
Thanks in advance!
PS.: If this thread doesn't belong here, please let me know or relocate.
Members - Reputation: 101
Posted 08 November 2012 - 12:16 PM
Did you got any progress?
I was thinking aboud doing something similar to what you told.
But I'm in same situation by not knowing where to start.
Can you point me some directions please? maybe we can help ourserlves in the way.
Thanks in advance.
Crossbones+ - Reputation: 13472
Posted 09 November 2012 - 06:48 AM
This approach uses a particle system with simple constraints instead of more advanced and more expensive calculations (jacobian approach).
Let's take the spider as example, we add two particles and a simple constraint:
1st paricle is the end of the leg, 2nd particle is the joint leg-to-body.
Now add a simple constraint like the distance between these two points should be inbetween the range [s,t]. Now you need to do this for all legs and for all joints on the body (foot-body, body-center).This represents a simplified skeleton of your render skeleton consisting of particles.
Now you need to add external constraints, ie the placement of the feets is a fix contraint (foot particle needs to be at position X,Y,Z).
The next step is to optimize the particles, so that all constrains are (almost) met. This is done by calculating a movement vector for each particle depending on the constaints. A foot particle is fix, so every movement is nullified. A leg-body particle depends on atleast two constrains (foot-body and body-center). If a constraints failed, you need to calculate a movement that the particle either moved towards the other particle (in case of distance(p1,p2)>constraint.max_distance)) or away from the particle (in case of distance(p1,p2)<constraint.min_distance). After calculating all delta movement vectors (1 stage), apply them to the particles (2 stage).
Continue this iterations until all constraints are valid or a threshold is reached (ie 500 iterations).
In our spider example the body particles will move according to the position of the fix feet particles.
The next step is to map the reduced particle skeleton to the real animation skeleton. This can be done in a similar way. Each leg ie consist of 4 animation bones. We know the position of the first bone origin and the last feet position. Each joint will be a particle and the process is repeated for each bone chain not covered by the first particle skeleton.
You could put all joints from the beginning into a huge particle system, but this would be quite slow, because you have a huge number of contraints to resolve. The two step approach helps performance, especially if you have more than one character running around.
I hope that it gives you a general idea to solve such a system with the help of a particle system.