Saturday, July 28, 2012

Top VFX technique as used by MPC artists


Niall Flinn, head of FX at MPC, explains how to simulate believable sand and soil particles
In the ‘150 CG secrets’ article in issue 150 of the magazine, Niall Flinn discusses the need to achieve a realistic particle size distribution when simulating granular materials such as soil.
Niall explains: When simulating granular materials like soil, randomise the particle sizes. Don’t just use a rand() function, since you will end up with as many large as small particles. In Maya’s nParticles, you can fix this via the ramp editor under the Radius Scale tab, with the Radius Scale Input set to Randomized ID. Just tweak the curve to give a natural-looking distribution of radii.
The following techniques can be used to achieve this distribution in Maya:
You can use Gaussian noise to create a distribution weighted toward smaller radii. In Maya, this is easily accomplished using the gauss() function. I typically create a particle creation expression that looks something like this:


float $minRad = 0.01;

float $sd = 0.1;

radiusPP = abs( gauss( $sd )) + $minRad;


In this example, $minRad is the smallest radius you want to see, and $sd is the standard deviation of the function.
Another option is to use a simple weighted noise algorithm (again in a creation expression) by feeding the results of successive rand() calls into one another:
$min = 0.01;
$max = 0.1;
$rand = rand($min, $max);
$rand = rand($min,$rand);
$rand = rand($min,$rand);
radiusPP = $rand;
The above code will produce a distribution overwhelmingly weighted toward smaller values. With 3 rand() calls, it’s relatively expensive, but it generally only needs to be done once for each particle.

No comments:

Post a Comment