Jump to content
Hash, Inc. Forums
ToreB

Depth buffer DOF? (Fast DOF also discussed)

Recommended Posts

In this (non-A:M) rendering, depth of field is achieved as postrender blurring via a generated depth buffer.




I wonder of this same technique can be used in A:M? This would for me be preferrable to the standard way of doing dof in A:M, which involve loooong (sometimes up to 20 minutes) rendertimes to look good (as comparison the above picture rendered in a little under 2 seconds, including the blurring process).


Apparently there IS a depth buffer present in A:M, but I have never come to grips with how to use it.


It would be so nice if this could be done inside A:M itself without having to use some compositing software like After Effects (which I cannot afford).


Share this post


Link to post
Share on other sites

I don't really know the answer to the DOF question. Sorry.

I think we'd have to look at the Post Effects option (on a camera) combined with DOF to get at the full effect you want.

Render time is then mostly a matter of finding the optimal settings.

 

compositing software like After Effects (which I cannot afford)

 

Tore.

You should look into Blackmagic Fusion. It's free and can digitally composite your shots (with DOF) in very short order.

This can be accomplished in 2D or 3D.

 

There is a learning curve to get you up and running but once that initial step is taken there'd be no stopping you.

Fusion is a lot like A:M in that it has great depth in its feature set. The difference being that A:M isn't a dedicated compositor with scripting capability.

What I like to do is explore a workflow in Fusion but then find a similar equivalent in A:M thereafter.

The setup in Fusion is often easier (because experimentation can often be very complicated) then it's just a matter of figuring out how to do the same thing natively and optimally in A:M.

 

there IS a depth buffer present in A:M, but I have never come to grips with how to use it.

 

I have used DOF in A:M before and it works great... for my part we'd just need to dig deep to optimize the workflow.

This is especially true given that some features (such as GPU blurring) weren't in A:M when DOF was originally put in place.

Translation: No one has yet published an optimal workflow.

 

My gut feel (which often proves wrong!) is that A:M's Blur post effect is a bit too subtle BUT multiple blurs can be added to increase the effect.

And... I have yet to use A:M with both the GPU blur effect and the standard blur post effect.

And... to my knowledge DOF doesn't require either to deliver it's effect (although I understand that DOF works best with Multipass).

 

So how to proceed?

I"d say that we (i.e. anyone) just needs to publish their basic DOF workflow online and then we (everyone else) can suggest changes to tailor the effect optimally.

 

A key to use of Depth Buffer might also be to use the EXR format.

As far as I know it's the only format up to the challenge... with the possible exception of TGA in some circumstances.

 

I'll add: Rendering with blur/DOF/Depth Buffers should be pretty quick. The key being to have Multipass on (and for faster rendering... limit the number of passes)

A simple setup should take only seconds per frame.

Share this post


Link to post
Share on other sites

I think we need to know more about your end goal here...

 

I'm rendering out a test of frames where the focus point drifts from far to near... mostly to refresh my memory on DOF.

I tried to emulate the scene in your image as near as possible.

Thus far, A:M is performing quite well.

 

In your example image I'm not sure exactly what you are specifically targeting however.

Share this post


Link to post
Share on other sites

OpenEXR renders can create a Depth buffer and that buffer is usable by DOF plugins in post programs like After Effects. Somewhere on this forum we've had discussions of how to enable it. I think Matt "John Bigboote" has worked with it.

 

A:M does have a similar effect built in. That is the effect you get when DOF is ON in a non-multi-pass render.

 

While A:M's fast DOF is not as refined as some third party DOF plugins for After-Effects, both have limitations that become apparent when objects are in motion.

Share this post


Link to post
Share on other sites

