View Full Version : DOF and MotionBlur post process - How?

05 May 2009, 07:30 PM

I am using Maya 2009 and Shake. But the company is looking into Nuke lately. But I suppose this wouldnt matter much in this question.

Basically i've been working in maya and rendering out depth-maps which I then feed into DOF Pro V4 to get pretty decent DOF passes. I have dealt with realflow with such depth maps and so far all works fine.

My main issue is that I wish to include motionblur. I used to choose which i'd need more, which usually is DOF and then Ill use a 2D ReelSmart Motion blur pass to just make everything feel a little more natural.

But how do I use DOF in post with 3d motion blur or vector motion blur. Is there a pipeline? If I use motion blur with vectors first then DOF won't work as the blurred data isnt include in the depth pass. If I use DOF first then....well same issue.

How do you guys get both passes in together esp in post in perfect sync. Thanks

05 May 2009, 12:16 PM
Faking this kind of thing in 2D will never be "perfect"

If you're rendering out a sharp, no mblur, no defocus version as your master from 3D, then you'll never be able to recreate the motion blur or defocus perfectly. There will always be parts of the scene that would have been visible (albeit partly occluded) had motion blur and DoF been turned on. Your 2D software is never going to be able to recreate that.

I couldn't say which would be the best order for this... Both operations will be changing the position of pixels, so whichever one you do second is going to have some kind of issue. I would say that it really depends on the scene - if it's a really shallow DoF, but minimal motion blur, then do the motion blur first and then the defocus. If it's a fast moving, but deep DoF scene, then do the defocus first. If it's got both, then you'll just have to mess around with it until you get something you're happy with. If you do the motion blur first, then you'll have to massage the depth pass quite dramatically to get the DoF to work right, and same the other way around...

05 May 2009, 04:00 AM
Will never be perfect, of course...
But, as you say, it will be even worse if you apply DOF, then apply 2D motion blur or vice versa.
After some experimenting, I've settled on a compromise that often works pretty well (depending on the shot).
Instead of applying DOF then mo-blur to your comp, first apply mo-blur to your depth buffer. Next, apply the same amount of mo-blur to your main comp/beauty pass, whatever. Now the main comp and its depth buffer will match pretty well, so lastly you can do your 2D-DOF using the blurred depth buffer.
It can work out pretty well, most of the time (might even work better if you swap the order of operations), but of course is no substitute for the real thing...

If you're doing this in Nuke, it will be less trouble indeed. Since you can put your depth buffer into an image's channel, apply motion vectors to the image, including all of its channels. Then pass it through the z-blur node using its own z channel to control the blur.

Hope this helps...

05 May 2009, 08:35 AM
The trouble with motion blurring your depth pass is the same problem that you come across with antialiased depth passes (or position, or normal...) (and why you can't have transparency in these passes)

Because the numbers mean something in real world space, you can have any kind of sub-pixel-ness in there - as soon as you've got a pixel in your image (depth/normal/pos/whatever) that is actually a blend of two different values on the same pixel, then you're screwed...

So if you've got one surface at 100 units away, and then there's another one closer to the camera at 10 units away, you've got a big step in your image. As soon as you anti-alias, or motion blur, you've suddenly got pixels in there that think that they're 55 units away, where there really isn't anything at all...

But you're obviously going to have similar problems with defocussing your motion pass - if two objects are moving in different directions, then the bit where the defocussed edges touch may be motion blurring in a completely different direction again.

05 May 2009, 01:29 PM
The trouble with motion blurring your depth pass is the same problem that you come across with antialiased depth passes (or position, or normal...) (and why you can't have transparency in these passes)

Yep, you should never have antialiased depth/motion passes. But, if you want to combine both of these post-effects as the OP asks, you'll have to make a sacrifice somewhere. It's just a matter of choosing which one is least detrimental to your image quality (since they're both shitty hacks anyway).
It might also help to apply some rank filters to the depth pass, just to shore up the blurred edges a bit. That helped somewhat last time I did this stuff.
Again, this technique is not good for every case, but if you can get away with it...

If you can't get this combination to work, you could resort to using an 'optical flow' motion blur on your comp, after DOF has been added. Hackier still, but at least you wont be fudging with your depth values.

At the end of the day, if you can do it in 3D, then do it in 3D!

Edit - If somebody has a better, less error prone method of combining these two post-effects, I'd love to hear it. I asked this very same question on these boards about a year ago and didn't receive any advice, so honestly, I'm not sure how anyone else deals with this!

05 May 2009, 03:41 AM
At the end of the day, if you can do it in 3D, then do it in 3D!
Yup... and if you can't, then just stick with Alfred Hitchcock's acting advice to Ingrid Bergman: "Ingrid, fake it!" :thumbsup:

I happen to remember the second time I saw "Star Wars Episode One." I'd been primed to actually look for the colored Q-Tips that stood in for a crowd of spectators in one particular fleeting shot in that released film, and ... yup, they were still there! But no one in that theater actually saw the Q-Tips: if they actually saw anything, they only saw what they expected to see. (In the DVD, of course, that shot has been replaced. Too bad...)

I guess what I'm saying is ... you can get to the point where you are fixating on this stuff, trying to make it perfect when it's really just "a difference that makes no difference" to the popcorn-munching customer. You need to constantly balance your desire for perfection against the imperative to ship finished ("good 'nuf") shots. You'll do that shot-by-shot, and worry if anyone will actually catch you at it. But if Q-tips were good enuf for George Lucas (at least, for a while...)

CGTalk Moderation
05 May 2009, 03:41 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.