V-Ray 3 Metaballs - Bubbles 001

Simulating liquid behaviour in 3D applications can be a complex task and usually requires external plugins. These plugins are typically full of advanced controls for simulation that at first glance can be daunting. But for more simple simulations V-Ray Metaballs is a great alternative as you can get satisfactory results in little set up time. It is very well integrated into 3ds Max and is supported by particle systems and forces that can be used together to generate a realistic simulation.


If you would like access to the scene files used in this tutorial please click here to download. You can also watch the video tutorial at the bottom of this page.

FeldBergheim2_small.HDR – Credit to http://www.openfootage.net. This exterior HDRI will be used for image based lighting and will generate interesting reflections in the bubbles.

Rainbow Gradient.dgr – Gradient file to produce the rainbow colour effect seen within the bubbles.

As part of V-Ray 3.0 Metaballs are available via a simple user interface found under the create menu. Metaballs are geometric shapes that interact with each other depending on threshold values set via the various parameters. As an example two singular shapes can be pulled together to form a new isosurface, repeat this over a much larger simulation and you will start to form a type of blobby liquid. The size and smoothness parameters impact on the final result to allow you to create things such as soap bubbles as explained in this tutorial.

You can also use Metaballs to create cellular type structures and you can use textures to modify the look of the Metaballs and create a much rougher surface. Metaballs are seen in the viewport along with the particle system so you can easily see how it affects the movement of the Metaballs. You also can get a good idea of what the end result will look like without experiencing any viewport lag or high memory consumption, as the complete isosurface is calculated at render time.

In conjunction with 3ds Max particles system you have full control over speed, direction and obstruction. In this tutorial Metaballs spawn from a source at speed and as they travel, they break apart forming perfectly round bubbles that drift through the air.

The final touch will be the material and understanding how a bubble should look. As bubbles typically show a colourful oily effect much like a rainbow because of how the inner and outer walls interfere with each other, you will learn how to create this effect using a V-Ray material. You will also set up the reflection and refraction values to determine how the bubbles interact within a HDRI environment.

Setting up particle emission

V-Ray Bubbles_Fig01

Go to the create panel and under particle systems drag a PF source into the 3ds Max viewport and set the size to 10mm by 10mm. Bubbles will spawn from the entire surface area. Open particle view and in the render parameter set the type to none as you will be rendering Metaballs and not particles. In the first event click birth and set the amount to 50. Select speed and set it to 200mm. Click shape and set the size to 1.27mm, however this is not a true reflection of the size of bubble as later on you will see how Metaballs parameters also affect size. Enable scale and set the variation to 15% so that you get varying bubble sizes.

Controlling acceleration and distance

V-Ray Bubbles_Fig02

In particle view at the bottom there are various operators, tests and flows that affect the particle behaviour. Click and drag a keep apart operator and position it between rotation and shape. This particular operator applies a force to the particles that affects how they separate by controlling speed and acceleration. The bubbles will spawn as a large isosurface and then start to separate much like what occurs when blowing bubbles. To spread the particles apart, increase the core radius to 100mm. Increase the acceleration limit to 1500mm so that particles spread out quite quickly after they spawn.

Linking Metaballs to particles

V-Ray Bubbles_Fig03
In the create panel, go to the V-Ray drop down list and add a VRayMetaball object to the scene. Under positive particles add the PF source. There is also an option to add negative particles that work against the Metaballs. This is useful if you wish to obstruct positive particles with negative ones. Tick use particle size to disable so that in particle view you have full control of the size as well as the variable scaling. Under preview, enable use and shaded then set the display resolution to 50 to improve viewport display.

Defining Metaballs behaviour

V-Ray Bubbles_Fig04
Lower the threshold to 0.2, higher values will reduce the size of the bubbles as the surrounding particles will force them to become smaller. The step length can be left at the default value of 1.0 as the isosurface for the bubble is quite simple but for more complex fluids you may wish to lower this value for more accurate results. Note that lower values will increase render times considerably but it is unavoidable if artefacts start to appear in the render. Enable smooth field bumps and set the radius to 9 and the smooth expansion to 1.0. This will remove any stray particles and smooth out the majority to form perfect bubble shaped spheres.

Creating the bubble material

V-Ray Bubbles_Fig05
Start with a V-Ray material and set both the reflection and refraction to pure white. Untick Fresnel reflections as you will control this via the falloff map. Set the refractive IOR to 1.001. In the reflection add a falloff map, set the type to Fresnel and set the override IOR to 4. In the outer slot add a gradient ramp and set the type to normal so that it is affected by the camera angle. In the ramp, right click and choose load gradient. Locate and select the Rainbow Gradient.dgr file from the support files of this tutorial.

Adding HDRI environment lighting

V-Ray Bubbles_Fig06
Add a V-Ray light, set the type to dome and increase the multiplier to 30. Tick spherical (full dome) and increase the subdivisions to 128. Add a HDRI to the texture slot and create an instance over to the material editor. Browse for the FeldBergheim2_small.HDR from the support files and set the mapping type to spherical. Then lower the inverse gamma to 0.7 to boost contrast. Instance the HDRI to the environment and set it as the viewport background. Add a V-Ray Physical Camera and adjust the position and the exposure to suit. Enable DOF and set the white balance to neutral. When setting up the V-Ray render settings take into consideration any DOF as it will require higher AA settings.

Quick tip

The display parameter will enable you to see a good majority of the Metaballs in the viewport. However higher numbers will be a more accurate representation but will also slow down viewport performance. As Metaballs spreads further away from the source you may see them disappear in the viewport but don’t worry they are still there, this is just due to the display resolution. You could increase the resolution temporarily to see a more accurate result but avoid scrubbing the time line as it may take a while to update.

Watch the video tutorial

Disclaimer | Final content was featured in issue 72 of 3D Artist Magazine.