DOF is tricky, and time-consuming. I am messing with it now in non-A:M Element3D and frustrated with the speed. A:M does produce a depthe-buffer, and this method does work, however with DOF I always want to push it...more-more-MORE! and this method will leave you wanting for 'more' eventually... it is perfectly fine for a long-shot like you have illustrated, but let's say you were doing a macro-micro-closeup scene where a little bit of DOF just wasn't enough. A main problem with A:M's depth-buffer is that it is 8bit, producing 256 levels of black-grey-white- which is minimal. When combined with AE's camera lens blur effect clean edges around in-focus objects over out-of-focus objects are unobtainable- with the 8-bit depth. A better way, which produces full 24-bit depth involves using A:M's Fog feature, setting a white background color and rendering black objects in your scene... this too can get tricky with more complicated scenes. Another method would be to break your scene into multi-planar levels and rendering each out seperately with mattes...

 

Also to note, A:M's DOF feature works differently in multipass or standard renderer, and with Hash's robust and affordable rendernodes and NetRender speeding-up the render process might make real 3D DOF feasible on faster multi-core machines.

Share this post


Link to post
Share on other sites

...A main problem with A:M's depth-buffer is that it is 8bit, producing 256 levels of black-grey-white- which is minimal...

 

Use the OpenEXR depth buffer, that has millions of steps.

Share this post


Link to post
Share on other sites

This previous thread has a discussion of both of A:M's DOF effects and down around post #29 information on getting A:M's OpenEXR buffer into post programs like After Effects.

 

It also has a brief demo of the effect created in post on an A:M render..

Share this post


Link to post
Share on other sites

Thanks for all the illuminating answers! Actually I wasn't aware that dof worked at all in A:M outside multipass. Allthough it doesn't sound all that promising, quality wise. I guess the OpenEXR is the way to go. Thanks for the link Robert, and Rodney for the the reference to Fusion 8, which I didn't know. It seems very interesting!

Share this post


Link to post
Share on other sites

I just noticed that Fast DOF doesn't seem to be functioning in v18.

Share this post


Link to post
Share on other sites

Here are two frames from my Legos DOF test but this is with A:M's built in Fast DOF instead of doing it in post. This is done in v16...

 

near focus

LegosDOFTestVxx000.jpg

 

 

far focus

LegosDOFTestVxx048.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Those Lego renders looks really good, Robert! A downer that fast DOF doesn't work in 18. I really could use that. Wonder if the cause is a reportable bug, or if it is because that feature has been discontinued...?

Share this post


Link to post
Share on other sites

Those Lego renders looks really good, Robert! A downer that fast DOF doesn't work in 18. I really could use that. Wonder if the cause is a reportable bug, or if it is because that feature has been discontinued...?

 

Those are a favorable situation for it. Some cases will not work as well, but it's there to try if you want to load up v16 or v17.

 

I'm sure the absence in v18 is just a bug and I've made a report for v19 on it.

 

Here is the PRJ and render Preset if you want to try it...

 

LegoGlossy06b DOF rack.prj

 

FastDOFDemo.pre

Share this post


Link to post
Share on other sites

I never heard of FastDOF!

 

Would you be able to 'push' the un-focus a little more... or a LOT more... say you had an art-director who said "Looks good but I would like to emphasize the blurr even more... can you push it?'

Share this post


Link to post
Share on other sites

Lon long time ago I used to render out #'d frames and post process them in DeBabalizer. Couldn't you do the same with photoslop's batch and the focus effect? It should be pretty quick to do.

Share this post


Link to post
Share on other sites

 

 

Would you be able to 'push' the un-focus a little more... or a LOT more... say you had an art-director who said "Looks good but I would like to emphasize the blurr even more... can you push it?'

 

There is an upper limit to the blurriness and i may have reached it in my test PRJ.

 

One way to get a bigger blur is to render a much larger field of view and larger res and then crop the image back down to the original field of view.

 

The left was rendered at 640x480 with the camera "focal length" set at 45mm

The right was rendered at 1920x1440 with the camera "focal length" set at 15mm and then cropped down.

 

DOFComparison_45vs15mm.jpg

Share this post


Link to post
Share on other sites

this is with A:M's built in Fast DOF instead of doing it in post. This is done in v16...

FAST dof? Hadn't heard of that either!

 

