Archive for the ‘volume lighting’ Category

started thinking: hey, having a volume pass would be helpful for my compositing.  Then I thought “can you even create a volume pass with mental ray”?  Still not sure officially as there is no sign of creating a volume pass in Max’s documentation anywhere.  I’m sure there are other ways, but I’ll show you how I create one.

A volume pass with mental ray

To create the above effect you have to use the Parti Volume shader.  If you don’t know how to use it check my posting on Parti Volume.  To get the render to work properly, I create a black material with a diffusion, reflection, refraction all  of 0.0. Then  plug this material into the Material Override slot in the Process tab of the Render Settings.  To get the control of the volume light itself, turn off any Indirect Illumination you may have.  Also turn off your exposure.  For rendering speed, you can also turn off any shadows you have on your lights.  Lastly, in the Parti Volume shader settings, be sure to check the Lights box.  This will only create volume light for lights that are listed in this list.  You can add as many or as little lights in your scene as you like.  To control the intensity / brightness of the volume in the render there are two factors.  The intensity of the lights themselves, and the brightness of the Scatter color in the Parti Volume shader. With these settings, they should produce an image similar to what is above.

Ok, I have my volume pass, now what do I do with it?  In Photoshop, or another image editing software of your choice, open your beauty pass (the regular render) and your volume pass.  Put the volume pass on-top of the beauty pass, and set the blend mode to Screen.  This will force everything that is black in the image to be transparent and everything that is white to be opaque.  If the volume is too subtle you can increase it by pumping up the contrast.  You can also change the color of your volume with playing with the Hue/Saturation and Colorize.
Ask and you shall receive…I’ve had several people ask me for the parti volume file from my volumetric lighting post.  I could not find the original file, so I only have it as a max 2010 version:


Volumetric lighting can be a mysterious thing in mental ray. I’m going to go through the Parti Volume Shader, and hopefully you will be able to know how to use it after understanding it.

Firstly, how do you apply it? Go to your render settings, and click on the Renderer tab. Scroll down until you see the Camera Shaders section. Click on the button that says None to the right of the Volume option. Here you will see a list of various volume shaders, choose Parti Volume. Now you have it applied, but like alot of shaders in max, to access click on the Parti Volume button and drag an instance of it to the material editor.
The default settings:

Right away if you were to render your scene, assuming it has lights, you will a very slow rendering that looks blown out with too much volume. After I discuss each setting, hopefully you can tweak it to optimize your rendering and speeds.

there are really two settings for this. 0 and 1. Anything else will give you strange results. Mode 0 is usually what you want. when Mode is set to 1 creates ground fog, and activates the Height function.

This color swatch is what gives the power behind your volume light. The lighter it is, the more volume effect you will get. The darker it is the less effect you will get. By default the value is set to 50% white, which is way too strong. I would suggest to keep gray-scale values for the best effect. Of course you can color the volume, but this is unnatural. Usually the closer you can get to black the better.

This controls how quickly light is absorbed by the particulate. The higher the value, the more volume you get. But it will choke your light. I try to keep this value as low as possible.

r, g2, and g2:
These values tend to act strange if you don’t know what they’re doing. Basically the three of them control scattering of the volume. The values g1 and g2 control the distance of the scattering between each other. The r value controls the favoring between g1 and g2. r=0 will favor g2 and r=1 will favor g1. Rule of thumb: r value should only be between 0 and 1, and g1 and g2 should only be between -1 and 1. You will get strange artifacts with other values. Keeping these at the default aren’t a bad idea. But if you want to control the spreading, you can change these values.

Non Uniform:
this creates a non-uniform volume, and adds noise to the effect. I usually leave this at 0.

Only works when Mode=1. It controls the height of the volume from the ground for fog effects.

Minimum, Maximum Step Length:
Simply put these control the sampling for the volume light. The larger the values the less samples are taken, and the faster the render. For quick and dirty test renders you can set these to min=4′ and max=4′. Work your way down, trying to keep the min value smaller than the max value so that the solution is adaptive. Eventually something like min=1″ and max=2′ should give you more than enough sampling. For the render above I used min=2′ and max=3′.

Light Distance:
This is a control for a falloff of sampling quality. It defines high sampling to take place within the specified distance.

No GI where direct:
If checked, when GI is calculated it ignores the volumetric light. Produces much faster GI solution of course.

This is a very important option and should not be ignored if you have more than 1 light in your scene. It is off by default, meaning every light in the scene will emmit volume, which can cause very very slow render times; especially if you have like 40+ lights in your scene. When checked, it will only cast volume from the lights added to its list.

That’s it for the Parti Volume Shader!

Other notes of weirdness for this shader…it only works with geometry behind the rays. So if your light which should be casting volume is against empty space, you will not see the volume. Solutions to this:

-put glass in your windows for interior scenes

-add an invisible sphere around your scene for volume passing over open air

On left: plane behind volume light. On right: invisible sphere around scene

This is achieved by creating a sphere that encompasses your entire scene, cameras and lights. Then apply an A&D material with Transparency=1.0 and an IOR=1.0 to the sphere. Then go to object properties, and uncheck Visible to Reflections/Refraction, Receive Shadows, and Cast Shadows. Also under the mentar ray tab, turn off Receive Illumination from Final Gather and check Exclude from Caustics and Exclude from GI.)