Moonshine: Metaballs System for Maya
(Updated 2010/03/20) A few weeks prior to starting at Method Studios, I started working on a metaballs program. It started out as a simple OpenGL application - capable of rendering a few metaballs in real time. I assembled it using various resources I had found across the web. It took me a few days to sort through all the information to fully understand the various implementations that other people had done. Once I had a bit more than a basic idea of how it all worked, the code came together rather quickly.

After I arrived at method, I showed my friend and new co-worker, Andrew Bell, what I had. Andrew's first comment was to make it a Maya plug-in. At the time, I didn't have an in depth understanding of how the Maya API, so Andrew did the initial implementation of plug-in for Maya. After a few days, off and on, Andrew got it to the point where he could hand off the plug-in. Once I got my head around the Maya API, the fun began. In Maya plug-in form, the metaballs system was formally named Moonshine.

The following animations and images shows the development evolution of Moonshine. The technical details are at a minimum so just about anyone can understand it. If you have any in depth questions, feel free to contact me.

All QuickTimes are in H.264 format. If you have problems viewing them inside of Firefox 2, try turning off the Direct3D/DirectDraw support in the QuickTime Preferences under the Advanced tab.


UPDATE - 2010/04/31
: Posted a build of Moonshine for Maya 2008 and Maya 2008 on Windows 32bit and Windows 64bit.

Download Moonshine for Maya 2008/2009 on Windows 32bit/64bit


UPDATE - 2010/03/20
: I've posted the a build of Moonshine. It's currently for Maya 2009 Windows 64Bit only. As soon as I have time I will expand the documentation and build for more platforms. The eventual gaol is all platforms for Maya 2008 and 2009. There's an expiration date on it currently - I was thinking about selling it at some point. But for now it's free. I'll remove this shortly. Thank you for your interest.

Download Moonshine for Maya 2009 Windows 64bit

UPDATE: Moonshine Beta is now available for download. Please email me if you're interested. My email address can be found at the front page of this site.


Figure 1

Figure 2

Figure 3

Figure 4
Once Moonshine was functional inside of Maya, the immediate goal was to develop it into a production grade plug-in. This meant improving both speed and consistency of the meshing algorithm as well as developing a workflow that is artist friendly.

Mesh consistency not only includes producing the same output for the same input, but also there should be no noticeable gaps in the resulting geometry. Moonshine's meshing algorithm was designed to enforce mesh consistency at several levels. The algorithm uses a look-up system to determine if a vertex exists and uses it before it attempts to generate a new vetex. This avoids having duplicate point data in the resulting mesh. The polygonizer, by design, cannot generate overlapping triangles. An octree is used to cull any metaballs that are too far to impact the current triangle vertex.

To improve speed, the octree doubled as an acceleration structure. Culling the metaballs results in less math evaluations per point in the mesh. The octree also provided the necessary information on what areas of space to avoid evaluating entirely. Less evaluations translates into the plug-in running faster.

Figure 1 shows the first test animation done with Moonshine in Maya. On the left are two metaballs that and on the right is a NURBS sphere. The goal of the test was to ensure that the refraction and reflection properties of the metaballs held up as expected in comparison to the native primitives in Maya. The animation was rendered using mental ray.

Figure 2 shows 100 metaballs rendered with an the mental ray ambient occlusion shader.

Figure 3 shows the same metaballs as Figure 2 but in a different render setting.

Figure 4, the same 100 metaballs as before, this time enclosed in a checker shaded cube. The camera is initially located in front of a group of metaballs.



Figure 5

Figure 6

Figure 7

Figure 8
Figure 5 through Figure 8 shows frames from two animations after the octree was first implemented.

With its improved speed and culling abilities, Moonshine could now handle a much larger amount of metaballs.


Figure 9

Figure 10
Figure 9 and Figure 10 shows Moonshine in use with Maya's particle system. The particles are splashing against an invisible sphere. The dynamics of the animation are completely driven by Maya's particle system and the geometry is meshed out using Moonshine.


Figure 11

Figure 12

Figure 13
More sample animations done with Moonshine and Maya's particle system.


Figure 14

Figure 15
Figure 14 was used to compare the animation Moonshine to Maya's blobby particles. The same particle dynamics were used for both clips.

Figure 15 is a test animation that done for a presentation given at University of Texas at Dallas.


Figure 16

Figure 17

Figure 18

Figure 19
A very noticeable, and often talked about, side effect of meshing metaballs is the generation of tiny triangles in order to fit the iso surface. There's a fair bit of research material that focus entirely on this topic. One very cost effective way is to smooth out the resulting mesh. The math behind Laplacian smoothing is straightforward and it doesn't take long to translate into code. The iterative Laplacian smoother in Moonshine took just a few hours to implement and the results are excellent.

Metaballs generally have a very round and smooth appearance. With some adjustments to the mathematical model metaballs can be made to produce strands and sharp peaks. This adjustment is called the Strand Factor in Moonshine. The range for this field ranges from 0 to 1.0.

Figure 18 shows the effects of the effects of Laplacian smoothing in combination with adjustments to the math model. The resulting geometry has very tendril-like properties.

Figure 19 show that metaballs can be used to create sharp points and peaks. This is achieved by setting a high value,close to 1.0, for the Strand Factor.