Is Fast DOF = rendering without multipass?

 

When I tried it in ver 16b/32 (frame 0) it took 2 secs with multipass OFF (first image)! and 24 seconds when using 36 passes (2nd image). (Have not tried in ver 18)

 

Not only is it quicker - Multipass OFF looks better to me-

LegosSpecNOMPDOF000.jpg

LegosSpec36passDOF000.jpg

Share this post


Link to post
Share on other sites

I think the Fast DOF has been there at least since v11, probably before that.


Not only is it quicker - Multipass OFF looks better to me-



For big blurs with multi-pass DOF you have to do a lot of passes to blend it all together but it should be more accurate and not have the weird artifacts when objects move that the depth buffer DOF (what FastDOF really is) has.

Share this post


Link to post
Share on other sites

 

the depth buffer DOF (what FastDOF really is)

I still am not understanding what you mean by FAST DOF?

 

Do you mean using the depth buffer in some other program? or using the depth buffer in some other way within A:M to create depth of field effects?

 

I can understand that rendering with MultiPass off doesn't work well for creating "blurring" due to motion, but for me:

 

For creating the depth of field effect of a lens, the rendering looks great with multipass OFF. AND is also very FAST. (No use of depth buffer required, no 2nd step). The only thing set was the focus distance, along with near and far distances.

Share this post


Link to post
Share on other sites

I call it "Fast DOF" (the DOF you get with multi-pass OFF) because I recall Martin talking about A:M once with something like "...and a fast depth of field effect that only takes a second to compute..."

 

It is a "post effect" much like FakeAO; it uses a depth buffer that A:M creates internally for rendering purposes to calculate its effect. FakeAO isn't real AO and Fast DOF isn't real DOF, but they resemble their namesakes well enough in most circumstances.

 

Fast AO does pretty much the same process as the DOF plugins for After Effects that use a depth buffer. It's not as advanced and full-featured as the other guy's who've spent 10 or 15 more years coding and tweaking whereas A:M's has been sitting there unnoticed without much clamor for it to be improved. But it is there.

 

 

The DOF you get with Multi-pass is done by jittering the position of the camera to simulate the way a real lens is not an infinitely small point and is capturing the scene from many slightly different angles.

Share this post


Link to post
Share on other sites
Those Lego renders looks really good, Robert! A downer that fast DOF doesn't work in 18. I really could use that.

 

 

And good news... you CAN use that. :)

As a subscriber you can install and use any release from v13 v15 to the most current release.

This negates the worries about features disappearing from current versions that we've relied on in the past... because they still exist in the earlier versions that we can install and use.

(Just copy your current license file over to the installation folder)

 

 

 

 

(teensy weensy itsy bitsy version number edit by moderator)

Share this post


Link to post
Share on other sites

Tried to get it to work in vers. 15 and with Rob's files, but had no succes. Wonder if there is a step-by-step tut somewhere?

 

Oh, and by the way: that old-fashioned ray-tracing with cheatDOF can look very good indeed (even with a lot of camera movements) can be seen in this (non-A:M) animation:

 

https://vimeo.com/16099684

Share this post


Link to post
Share on other sites

I tried v15. For some reason the render to file just gets a blank screen whether DOF is ON or OFF.

 

But the DOF is working in an onscreen render, Something non-DOF related must be weird about the PRJ. You can use v16 or v17. Those work.

 

 

V15:

LegosDOFTest_V15_x.jpg

Share this post


Link to post
Share on other sites

Cool video posted by Tore... great DOF usage as well as many cool visuals there.

 

ROB- So in V17 there is a feature called FastDOF...? How does one go about implementing this feature, and why do we suppose it has been lost in current versions?

  • Like 1

Share this post


Link to post
Share on other sites

 

 

ROB- So in V17 there is a feature called FastDOF...? How does one go about implementing this feature...

See post 19

 

 

, and why do we suppose it has been lost in current versions?

 

 

I'm sure it's just a bug.

Share this post


Link to post
Share on other sites

