DOF Tutorial Part I
The other day I was trying to render a scene. As a Max and Brazil rs user I know that make a render wich involves a nice AA, more than 3 light bounces, area shadows, DOF, and more that 2500x3500 px of resolution and even more than 800,000 poligons need a lot of patience and a lot of computer power, since I just got a nice new computer I inocently thought that this scene
will be a piece of cake for this computer, but I was wrong, 3 days later the render was just about the half way and I need
it for the next day at noon.
Well I just canceled the render start change some parmeters in a new test scene, then I just remembered that somewhere I read about some DOF (Z Depth) maps and start asking in the forums, but before I got an answer I start looking in Max help files and found the way to render this kind of things so here is what I learn.
First you need your scene here's a simple one you can download if you want.
Ok adjust the params as you wish, I turn the GI on 3 light bounces, 1 min and 2 max in the AA (I won't teach how to use brazil) and this is what you get.
This is a nice render which is called Beauty Render by some big companies let's call it Difuse render (wow how original
Now Aply a nice and neutral color to all objects like white or even better black, and change to the Default Scanline Render, and in the Render Elements tab chose Add...
Now that you are in there, pick Z Depth and Shadow and whaterver else that you need (I just need shadow and DOF)
You got 3 Virtual Frame Buffer one with the render itself with the shadows and color and stuff wich we don't need, another wich is the shadow (a black image with an alpha channel) and the last the Z-depth buffer, save this 2 as tiff image file and turn on the option of Store Alpha Channel.
See, this was easy and relative fast. Now go to PhotoShop CS (I'm not sure if ver. 7 has the feature we need)
Ok Now on PhotoShop open the 3 Images you just save in Max.
Working with in the Z Dept render. Select all and copy the image (ctrl+a to select all and ctrl+c to copy) make a new Alpha channel in the Difuse Render and paste it in there.
Now copy the alpha channel of the Shadow render and just as the Z Depth make a new alpha channel and paste it in there, so now what you got is a Difuse Render with 2 Alpha channels.
What we need to do now is symply, load the shadow selection, (ctrl+left click) and make a new layer and paint it with black. Give it a opacity of 30 (just hit 3 in your num pad) I use a soft light as blending mode, you can use normal or any other or even paint your shadows any color you want and make any color correction you need (usualy I just use color balance).
If you are happy with the results...well flatten your image and got to Filters>Blur>Lens Blur and there use your alpha channel 2 (Z Depth) to blur your image, use any values that you think are ok, but always have in mind the the Blur Focal distance means the gray color that your focus object is, so if yor object apears to be gray, check the values of the gray (i.e R128 G128 B128) and use it in here:
This the real thing, you can add the DOF as needed more or less depending of your needs, also adding noise if you want (I realy like noise in blured images, and the best thing here is that you can see the results in real time if you use the faster mode and then apply it in More Acurate mode).
Now the final Result in a fraction of the time that should take it render the whole thing in Brazil rs, at the end I render also the self ilumination channel to add a glow in the blue areas.
I hope this was usefull...The render times where 9:52 min for the Brazil render pass and 16.56 min for the Default Scanline Render (shadow and Z Depth) I should say that I start a new render with Brazil using the same values for AA but added DOF and area shadows and has pass more than 25 minutes and the Brazil hasn't render any bucket (64x64) so this demostrates that this way is a lot easyer and faster.