3DS MAX: 3ds Max Forum 3ds Max Tutorials

Fog Color in Mental Ray

COW Forums : Autodesk 3ds Max

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Buck WyckoffFog Color in Mental Ray
by on Dec 31, 2009 at 4:05:27 am

Getting a handle on Mental Ray. Making progess. Amazing how simple things don't work as you might expect. A client wants the background of a chemical plant rendering to fade in the distance to a solid color of their choosing. The only thing I get to work is Renderer/Camera Shaders/Mist (lume) thought the color is black no matter what I color I set. In fact black is the only this I get no matter what I try.

I have one Daylight and an Ambient Occlusion Omni light. Fast rendering without Final Gather. Learned it in Max2010 Mental Ray on Lynda.com.

Anyway, how can I do this and without killing rendering time. (I'm on Max2009)

Thanks. Happy New Year!

Return to posts index

Tiago RibeiroRe: Fog Color in Mental Ray
by on Jan 1, 2010 at 7:39:15 pm

Try checking out render elements.
With this you can make your regular render, without any fog/fade out effect, and at the same time, export the z-channel (depth channel) into another image file (zchannel.png).
The zchannel.png will be a greyscale image, which represents how far from the camera each pixel is. This is also called the depth channel, because it gives a 2d representation of the 3d depth of the scene.
If you save the render output into an image file (render.png), you will then have these two files, so you can import them into some kind of image compositing software, like photoshop.
Import each one into a different layer of the image software, with the render.png layer under the zchannel.png layer.
Set the blending mode on the zchannel.png layer to "multiply", and you should have you fade effect made out quite simple.
Depending on your image compositing knowledge and skills, you can even change the "fog" color, ir exponential fading parameters, using just these two image files.

Return to posts index

Buck WyckoffRe: Fog Color in Mental Ray
by on Jan 1, 2010 at 11:13:36 pm

That's a dang good idea! I got the fog working. Got rid of the daylight system and tweaked the exposure, but your suggestion would give me more flexability. I'm a long time Combustion user and just got Adobe Master Suite, so I can probably do it in After Effects.

I just might try it. I've been wanting to do something involving Render Elements for years. Duh.


Return to posts index

Tiago RibeiroRe: Fog Color in Mental Ray
by on Jan 2, 2010 at 6:01:55 am

That's great! Working with 3d is good, working with image composition is also good, mas you will soon realize that working with both is the real thing =)
You can do lots if simple tricks, if you move some visuals producing from the 3d software to the compositing software.
The zchannel is also very useful to create depth of view effect, especially if you work on combustion (that's also my choice, i just refered photoshop because it's more widely known=)
Try using a compound alpha arithmetic operator, with the zchannel set to the input layer, and you will have your blur spread out in the depth channel.
You can also check the near and far fields in the 3dsmax zchannel render element. This helps you set the distances that should be represented by full white, and full black. I think there is also an auto option, that should be on by default, that will just set the nearest point on the camera to full white, and the furthest to full black.
I also recommend you to export to a 16bit per pixel file (like png 16bit monochromatic), so you will have a higher precision (i will guess that you know what i mean)
You should really start working with render elements, it's particularly great when trying to produce nice render results, because you can render just the geometry..then render lighting..then shadows..etc.. and while compositing, if you think "the lighting on this object isn't quite right", you can adjust it, and render just the lighting on that object, which will be MUCH faster than rendering the full scene.
Of course, rendering JUST some specific element requires some knowedge with both mentalray and max render options, because the purpose of this is to skip processing everything that doesnt matter.
I generally seperately render the following elements:
Diffuse/Specular/Ambient( and Paint/Ink when cartooning)
Direct lighting
Ambient Occlusion
Indirect Illumination
other effects (volumetric light, etc.. varies)
The main trick on this is to use "material override"
If you create a standard white material, with no effects, no reflections, no specular ambient, no self illum..just a plain white material, and drag it to this override slot, every single object in your scene will use this material. As you may imagine, it will hugely speed up render, because it doesnt process textures, reflects, bump, etc... just a grayscale image of the scene.
As you may imagine, this grayscale image could be used as a mask. A mask of white? Of lighting =) turn off ambient occlusion and global illum or final gather, select the required ligting elements in the render dialog, and you will get your diverse lighting components, seperate and more quickly.
The drawback is that finalgather will not gather colored reflection of the light, but in most cases, it's good enough.
You can also render indirect illumination at a lower resolution, and with lower sampling and then scale it in the combustion, or even give it a soft blur, to hide the jitter and noise resulting from low sampling, while maintaining a soft and high definition diffuse, specular, reflections, etc..
Rendering seperate shadows it a little more tricky, because i think it doesn't work will any kind of light, nor any kind of exposure control (i don't quite remember which are the conditions for doing that)
Shadows are generally really really time consuming, so what i do when i render seperate shadows is that, not only i can reduce render size, and render sampling, but also, shadow sampling. If you still haven't got lost with this, then what i mean is that instead of rendering a 256 or 512 sample shadows, i render a 4 or 8 sample shadow. It's so much quicker. Then, in combustion, i blur it. It's quite enough for the majority of the shadows, because we generally already want them smooth and softly "blurred".
When i started doing this, i spent 2 weeks studing a scene with indoor indirect lighting, with soft shadows, and volumetric light (menta ray's parti volume shader).
I can tell that first:
By learning how to correctly configure global illumination and final gather (using Rendering with mental ray & 3ds Max. i highly recommend this book. i work on 3dsmax for 10 years now, but am 100% self-didactic), i managed to get the single frame 24h render down to 3h. This was a huge progress, because i intended to use the scene for an animation (24h per video frame would mean 24 days per second of film =). That's when i got into compositing. I learned combustion the hard way and got right through it. By exploring different tricks and configurations i could get, from using composition, i got my 3h render time down to 4min 15segs. I almost cried =)
Since then, i changed my workflow. 3dsmax never produces the final images. instead it always produces just different puzzle parts which i assemble in combustion. it's just freaking great =)

good luck and good work

Return to posts index

Tiago RibeiroRe: Fog Color in Mental Ray
by on Jan 2, 2010 at 6:04:56 am

correction. when i said "compound alpha arithmetic", i meant, of course, "compound gaussian blur" =)

Return to posts index

Tiago RibeiroRe: Fog Color in Mental Ray
by on Jan 2, 2010 at 6:12:40 am

ok, i should have reviewed my post before clicking "post direct".
sorry for the confusing speech, i just kind of "switched on a button" and started drilling on the keyboard..
i hope you understand what i tried to transmit

Return to posts index

Buck WyckoffRe: Fog Color in Mental Ray
by on Jan 3, 2010 at 3:23:20 pm

Yes. I follow you. I appreciate the advice.
Best regards.

Return to posts index

peter cannRe: Fog Color in Mental Ray
by on Nov 3, 2011 at 7:14:43 am

Used this trick a while back but had to work out how to do it again, works though. Go into the track View, expand the environment until you see fog colour. Right click it and Assign Controller from the list, Point3 Expression. In the expression type [ 255, 255, 255 ]*200 now the fog will be white, not black.

Return to posts index

Buck WyckoffRe: Fog Color in Mental Ray
by on Nov 3, 2011 at 2:49:06 pm

Thanks for the feedback.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved