Archives of 34Bit:

Monday, April 19, 2010

Portfolio: Custom Depth of Field in Photoshop



While I was working on a hallway scene using Mental Ray I ran into some issues. I was not happy with the result that the Mental Ray renderer had with its Depth of Field effect. It was fast but very grainy, more like sandy noise than a blurred effect. I was disappointed to find out that the old DOF effect from Max's scanline was not available in Mental Ray, it may take a long time but the effect was great and could produce a very high quality DOF effect.

I started to play around and I came up with an idea to reproduce the same effect. The old scanline effect would simply move the camera re-render and overlay the images to produce the DOF effect, so I proceeded to move the camera in 3d to attempt to reproduce the effect. I started by moving the camera 4 units to the right and took another render. I wanted to test the DOF effect before moving any further to see if it even had the right effect, what is discovered was not a DOF is was a stereoscopic effect. As soon as I overlayed the two renders I realized it would work for a DOF but instead I produced a 3D image. All I need to do was set the left image to red, and the right to cyan, overlay the two and "poof" the magic of stereoscopic imagery.



That was cool and sparked a love of stereoscopic 3d, but was not the effect that I wanted. While playing around with the stereo effect I realized the solution for the DOF effect was a simple . All I need was a Depth Map and Photoshop. I rendered out a frame and the depth map for that frame. The depth map is a gray scale representation of the z-depth of your scene, all you need to do is use the Color Select option in Photoshop to select out the range of gray that you want to be in focus. Invert your selection and then use the Lens Blur to reproduce the Depth of Field effect. The result is higher quality than in Mental Ray, and still takes only a fraction of the time from the scanline effect.

Original Render:


Depth Map Render:


Depth of Field in Photoshop:

No comments: