Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Feature Requests => Topic started by: Jpjapers on 2016-10-20, 18:52:33

Title: Postproduction (fake) DOF via ZDepth
Post by: Jpjapers on 2016-10-20, 18:52:33
Now we have such great tools in the VFB it would be great to also be able to adjust the DOF in the vfb if youve rendered a zdepth pass!
Title: Re: VFB DOF Controls via zdepth
Post by: maru on 2016-10-20, 19:41:27
I don't think this is a good idea.
1. True dof renders fast enough for previews.
2. Fake zdepth dof looks too bad for anything else than previews (see point 1).
Title: Re: VFB DOF Controls via zdepth
Post by: Jpjapers on 2016-10-21, 15:13:31
Fair enough
Title: Re: VFB DOF Controls via zdepth
Post by: maru on 2016-10-21, 15:37:36
On the other hand, let's hear others' opinions. I know that this is widely requested feature...
Title: Re: VFB DOF Controls via zdepth
Post by: PROH on 2016-10-21, 17:32:39
Hi. I've never used fake DOF but can easily imagine situation where adjustable DOF would be useful - i.e. in animations. And since it seems reasonable easy to add, then why not? We don't all have same needs :)
Title: Re: VFB DOF Controls via zdepth
Post by: Jpjapers on 2016-10-22, 02:26:59
I think it would be a useful feature to have for those of us that dont use cameras and just render from perspective mode when working quickly without the time to set up renders with cameras. I agree that proper DOF does render quickly and really nicely but it would be great to have the option to work with our render passes in the VFB.
Title: Re: VFB DOF Controls via zdepth
Post by: Njen on 2016-10-22, 10:18:38
FYI fake DoF is used ALL the time in VFX. Rarely do small to medium vfx studios waste the rendertime on true DoF.
Title: Re: VFB DOF Controls via zdepth
Post by: Njen on 2016-10-22, 10:31:07
As proof to show that fake DoF is very much alive and kicking is in the following test that I did yesterday, coincidently enough, I am deciding on my DoF workflow for my animated short this week, so this topic is very close to me right now.

The following test has fairly heavy DoF with bright highlights (open up the images in separate tabs for true a comparison). 'dofTest_true.jpg' is true DoF that rendered in 25 minutes and still has visible noise. 'dofTest_fake.jpg was rendered with no DoF in 23 minutes then fake DoF in Nuke was added using the ZDepth pass that I also rendered: a very nice result with beautiful circles of confusion.
Title: Re: VFB DOF Controls via zdepth
Post by: Juraj on 2016-10-22, 13:25:40
Yup, that is pretty much render-time DOF :- )

(And no, setting GI:AA to 1 and waiting billion years will not help, this is what it is).

For very subtle DOF (f-stop 4-8 for 24mm camera), I use render-time, it's much more natural, pleasing. But for "heavy", artistic type DOF, I would 100perc. go with post-production. Not only for flexibility but because it does look nicer without all the artifacts of noise and speckles.
Title: Re: VFB DOF Controls via zdepth
Post by: Ludvik Koutny on 2016-10-22, 17:46:41
Unfortunately, post-process DoF will almost always fail if there's something in the foreground. Also, in VFX, rendertime DoF is actually being used more and more these days because it's not so expensive to render anymore.

So while it's good to have, the use cases for it vs for rendertime DoF are like 50:50... rendertime DoF being a rare luxury is myth these days.
Title: Re: VFB DOF Controls via zdepth
Post by: Jpjapers on 2016-10-22, 20:08:28
Youre right actually Rawalanche. You end up with horrible fringing if theres something in the foreground and transparency doesnt work either.
Title: Re: VFB DOF Controls via zdepth
Post by: Njen on 2016-10-23, 03:28:52
I'm, not sure why you think there is horrible fringing. When used correctly, artifacts are hardly noticeable when studied closely on single images and practically invisible when viewed on the move. Like I said before, Fake DoF is currently used the majority of time in VFX over in-camera DoF because it provides a better result for less computing power even if the trade off is some tiny artifacts here and there.

Plus, Foreground/background issues with fake DoF are even less of an issue when using a good pixel filter, like 'closest to camera', and with Deep rendering slowly becoming more popular, fake DoF is almost indistinguishable from in-camera DoF.

Below is before and after fake DoF is applied on a shot I am working on that has an obvious foreground and background.

[Edit:] Just for perspective, the last 5 projects I have worked on (X-Men: Apocalypse, Game of Thrones, Gods of Egypt, The Wolverine, X-Men: Days of Future Past) we never used in-camera DoF, but plenty of fake DoF.
Title: Re: VFB DOF Controls via zdepth
Post by: Ondra on 2016-10-23, 22:41:29
I am not sure about this - on one hand, fake DOF seems like something that will eventually die out, and produces worse quality than rendered one, on the other hand, a lot of people request this. There might be also the matter of finding the optimal algorithm, which sounds like another kind of black magic on its own.

Another thing is that we have one idea in our heads that could actually speed up DOF rendering A LOT while not being 100% fake (more like being 10% fake). We might try that first, before resorting to the 100% fake approach
Title: Re: VFB DOF Controls via zdepth
Post by: FrostKiwi on 2016-10-24, 09:02:04
The way I handled it in the past is a cheaty hybrid approach with Vray. Vray did DoF and MoBlur with low samples in an interesting way, I can't exactly explain. Vray interpolated the Blurry samples with some kind of Blur of it's own. The result was a "not quite" smoothed MoBlur/DoF. In post I would use something like RSMB or LensCare to "add DoF" on top of it to smooth the result out. It worked great in the past.

When used correctly, artifacts are hardly noticeable when studied closely on single images and practically invisible when viewed on the move.
One the one side well executed Deep compositing or the new "Evotis" file format seem to completely solve this, although outside of a renderer. It means necessary tweaks and knowledge of the method used. With Corona's philosophy a one click solution is required. Nuke's Zdefockus comes to mind, awesome for the passionate VFX artist, unusable hell for people in 3D. On the other I kinda wondered, why nobody came up with a hybrid solution to solve the biggest gripe - Zdepth accuracy issues on the focus plane. Focus plane < +/- 10% = Sample, Focusplane > +/- 10% = slap a blur on it. Black magic thinking I suppose.

Also awesome quote I recall from John Carmack at a quakecon keynote "A colleague from the offline renderer crowd came up to me and said "You have whole books about how to shadow map even the simplest things"". Gotta find that one again.
So maybe we should just puke more samples all over the screen and call it a day.
Title: Re: VFB DOF Controls via zdepth
Post by: Jpjapers on 2016-10-26, 23:14:03
I am not sure about this - on one hand, fake DOF seems like something that will eventually die out, and produces worse quality than rendered one, on the other hand, a lot of people request this. There might be also the matter of finding the optimal algorithm, which sounds like another kind of black magic on its own.

Another thing is that we have one idea in our heads that could actually speed up DOF rendering A LOT while not being 100% fake (more like being 10% fake). We might try that first, before resorting to the 100% fake approach

Colour me intrigued :)
Title: Re: VFB DOF Controls via zdepth
Post by: cecofuli on 2016-10-26, 23:47:16
In my opinion, the battle is not "3D DOF good but slow" and "Post DOF is fast but bad".
The question is to have the possibility to change it in post!
for example, we create a nice shot with 3D DOF. In preview, low res, low quality your clients say: good, I like it.
But, when you render in 4K, with good quality, they can say... O god.. It's too much, or...  it's too less!
In a lot of shot, DOF 3D can be very fast (no strong highlights, no DOF reflection or reflaction), I agree.
But, in this situation, also  the 2D DOF does a good job, and I can change it easily with ZDepth. =)