|
DescriptionScreenshotsHere are some screenshots from version 0.1 (hence the low framerates; it's now 4x faster!). Just click on the thumbnail to get a bigger picture. DetailsPhysicsThe screenshots above show the program in operation. The physics for the grid uses the equation 'F = kx' equations where each link is a simple spring. The nodes all also have a hidden spring that applies a tiny force to return them to the default starting plane. This helps with system stability. To calculate the new position of the node between each frame, two passes are made over the grid. The first calculates the tension on each link due to the extension of the sprint (F=kx). The second pass summs all of the forces on each node, including the hidden spring. Once the two passes are complete, the forces are integrated (currently linear interpolation using the time from the last frame) and the new position is calculated. OptionsAll of the options for the system are set in a config file that is read at startup. This allows the system to be easily changed without the need for recompilation! Options that can be set are grid size (X and Y dimensions independently), the spring constant (k), the damping and the mass the nodes. The meshes above are 100x100 nodes although the only limit on size is speed (or more usually, memory. At 500x500 the swapfile start to be used and this kills the application's speed!) The configuration file also allows effects to be placed on specific nodes on the web. For example, the line 'SINE 5050 25 1 0 0 1' would place a sine wave effect onto node number 5050 with a frequency of 25, an amplitude of 1, no phase shift, no offset and no decay. EffectsThe effects of the mesh are chosen in the configuration file (I am working on making interactive menus.) There are currently four effects that can be chosen; Sine, Square, Weight and Stationary. These can all be applied to any number of nodes, there can also be more than one effect applied to a node but this usually doesn't work very well. Each effect is basically an equation that repositions the node that it is applied to based on the time from the last frame. All of the effects are implemented before the forces are applied on the nodes. SINE: The sine effect produces a sine wave at a certain frequency and amplitude. The default offset (vertically) is 0 i.e. centered on the plane of the mesh but this can be set to anything. The Phase can also be set (default is 0.) The equation for this effect is height = A * sine( (t * F) + P) SQUARE: The square wave is a 50% mark space ratio between +amplitude and -amplitude. All of the settings for the square wave are the same as for the sine wave with the exception of decay, which doesn't exist for a square wave. WEIGHT: The weight effect simply applies a mass to the node which creates a vertical force on the node. STATIONARY: This effect just sets the nodes position to 0, preventing the node from moving. I have designed the effect interface so that to add an effect, I simply have to create a file and compile it in. All of the other files need no changing. This allows others developers to design more complicated effects. (Such as an effect that asks for an equation to follow as the application starts up.) Compiling and other boring stuffThe application is compiled using Microsoft Visual Studio .NET. It was originally designed using Borland but as most example applications on the web come with a MSVC solution and it is more effort than it's worth to re-create the settings in Borland so I just got a copy of MSVC. Further improvementsThis is version 0.2 of the mesh; it does everything that I wanted when I started out. However, it is not particularly efficient in the drawing code and I now want to add real-time adding / removing of effects via a GUI. The next version will extend the drawing code to use vertex arrays (locked if possible) and GL_QUAD_STRIP instead of GL_LINES that it uses now. Eventually, I want to use hardware shaders to implement the mesh although first I will have to earn enough money to purchase a grahics card that implements them! |
Sam Dean (c) 2004 e-mail or phone 07786 434 861 |