TGA file with Depth of field

Hey guys, I was wondering if anyone could help me with the work flow for taking a .tga output file which has depth information and use that file to make a depth of field render with Blender.

Is this something we can do?

Can someone help me with the work flow on something like this?

Wowzers, didn’t even know .tga files had depth info… I’m guessing you will need a python-based node for that…

You could do it, using nodes.
The depthmap is just a greyscale picture.
You would use the Z Value of your renderlayer, scale the values with a MapValue Node to your wishes and a colorramp. This would output a greyscale image, which you can save as tga.
But this is not necessary.
You could use the Z Value directly into a DefocusNode and just setting the focus in the camera panel.

Patel

Thanks for the help so far,

The reason I would be using a TGA is because I am bring the file over from another rendering program that does not support depth of field. They do have better realistic renders and that is why I am not rendering internally to blender. I was hoping to composite with blender and that is why I am posting here.

You might have to seperate the channel out in another program, but yeah, blender can definitely do that.

I’d like to see one of the TGA files, because otherwise there’s not much that I can say for sure.

But IF the z-info is rendered to the alpha channel of the TGA, you can see it in the Node Editor using
Add -> Convertor -> Separate RGBA.

Then just connect the alpha (A) channel to the z-value in the Defocus node (Add -> Filter -> Defocus).