View Full Version : True out-of-focus rendering...

06-29-2005, 09:49 PM
I didn't know what to call it since Depth of Field refers to the volume of space where the circle of confusion is smaller then the pixel or grain, but I was wondering if there are any plugins out there that render true nonfocused areas.

I mean the transparency and reflection problem. I know of Evasion3D's XDof and Digital Confusion, and then I think Brazil for 3Ds Max has a special thing for it...but is there any that does it correctly? I don't know even if correct is the right word but all of the ones I know still can't render everything the way it really is in actual optics.

I read one website that showed you how to trick Lightwave into rendering out-of-focus areas the right way with using a null and rotating it around, and he compared it to the other plugins and showed how they couldn't render transparent and reflections correctly; but I want actual iris selection too and the trick does not provide it plus the inevitability of the discrete passes being able to be seen.

Cause if not then I was thinking of trying to figure it out on my own...with the current trick of using the Surface Thickness gradient maybe there's a way to use it to manipulate the Z-Buffer so the plugin renders the circle of confusion properly...I don't know. And if I can somehow make a plugin that processes after each pixel is rendered instead after the whole image is done maybe I can sneek it that way. But I haven't been able to find any documentation of pixel filters and I was wondering if it deals with shaders? Lightwave renders non-transparent surfaces and transparent surfaces seperately (well it seems like it when you watch a render), so if I can get a plugin to render on every pixel within that seperation it might be possible.

07-02-2005, 05:30 PM
I believe that using DOF in the camera panel is correct to reality. You just have to set your antialiasing up high. The only difference is that the level of antialiasing is the amount of samples you have which takes a long time, were in reality the sampling is infinite. At least this is what I have gathered from studying photography and using LightWave.

07-02-2005, 10:25 PM
Go here...

DOF Reflections (http://www.altyna.com/lw/DOFreflections.htm)

I also forgot to mention the problem with objects behind objects, where the blurred objects will cut off the rendering of objects behind them. This is all with post-processing plugins of course. Yes, Lightwave's DOF renders to what would be in reality, but it does not incorporate all photographic features; and the second you turn on motion blur it all gets screwed up. Especially one which would require calculating the barrel blocking rays which would create the cateye effect in out-of-focus highlights.

I am talking about one that renders the circle of confusion as the shape of the aperture like in a real camera. Lightwave's DOF does not allow this, although you could you use the null technique with motion blur and trick it with some expressions.

I can't stand the problem with the passes being able to be seen, which is why Lightwave's DOF for me is out of the question.

07-02-2005, 11:49 PM
I don't think 'true' out of focus rendering has ever been done, but X-Dof seems to have some defocus going on - http://www.evasion3d.com/xd_lw_gallery.html

07-03-2005, 03:22 AM
Yea, X-Dof is a great tool, but pitifully, pixels seen through transparent surfaces don't get blurred correctly.
Maybe your idea is a good way to go in this case; but don't use surface thickness gradient since complex forms don't render appropriately; use a distance_to_object gradient instead.
The good thing about it is you can control the depth "buffer" per surface; copy the same gradient to all surfaces and tweak just the problematic surfaces. Once you have this image sequence rendered separately (from the original render), you may use it in TB's Defocus Filter:


This application allows you to use a depth image (BMPs) as a Z mask and to choose the diaphragm shape that you want (you can design your own diaphragm shape); the disadvantage is you can't load an image sequence, so you should to copy your settings and paste it in every frame (what is a tedious thing if your sequence is too big)
I haven't tried all this btw, but I guess it could work :)


07-03-2005, 02:12 PM
Here's one for photoshop, also doesn't do sequences but you could set up a batch :)

But you can see here that it has the same problem with objects in front of objects - here you would have to have a separate pass for each ball;

If x-dof dealt with this correctly which I think it does, it would be worth doing transparent objects separately.

Other thoughts; you might be able to fake the aperture shape with the spinning camera trick if you have the camera spinning in the shape of the aperture instead of a circle, or you may be able to map an image of the aperture shape on every highlight with the Corona filter.

07-04-2005, 12:09 AM
If x-dof dealt with this correctly which I think it does, it would be worth doing transparent objects separately.

Yep, no problems with X-Dof and objects in front of objects if we combine it with LW DOF. Btw, your Corona idea sounds great! :)
Another nice tool for DOF effect seems to be Lenscare (a plugin for PS, AE, Combustion, etc):

(works with image sequence)

demo here (http://www.frischluft.com/download/download.php)


EDIT: Ah! check gallery (http://www.frischluft.com/gallery/lenscare.php), has awesome credits :)

07-04-2005, 01:10 AM
Man you could spend weeks on this stuff - it's starting to hurt my head. Dof in camera or post? Some of it in camera and the rest in post? Anti-alias the z-buffer or not?

I'd never thought of adding the background distortions, even though I've noticed it in real life! Maybe they'll start adding this stuff in the next few years.

Lenscare looks real cool, Flair looks great too - I wish I could afford to do all my post process effects with those two.

07-08-2005, 07:04 PM
I believe Depth of Field in the Camera panel IS the real thing just like the eye, although making the shape of a cameras aperture would be a neat feature. Just trust me on that for a second. So you are now wondering why the reflection is wrong. The answer is Ray-Tracing. The reflection is Ray-Traced and so is transparency. I believe what you are seeing is just a stupid Ray-Tracing error that will be fixed someday soon I hope. :grumpy: Except for shadows Depth of Field calculates Ray-Tracing one time and uses it for every sample like a 2D surface. This saves time and generates the error. The spinning camera trick uses Motion Blur and Motion Blur calculates entire frames, which include Ray-Tracing. Anyway I have been relaying on mirroring of objects and lights to get the right reflections with Sasquatch hair on flat objects and for now outside of using the spinning trick I guess doing the same thing with Depth of Field is the best answer for getting the real effect. :(

See below...

I decided to post this problem in the Bug Workshop tread