Volumetric Shader through Mental Ray
by Silvia Palara, USA


Maya Utilities and Shaders

For this scene we'll use some of Maya's own shaders and utilities to drive the parameters of the MR shaders. It is important to take note of the fact that, since we are dealing with volumes, we must use volumetric, or 3D shaders. When dealing with surfaces, 2D shaders can suffice. Also, not because they are called shaders it means that they can only be used as materials. The output of these nodes are numbers and it is up to you to decide what they represent.


Volume Noise : A 3D textures that produces a random output of values between 0 and 1. The user can select different functions to produce the noise:
  • Perlin. Creates random values, then interpolates between them to give smooth transitions. The function oscillates, making it perfect for organic motion, like tree branches moved by a breeze. It is also useful to simulate thin, whispy high altitude clouds.

  • Billow. Based on the general principle of the Perlin noise, but with less smooth transitions between values. Useful to simulate more defined clouds

  • Wave. Generated as sum of waves in 3D space. The larger the number of waves, the more they interfere with each other, giving the noise a softer look.

  • Whispy. It takes the output of a Perlin noise, and applies more noise to it.

  • Space Time. It is a 4D Perlin noise, that is, a Perlin noise that changes with time.
Solid Fractal : Another type of noise, but based on fractal functions. Fractals have an infinite level of detail, so that at any resolution they exhibit the same pattern, with the same amount of detail.

Remap Value
:
One of Maya's Color Utilities. It takes a number as input, and produces another number as output, which is the result of applying a function or transformation to the input value.

Set Range: When you obtain a set of numbers over a given interval, you can apply this utility to remap the values over a different interval.


Putting it Together

Now that we have all the pieces, we can put them together.

Assign a dielectric shader as shader node MR material. Assign a dielectric photonic shader as MR photon shader. Leave all dielectric values to default. The refraction is going to be distracting, so for now we turn the index to 0.




Assign a Parti Volume as MR volume shader and a Parti Volume Photon as MR photon volume shader. Since the ball is only partially filled with fire, set Mode = 1. Set the Scatter to a bright orange. To better see the medium, give it maximum Extinction = 1. For now, assign a fixed number to the height, which is relative to the sphere coordinates. My sphere is centered at 0,0,0 and has a radius of 5 so I can set any height between -5 and 5. I set it to 2.






We want a random height between -5 and 5 . The Solid Fractal is the random number generator with the most detail so that's what we'll use. But since it produces only numbers between 0 and 1, create a Set Range node, and set the Fractal's outAlpha as its value, 0 as old min, 1 as old max, -5 as new min and 5 as new max. Connect the output of the Set Range to the Parti Volume height. In the Fractal's placement node click Fit To Group.







We want a greater variation in height, so increase Ratio to 1. We also want less detail, which is determined by Frequency, so decrease it to 1.3









The fire looks too uniform. We want a smooth blotchiness. Perlin noise generates random numbers with a smooth transition between values, so that is what we use.









The blotchines is too pronounced. Bring down the threshold to 0.28 to smooth it out more.






It makes sense to tie the color to the fire density. The less dense the fire, the darker and redder it will be; the more dense the fire, the more yellow and bright. The problem is that the noise that controls the density doesn't output color. Here is where the remap node comes into play. Connect the outAlpha of the noise to the value of the remap node. In the color section of the remap node, create a ramp with colors going from black to red-orange to yellow to almost white. The output value of the noise is the index to the ramp, so a low density value will correspond to the darker and redder values of the ramp, while higher density values will correspond to the lighter values of the ramp. Connect the outColor of the remap node to the scatter of the volume. The effect is subtle, but comes in very handy if we decide to animate the noise, to make the color follow it.

Finally, bring the dielectric index of refraction back to 1.3.


Finishing Touches

Caustics: This will make the light go through the sphere, get refracted by the dielectric and throw a liminous pattern on the wall behind the sphere. Activate Caustics in the Render Globals, then set the light to emit caustics photons.



Well, it seems that the color of the volume doesn't affect the color of the light. This is easily remedied by giving the photons of the spot light an orange color.


Animation: By animating the parameters of the fractal and the noise nodes, you can get interesting effects. You may want to try keyframing the solid fractal's frequency ratio, going from -1.3 to 1.3

Rendering:
Throughout the tutorial I gave for granted that the reader knows how to render in MR, including Global Illumination and Caustics. A little reminder for this scene is to set GI in the Render Globals for both surface and volume. Also, you don't have to be content with the render, you can always import the result in Photoshop and make adjustments.


Page 1 | Page 2 | Page 3

 
 
 
Copyright © 2005-2006. All Rights Reserved