Defocus Dei

Rendering in maya for post DOF using Defocus Dei or a similar application.

While rendering in maya you may find it a bother to render several times while trying to achieve a satifactory depth of field effect. Some 3d users (mainly lightwavers) have heard of or used a little application called Defocus Dei. Its an interesting little tool for changing the focus on your images using stored zbuffer information. Why send all that extra time rendering when you can get the desired effect in less time?

Now before we get started, you will need to download a zdepth shader to use for rendering your zdepth image. You can with this shader (written by Gyu Veol Jeon) at this location.

Next create a scene that could use some DOF. In this example I simply created 3 spheres, a plane and a light.


Now set the resolution and antialias quality to what you need, and render out a targa image. In this case I called it "doftest.tga". It is important that from this point on you do not rotate or change the camera which you rendered this image with or the DOF image and the colour image wont match.


Ok, now that you have your colour info pass, lets render our zdepth info.
Extract the file you downloaded and bring depth.ma into maya using the "Import" function. This is a shader so you will find it in the hypershade. Apply this shader to everything in your scene. use the selection box if you have to and draw a big box around everything and apply the shader. Render out another image, this time I called my image "doftest.z.tga". This is the same name as the previous render except that it has a ".z" in between the name and extension to tell Defocus Dei that this is the image that has the zdepth information.


Note: if you are having strange results eg. a zdepth image that is solid black, then you might want to look into the size of your scene cause that would make it a greater distance. You can also solve this by scaling the world down.
Now it seems we are ready to open Defocus Dei and play with the depth of field on our image. Go to "New project" and an "open" box will popup, direct it to your colour image and it will automatically use the zdepth image we created. Choose depth of field to play with dof.
Have fun using defocus on your maya renders.