Some examples/tests done in A:M 18:

 

This is multipass (9x) with depth of field - rendertime 1 minute 30 seconds

 

 

And here is the saved depth buffer used in Fusion 8 (free software) to apply a blur

 

 

...resulting in this - rendertime 25 seconds (plus the time in Fusion):

 

 

 

Share this post


Link to post
Share on other sites

I'm not so keen on that "Fake' DOF/Depth Buffer... Look at the far elbow... it does not know if it is IN or OUT of focus, that hard edge does not work for me.

  • Like 1

Share this post


Link to post
Share on other sites

Try it with A:M fast DOF now.

 

Would like to, but those versions of A:M where fast DOF is supposed to work, will not run on my machine without crashing it.

You made a bug report for ver. 19, so I guess I'll have to wait til that is released

Share this post


Link to post
Share on other sites

Weren't you using 16 or 17 before?

 

Ah, you're absolutely right. My mistake. I confused some of the early 18 versions for 16 and 17.

 

So here is the same scene rendered in A:M 17 without multipass and thus with fast dof. Render time 30 seconds.

 

 

Looks much much better than the Fusion version, but still some artifacts (along the edge of the window). Looks promising - have to experiment with this some more.

Share this post


Link to post
Share on other sites

Pretty good.

 

Is there anything unusual about how the windows is done?

 

Is the view thru the window a rotoscope image?

Share this post


Link to post
Share on other sites

Is there anything unusual about how the windows is done?

 

Is the view thru the window a rotoscope image?

 

No to both questions. You can se how the scene is constructed here:

 

 

 

The window is just a hole, and the wall seen through it is just a normal imagemapped plane.

It is a bit strange as the depthmap itself has an absolutely clean edge.

 

 

 

Maybe it is due to the high contrast?

Share this post


Link to post
Share on other sites

Try moving that backdrop much closer and see what happens. The edge of that window ought to be much blurrier.

Share this post


Link to post
Share on other sites

Moving the backdrop closer didn't change anything, but I tried turning of the volumetrics of the blue spot shining through the window, and that did the trick. But of course it also changed the look of the picture completely.

Share this post


Link to post
Share on other sites

Complex interactions like that may be where the multi-pass DOF is the only accurate solution.

  • Like 1

Share this post


Link to post
Share on other sites

I'm sure the absence in v18 is just a bug and I've made a report for v19 on it.

 

Just to be sure, did you make a bug report for this issue? I can't find it in the Mantis?

 

By the way, any qualified guess on a release date for vers. 19?

Share this post


Link to post
Share on other sites

 

I'm sure the absence in v18 is just a bug and I've made a report for v19 on it.

 

Just to be sure, did you make a bug report for this issue? I can't find it in the Mantis?

 

By the way, any qualified guess on a release date for vers. 19?

 

 

 

It is officially issue #6683 which probably will not be visible unless you are one of the excessively-privileged v19 alpha testers, like me. B)

 

It is "assigned", meaning that Steffen recognizes it and has committed to fixing it.

 

I don't know when v19 will go into public beta, no ETA has been announced, but in the mean-time you can be working on your v19 Mascot Contest entry. :)

  • Like 1

Share this post


Link to post
Share on other sites

I wonder what the status of "Fast DOF" in the current version (A:M 19.0 C) is? There still seems to be some difficulties as can be seen on the test below: non-multipass render makes some double images (but not DOF blur) wheter DOF is on or off.

 

The status on the bug report is still pending. Any news on this?

 

 

Share this post


Link to post
Share on other sites

Tore, can you make a test PRJ out of that?

 

Replace the character with a simple vase, leave the lights and camera the same, leave the background wall, delete all the other models.

 

 

 

The status on the bug report is still pending. Any news on this?

 

 

"Assigned" is all I know about it.

Share this post


Link to post
Share on other sites

Here is the test prj. I changed the pattern on the wall and that apparently made the double/ghost image go away, but the DOF issue remains the same. Thx for having a look at it!

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×