Adverti horiz upsell
How to render a real volume in Maya
How to render a real volume in Maya
sdb1987, added 2005-09-07 19:17:37 UTC 41,434 views  Rating:
(1 rating)
Page 1 of 1

Maya has some good volume rendering posibilities, but the use of the volume shader is not really documented in the manuals. Each ShadingGroup has an input for a Surface, Volume and Displacement Shader. What Surface and Displacement do is clear. What the volume shader is good for sounds obvious, too, but how to use it is not documented properly in the manuals.

Here's a little tutorial that shows how to render a real volume (beside particles) in Maya. (Although I have written this tutorial the credit for finding out most about this undocumented stuff goes to Olcun Tan, thanks Olcun!)

Start with a clean scene.
Create a volume shader.

The volume shader has two inputs: Color and Transparency.

On the color of the volume shader map a 3d crater.
On the transparency map the reversed output of a cloud texture. To do this click on the map button of the transparency of the volume shader and select reverse (found in the utilities tab).

On the input of the reverse node map the cloud texture.

In general, since we want to render a volume use a 3d texture. In this example I use crater since it shows three different colors in 3d space and gives a nice colorful effect. The cloud texture generates a nice random 3d patters for the transparency. You can use other textures, but cloud offers a lot of values to play with.

Now add a cone and a directional light to your scene. If you assign the volume shader to the cone and render you will get a black image. Why? Because the cone doesn't describe a volume. Well it does, but not in a way that Maya needs it to render it as a volume.

What Maya wants is an object that is called "renderSphere". Since there is no button or menu in Maya for it you will have to do it by hand. In the script editor type:

createNode renderSphere;

This will create a sphere that is neither NURBS nor polys but describes a volume as Maya needs it to render volumes. To make it work you have to change one attribute:

setAttr sphereShape1.rv 1

It enables volume rendering for the sphere.

This little script will automate this. Put it in your scripts folder and add mvs to your shelf so you can create volume sphere with just one click.

global proc mvs(){
string $vkugel = `createNode renderSphere`;
setAttr ($vkugel + ".rv") 1;

Click here to download script.

Select the sphere and scale it up so the cone is well inside of the sphere.

Assign the volume shader to the sphere and any normal shader to the cone (so it will show up in rendering again).

If you render now, depending on your view, it will still look like as if the sphere renders as surface, but then you will see the cone shine through the sphere. The sphere is actually rendering as volume, but the effect is not very impressive.

To get a better effect scale up the sphere even more and move the camera closer so it is inside the sphere.

Render again and now it will look like as if the cone is inside a colored fog. What color that is depends very much on the position of your camera and the placement of the crater texture. You could render an animation of the camera moving through the volume now, but all you would get is this fog look with flickering colors.

To make it look more interesting there are two things that make a big difference:

In the render stats of the sphere there is an option for setting the volume samples. Turn on "override" and set it to 5 (this is a good value to start with).

Render again and you will see a lot more detail in the volume. The higher this value the more samples the renderer will take while "shooting" rays through the volume and the more detail you will see. Of course at the cost of render time.

Still the volume is too thick and uiform in density. To change this the cloud texture that is responsible for the transparency of the volume needs some tuning.
Set the contrast to from 1.4.
Set the ratio to 1.
Scale the place3dTexture of the cloud texture up to something like 5.

The result should look something like this.

To get a real impression of the volume you have to animate the camera and render an animation. Don't move the camera too fast! Make a very slow movement and render it.

Happy rendering!

-David Hofmann