Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Standard view
Full view
of .
×
0 of .
Results for:
P. 1
Mental ray volume scattering tutorial

Mental ray volume scattering tutorial

Ratings:

5.0

(3)
|Views: 31,402|Likes:
Tutorial from jhavna.net on mental ray's ray marching technique. It simulates the effect of light shining through a dusty/foggy environment.
Tutorial from jhavna.net on mental ray's ray marching technique. It simulates the effect of light shining through a dusty/foggy environment.

Availability:

See More
See less

07/19/2013

pdf

text

original

> Maya & Mental Ray Volume Scattering (Ray Marching)
In this tutorial we are going to use mental ray and Maya to produce the image below.The method to generate this image is called volume scattering, or ray marching. This can be seen in real life when light beams hit dustyor smokey volumes of air. For example light beams coming through a window into a dusty room, or the beams of lights at a concert, asthey pass through the smokey atmosphere. The light hits the dust or smoke particles, and is scattered in various directions.The reason this is also called ray marching is because of the way mental ray calculates these images. In a given volume, mental raycalculates how many dust particles are encountered by each ray as it travels through the room. Each sample is taken at various pointsalong the ray at either regular intervals, adding more samples in between when two samples are drastically different, or use variablespacing, dependant on the various factors, such as the distance of the ray from the light source.Well, enough background, let's get on with the tutorial.What we will need is at least three things: a light source, a room filled with smoke, and a camera. The occluding objects are just to makeit look nicer :)Ok, so first things first, set up a scene with a large polygon cube and the spheres inside. Position a spot light as shown in the picture,and your basic scene is set up. It's worth increasing the subdivisions of the larger spheres, to prevent flat edges.The bounding box is what will contain our ray marching volume. We could attach the "fog" to the camera, but that would increase therender times severely, so we limit it to a specified volume.Now, let's set up the materials. Create a new Lambert material and a Blinn. Rename the materials if you want, and assign the Lambert to

the bounding box, and the Blinn to all the spheres. It doesn't really matter what you use for the bounding box, as we aren't going to renderthe bounding box. We've assigned the Blinn to the spheres to give them the shiny appearance.Ok, open the attributes of the Lambert shader and click on Show Output Connections (see below)on how to enable mental ray custom nodes.The transmat node doesn't have any settings, so let's just skip ahead to the parti_volume node settings. Set Color to the colour you wantthe fog to be. I have chosen a light blue colour in the example (R:0.566, G:0.705, B:0.902). Set Extinction to 0.001 and Min_step_len to0.03 and Max_step_len to 0.2. Leave the rest as default.If you want to know what all the other settings do, just look it up in the Maya manual by searching for parti_volume. Otherwise I'd just berepeating everything from it.Next we need to edit the light settings. We need to make it a physical light, and set the Exponent down to 1. See the image below.

By increasing the Exponent value, the light rays die quicker. Try experimenting with this value a little. For the physical_light node, set thesettings as follows: For the colour, select any light colour, I have chosen a turquoise with the settings (H:180, S:1, V:70000). The reasonthe V value is so large, is because that generates enough brightness to pass through the volume. If you turn this down too much, youwon't be able to see anything. Set the cone to 500 and the Cos_exp to 1. The large cone angle will make sure the light shaft will cover theentire scene. In the spot light attributes, I have the set the cone angle to about 120.Now we need to attach the light message to the parti_volume light input. You can either do this via the connection editoror you can use this MEL command:
connectAttr -f spotLight1.message parti_volume1.lights[0];

Just replace the names of the nodes with whatever they are called in your scene.Now if you hit render (with mental ray enabled) you should get the image above. Update for Maya 7.0I've finally gotten round to try this effect for Maya 7.0 as I have received a number of emails asking why the method above doesn't work forMaya 7. Well, I had a quick play and there's only one major difference. You can follow the rest of the tutorial and just adjust things slightlyto fit in with the new layouts and settings. So, here we go, the main difference is in setting up the mental ray shaders. Here's ascreenshot of the settings: