Skip to content

Posts tagged ‘Framework’

Simple Dynamics framework: verlet

January 6, 2009

Charles

The basic verlet algorithm im using is,

x_{1+1} = x_{1} +(x_{1} - x_{1-1}) + a dt^2

where x is the current and previous position a the accumulated forces, and dt, the timestep or period over frequency. This is great if the simulation is un-fluctuating i.e baked; if it was realtime i’d introduce the TCV (time corrected verlet) version,

x_{1+1} = x_{1} + (x_{1} - x_{1-1}) (frac{dt_{1}}{dt_{1-1}}) + a dt_{1}^2

The nice thing about verlet is that velocity is calculated from the current and old positions, and because of this you can keep throwing collsion and constraint methods at it. It handles the rest. My current approach is to fire the integrator ( verlet) then collisions and constraints – the latter two iterated several times.

 

A simple framework for dynamics

December 20, 2008

Charles

I started to think about building a very simple framework for dynamics based on this article: http://www.gamasutra.com/resource_guide/20030121/jacobson_01.shtml

It uses the verlet method and then successive systems to check for constraints, collisions etc. – I like this approach as it seems pretty modular. I think the basic method ill go for is defining objects/verts/lines/etc with attributes, whether there masses or constraints connecting masses together. Then the main system calls the general functions on them.

Im not sure if this is correct but i think the aproach with the main system is to:

1. Calculate all the forces of all the masses
2. Apply verlet algorithm with a timeStep
3. Do a scene check i.e if the masses are in a box if its simple or/and
do some collision/friction checking
4. satisfy the constraints

Im not sure if 4 & 3 are the right order so, ill have to think on that – but this is my basic approach to building a simple system. I thought of attributes because they could be place on anything then, and i could add some function for display methods, like cylinders and spheres.

Simple frameworks I’m currently working on..

December 14, 2008

Charles

Im current working on some basic frameworks for corrective morph building, weight maps and skinning without the necessity of vertices.

Generating the corrective isn’t the hard part – that is just a simple math formula: base + (combination – target). The tricky part is first making the corrective process seamless to the user; you want them to ramp there blendshapes together, see the problems and quick edit the combination to the desired result. The backend should handle the creation of the corrective, and the order.

Storing the orders of correctives and the absolute results is absolutely crucial in making a system that handles being edited, and rebuilt.

Why do you need order and absolute result of the corrective?

Imagine that you have 3 base shapes. You blend two of them together and build a corrective. Then in turn you use this corrective with the third base shape to make a new corrective. Firstly this is already getting complex and secondly what happens if you change any of the shapes that when into making the correctives?

Essentially you’d be applying the wrong offset to the combination of base shapes resulting in a broken corrective. This is where you need to store the absolute target of the corrective when it got made. Because then you can retrieve this shape and use it in turn to build the corrective again.

You need order because it is crucial! – absolutely crucial to a complex system. If you don’t store the order of correctives you wont know which one to rebuild first, second, third. For example if you build the last corrective first, then the first the last will be broken.

So if we go back to our example with 3 base shapes – these shapes essentially would have an order of 0 – all of them. Then if i was to make a corrective of the first two it would get an order of 1, now using this corrective and the third shape to make the next corrective it would get an order or 2. you see how the order works?

Essentially its whether or not the combination of shapes includes a corrective and if it does you get the highest order of the correctives and add 1 to it. For example if i was making every combination of three (0) base shapes:

0 0 0 – base shapes
1 1 – first order correctives
2 – second order corrective

So if you store the order and the absolute target value of each corrective you can rebuild them after changes have been made to the base shapes. Additional values need to be stored such as the base shapes used and the slot the corrective was placed in, to make the system complete solid.

Building the framework is the key, once you have that in place you can use it to build the toolset to do all the handling of the shapes and corrective.