Thursday, January 20, 2011

Playing with Mercury

In my project, I'll be exploring how I can use the computer to interact and represent a mercury-like fluid in real-time, an example of material which can often not be interacted with in a non-virtual environment, either because of safety concerns (as is the case with mercury) or because the material simply doesn’t exist.   The project will take advantage of recent speedups in processing power to allow for real-time rendering of mercury and similar viscous fluids using an implicit surfaces representation and fluid dynamics.  Specifically, I would like to simulate the “blob-like” nature of mercury as well as other physical properties such as high surface tension.  The ultimate goal of this project is to then interface with a haptic device (the Phantom Omni to be specific) to provide the user something that will hopefully look and feel like real mercury or at least like something novel.

So far I've mainly been reading up on various literature and working on setting up the basic MFC GUI framework (more on this coming soon).  As far as I can tell, the basic game plan is as follows:

Implicit Surface Formulation
  1. Use a relatively small number of particles to create a particle-based viscoelastic fluid simulation, tweaking the parameters (e.g. no plasticity, no stickiness) till I get something that looks reasonably like mercury - or at least something that appears to have high surface tension
  2. Use the particles to get an implicit (metaball) formulation of the surface - e.g. the sum of spherical gaussian functions, the center of each located at the center of the particles.
Rendering
  1. Now, to render the implicit formulation, constrain "floater" particles to the implicit surface and use repulsion and fission to adaptively get a uniform distribution.
  2. Polygonize these points into a triangle mesh.
  3. Render the mesh in real time with OpenGL using smooth shading and environmental mapping for the reflection.
Interaction and Haptics
  1. Allow for interaction with the liquid, e.g. mouse strokes exert an external force on the particles
  2. Interface with the Omni haptic device to allow for applying forces and force feedback
So that's the basic plan.  As you can see, there is quite a bit to do, barring any unforeseen issues.  However, hopefully by sticking to a tight schedule, I will be able to accomplish most (if not all) of these goals on time. 

3 comments:

  1. I like your ambitious project. Have you considered using CUDA or OpenCL to run your simulation on the GPU?

    Also, why are you using MFC for the GUI? Unless you already know it really well, I would advise against it. In industry, we would never start a new project using MFC. Lots of game companies are moving to writing tools in C# with WinForms or WPF.

    If you need a C++ GUI, consider using Qt or C++/CLI so you have access to the .NET GUI options.

    ReplyDelete
  2. Thanks for the support Pat!

    You echoed my sentiments from earlier in the week, I should have commented formally ... we did nip this MFC thing in the bud thankfully!

    ReplyDelete
  3. Yeah, Qt was much nicer. I'm thinking right now that using CUDA to simulate on the GPU will be a bit out of the scope of this project but it's a great idea for future work. For now, I think I want to focus on getting something to work on the CPU albeit maybe with less detail.

    ReplyDelete