Project 130: Computational Fluid Dynamics, Working Metablob animation!

I have just finished adding animation to my metablob project. It is starting to look really good! The next step is to do stress-testing and performance optimisations, and implement some physics code to make the blobs behave like a fluid. This will be the critical phase of the project. I am confident that I can get the metablobs to *look* like a fluid, but will it be fast enough to render in real time with many blobs on the screen? What about with collision?

If this is successful, I can then apply materials and a water shader to the blobs, and get something that looks really awesome. Then I can start looking for other ways to use this concept.

Ignore the framerate on the video below, I am running the code in a debug build, and it is not in any way optimised.

 

You must be a member of this blog to see the comments. Log in now!

Project 130: Computational Fluid Dynamics

I have made significant progress on my Fluid Dynamics simulation. I have managed to get a metablob implemenation of this rendering in T3D. I had some issues with the normals being reversed, but I fixed this by reversing the order in which the verts were added to the index buffer in T3D. It is not animated yet, but the hard work seems to be done. This was very difficult, and getting to this concept stage was a lot of work.

The next step is to animated the metaballs, and then implement some kind of gravity system to make them behave like water droplets. Then comes the really difficult part, which will be to optimise the system so that I can draw enough metaballs to properly simulate a fluid flow. As I mentioned in the previous post on this subject, I do not realistically intend to create a large "body" of water, this would be far too computationally intensive to render in real time, but I am hoping to create a flow of rushing water, or liquid, as it would behave when flowing through a tunnel for example. I could also do many other interesting things with this concept, so it will be exciting to see where I can take this.

 

You must be a member of this blog to see the comments. Log in now!

Project 118: Finished White Noise Generator Circuit



I have already finished my RNG project, for the time being at least, but I wanted to show some pictures of the finished white noise generator. It's quite neat and powerful. Connecting the orange output wire and the ground cable to a speaker with an amplifier produces a strong white noise source.

I am quite happy with the white noise generator, the issues I was having are to do with the sampling and possibly the software side of the project.
 
The integrated circuit is a UA741 opamp, and I am feeding it with a 12V split power supply (+12v t0 -12V). The noise is generated from a transistor operating in reverse breakdown mode. I found that this produces much more noise than Zener diodes, since zener diodes are designed with noise reduction in mind, while a transistor is not. Operating a transistor in this manner could reduce it's lifespan, however, that remains to be seen.
 
 
 

You must be a member of this blog to see the comments. Log in now!

Project 129: Sleep Learning App

 

The goal of this project was to create an app that could be used to aid study and learning while the user sleeps. Most people sleep for at least 6 or 7 hours a night, and if even a small amount of that time could be harnessed or optimised the gains could be extraordinary. There are a multitude of "Learn while you sleep" tapes, cd's and apps out there, but they all share a fundamental problem: They don't work.


All of the versions that I have seen rely on audio recordings of material to be learned, such as vocabulary for a foreign language, facts and figures, or motivational speeches or self-development courses. However, research has shown time and time again that the human brain is incapable of processing verbal cues while it is asleep, so at best, these recordings do nothing, at worst, they actually reduce the quality of your sleep and therefore your concentration and recall abilities. The human brain seemingly cannot use sleep to learn new memories.


Research has indicated however that classical conditioning (associating one thing with another, for example, after burning oneself with a candle, one might associate all candles with being burned) does occur during sleep. My idea was to create an app that randomly generates a simple melody, and plays it on continuous repeat (obviously at a low volume) while the user studies a piece of material. Later, during sleep, they can schedule the app to play the same melody, again on repeat. The idea is that this melody will have become associated with the material being learned, and when it is played back at night, it will reinforce and strengthen the persons memories of this material, allowing them to learn much faster.


Obviously, it will take several study sessions for the brain to associate the melody with the study material, and even then the brain will not technically be "learning" new information while it sleeps, it will just be reinforcing material already learned. Even so, this technique could make a significant difference in the learning process, and speed up learning.

 

