PDA

View Full Version : Distance fog with Mental Ray


MrPositive
04-27-2006, 08:12 PM
Is there an easy way to do distance fog with Mental Ray. Unfortunately, I cannot use the Maya environment fog with Mental Ray which was so easy to use and apply. So what works easy and best?

slipknot66
04-27-2006, 09:14 PM
Well, actually you can use the Maya environment fog with mentalray.Just open the render settings, change to Maya software, create the environment fog, then go back to mentalray.

MrPositive
04-29-2006, 09:42 PM
Thanks Slipknot as usual you rock! :)

Matt Grdinic
05-02-2006, 12:54 AM
I would encourage you to play around with mentalRay's Parti_volume shader—the results are worth it.

Just create a Parti_volume shader and plug it into a Transmat material's Volume Shader slot. Apply the transmat shader to a large volume that encircles the scene (a sphere works well).

Set the Parti_volume shader attributes to:
Scatter:
.05
.05
.05

Extinction:
.05 (will vary depending on scene size and lighting conditions)

Min_step_len:
.2
Max_step_len:
1.5
(these, along with your Min and Max Sample Levels from MentalRay Render Globals control the quality of the fog. Lower step lengths and more samples means a better looking fog.

Play around with the R, G1, and G2 attributes. They control the way the light scatters within the volume, and are what make this shader so nice. In short, they allow for realistic fog because they allow light to scatter more in one direction than the other, just like real life. If you check the mentalRay docs of the Parti_volume shader you'll find settings for mist, rain, and smoke simulation.

blacknoise
06-28-2006, 06:00 PM
Matt Grdinic:
could you be more specific? recentely i was looking for a nice fog solution and found your tips. problem is i cant find any volume shader slot in my transmat material :\

thanks

Smithjoe1
06-29-2006, 12:56 AM
Its not in the transmat material itself, its in its shading group, under the mental ray tab

The shading Group will have
Surface Material -
Volume Material -
Displacment Mat. -
\/ Mental Ray
> Flags
> Conouts
\/ Custom Shaders
- Supperess all maya shaders
- Export with shading engine
Material Shader - Transmat
Shadow Shader
- Export with volume sampler
Volume Shader - Parti_Volume
Photon Shader

Etc etc

Its under the volume shader in custom shaders is where the parti Volume should go, make sure with your Min_Step_Len and Max_Step_Len to turn them way down to something like 0.1, 1 or something low or your render times will shoot through the roof.

Matt Grdinic
06-29-2006, 02:30 AM
make sure with your Min_Step_Len and Max_Step_Len to turn them way down to something like 0.1, 1 or something low or your render times will shoot through the roof.

I believe smith means the exact opposite--The smaller the unit, the shorter the marching ray travels before it samples the volume material. Thus, smaller units means more samples, and longer rendering times. The default value are fine for test renders. 0.1 and 1 would be for final renders.

Anyway, so we're clear, the transmit material plugs into your materials shading engine, under the mentalRay section. Remember, a materials shading engine is found several ways: In hyperhshade, click the Shading Group tab, then the shading Group node of your material. You can also right click on your materials shading node and select 'Select Output Nodes' from the menu. There are more ways, but that should suffice.

In my previous post I said this shaders results are worth it, but now let me add that you should be prepared to fight for said decent results. Keep the following things in mind:

The shader’s speed depends on scene size. Remember, the best way to apply fog to a scene is to construct your Parti_volume shading network and apply it to a large object that encompasses the entire scene (I’ll call it the Volume_Sphere from now on). This generally means ‘large sphere’, but it could be anything you want. Just remember that the larger the object, the slower your renderings will be. As said above, the more fog you have, the more volume material must be calculated.

Things get complicated-Quick. The frustrating thing about this shader is you’ll get different results depending on how large your Volume_Sphere is—even without changing any of the Parti_Volume materials settings.

The shader reacts strongly with light sources. One of this shaders greatest strengths is also is greatest annoyance. If you have no light sources you’re fine—but if you do, this shader will react differently depending on what angle the camera is to the light. It’s a realistic feature, but remember to test-render from many angles if your doing animation work before you lock in your settings. For still work, I’ve found a light that actually points into the camera is often the best setup.

Use Maya’s preset feature to store values that work. Getting this shader too look right can be like winning the lottery. Save time by storing good value combinations using the Attributes Editors Presets Button. (upper right hand corner of the ae)

On that note, here are some sample values to get you started:

Blue Haze
Scatter: H:200 S:.4 V:.091
Extinction: .025
R: .5
G1: -.46
G2: .46

Good luck!

wizzackr
06-29-2006, 09:49 AM
The shader reacts strongly with light sources. One of this shaders greatest strengths is also is greatest annoyance. If you have no light sources you’re fine—but if you do, this shader will react differently depending on what angle the camera is to the light. It’s a realistic feature, but remember to test-render from many angles if your doing animation work before you lock in your settings. For still work, I’ve found a light that actually points into the camera is often the best setup.

Amen to that. If you do not necessarily need all the subtle changes in light-tone and fog intensity depending on the camera position towards the fog/light sources I suggest you break all light links to your 'fog-sphere' and make one directional light for the fog only, shining straight down Y.

That way you have more freedom to set the fog up and and then still have the ability to tinker around with your scene lights without messing up your fog settings.

good luck.

CGTalk Moderation
06-29-2006, 09:49 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.