This article from LiveScience.com discusses this subject. To quote from the article:

"As long as the memory is tied to a specific type of sound, it looks like the sound can re-activate and strengthen the previously learned information," Reber told Life's Little Mysteries. "It is possible this effect would help with strengthening memories from a classroom or lecture and that it could even help speed up second-language learning."

 

The app that I wrote is functionally complete, but needs some debugging before it can be uploaded to the Play Store. I will post a link to it when it is done. For now, here are some screens of the basic menus:


 

You must be a member of this blog to see the comments. Log in now!

Dynamic Geometry Creation: Marching Cubes and Metaballs!

I have been interested in the field of computational fluid dynamics for some time, and have been researching the subject in some detail. Computation fluid dynamics is basically realistic computer modelling of liquids. Until recently, this was onyl possibly on extremely high end hardware, and/or could not be run in real time. However, several solutions have now become at least viable, if not available for real time use on personal computers.


Nvidia's work on fluid dynamics, which they call "position based fluids" is quite inspiring. It is available as part of the APEX library. Here is a video of the Library in action (Property of Nvidia):


Due to its complexity, I had not gone past the research stage before now, however, I have recently come across information regarding "metablobs". These are essentially the same as the blobs of wax that you see inside lava lamps, they float around and merge together upon contact. These blobs can be generated using an algorithm called "Marching cubes", which is relatively simple. It was copyrighted in the US until 2005, which led to a free alternative, marching tetrahedrons, being developed. It's quite rare for an algorithm, particularly one as simple as this to be copyrighted. In fact, I believe that in Europe, algorithms can't be copyrighted at all. However, the copyright has now expired, so marching cubes can be used anywhere, or at least, that's my understanding.


I have found some code here licensed under the New BSD licence, which I am using as a starting point. Ideally, I would like to get this code working in T3D, and then modify it to create some kind of water simulation. Metablobs (or Metaballs) are however, very slow, and it is unlikely that I will be able to create a fully-fledged fluid dynamics system from them. However, this would be a demonstration of dynamic geometry creation.


The vast majority of the time, a computer game loads a 3D model in order to display geometry. Creating an actual mesh in code has tremendous possibilties. Not just fluid dynamics, but what about a Terminator-2 style effect, where a model is torn apart, and then changes to a liquid state before reforming itself? Or the ability to shoot holes in characters? You could also create a voxel based level geometry system, like the original Red Faction game, allowing you to shoot through walls or even buildings. This is something that modern games rarely have.


Then there are the opportunities for dynamic content, and this is where things can get really interesting. What about entire models made from metablobs? Dynamic characters, created by the game according to a set of rules? No more one-size-fits all characters, or having to choose from a limited set of body types, clothing an armour options, hair colour, etc etc, but a completely unique character mesh? The game spore does this. The following link is to an article on Chris Heckers website, one of the people who worked on Spore. He says:


"The first thing I worked on when I started on Spore (in October, 2003) was the creature skin. Unlike games with fixed characters, like a James Bond or Lara Croft game, or games with parameterizable meshes, like the Sims or City of Heroes, Spore has to generate the entire mesh on the fly as the player makes the creature. While a typical game's fixed or parameterizable character mesh might be worked on for days in a 3D modeling tool like Maya by a professional game artist, Spore needs to regenerate the skin in real-time as the player deforms the torso and attaches and detaches limbs. I chose a blobby implicit surface (sometimes called metaballs) to represent the skin. "


For this reason, I think metablobs are a great place to start with dynamically created meshes, even if the computational fluid dynamics idea doesn't work out. At least I'll be able to make an interesting "lava-lamp" effect!

So far, the main problem seems to be loading the triangles from the dynamic mesh (generated by the marching cubes algorithm) into index and primitive buffers. Low-Level computer graphics is an area of computer science that I have not got a whole lot of experience in. I had concentrated more on higher level work, but this will be an exciting opportunity to develop those skills.

You must be a member of this blog to see the comments. Log in now!

<< Previous :: Next >>