@EricCartman (EricCartman) posted a new topic, subject "Zdepth focus". It read:

   Hey gang,
    
    Dunno if it is just me being utterly stupid but I can't figure out how to setup zdepth so that the focus is in the middle (things in front and behind the object are blured but the object is in focus). Whelp!
    
    Thanks in advance.

@Wurzelsepp2000 (Wurzelsepp2000) replied

    Ehm… what you are doing? You want to do some depth of field effect? Which effect do you use? Scanline/effect, scanline/multipass or mental ray/multipass? Normally you can use the camera target node as the fucus point.

So @EricCartman (EricCartman) replied

    Scanline multipass.

So @andrewjohn81 (andrewjohn81) replied

    just kind of as a reminder, AE7 has the lens blur effect in it.
    
    This is ALOT faster and usually creates smoother results. It also adds in specular control.  
    The downside is that it is less accurate if that's really what you need.
    
    But it is nice to be able to interactively change the blur results and the amount at any given time.

After which, @EricCartman (EricCartman) added

    This still doesn't help me. Coz in renderElements zdepth only has zMin and zMax values.

@andrewjohn81 (andrewjohn81) replied

    I usually create a custom one anyway. That way it is also antialiased.
    
    To do this create a self illuminated material with a falloff on it. Set it manually to the min and max to create your gradient.
    
    These render extremely fast as there are no lights in the scene (oh yeah, there need to be no lights) and simply asign that material to everything.
    
    Most renders have a material override feature (such as mental ray, vray, brazil, and final render). Those are the only one's I have used that have it. But that's definitely most renderers.
    
    If your question is that you want a product in focus (the ENTIRE product) then in front blurry and in back blurry, then you are asking something physically impossible. I just want to make sure you know that.
    
    It is, however, possible in post using a similar method.  
    If you set the min and max the same way I said, but put make one gradient in lay completely in front, and another completely behind. You can composite that together to create one zdepth image to then finish off your DOF in post.
    
    It'll create a strange looking image though. Almost more strange than having no laura22@example.net.

To which @pd1 (pd) replied

    CGTalk
    
    ### Z-Depth passes? | Squash-n-Stretch | CGSociety Forums
    
    I read an old issue of 3D world today that had a brief explanation on Z-Depth passes by Meats Meiers. Being Meats Meiers, it was really unhelpful, so I was wondering if I could get help on here. How to I render out a Z-Depth pass in Max, and is it...
    
    andrew: have you checked your ies thread lately?

So @EricCartman (EricCartman) replied

    You are saying this is impossible… I rendered this in vray with dof. I am just asking how to achieve this with zdepth pass.
    
    project17_render1.jpg433x650

Then @andrewjohn81 (andrewjohn81) said

    I am referring to real life being possible/not possible.
    
    Generally you pick a spot to focus on, as in the bottle cap that is in focus with your image, and the DOF effect becomes more appearant as the depth gets further away from that single point. Within inches you shouldn't notice the effect, nor will you in 3D. UNLESS you turn the effect way up. The same thing happens with a camera though.
    
    Depending on the lense you can have the tip of someones nose in focus and the back not.

So @Wurzelsepp2000 (Wurzelsepp2000) replied

    Hi!
    
    Blurred front and back is possible in real life of course. Do you ever photograph? The more narrow the focus plane is, the more the back AND front is blurred. Normally this effect is not visible. But if you want to photograph an insect for example you´ll have exactly this effect. And for sure this is a big problem because the focus plane is so narrow that not even the insect is completly in focus. That´s why you normally do such photographs with flash light. So you can reduce the shutter and get a wider focus range.  
    Or do I misunderstood you andrew?
    
    But I agree with andrew that you try to do it in post. Just make a test with a single rendered frame and photoshop CS (or even CS2). The LENS BLUR filter has a lot of settings. And you can scroll the focus range as well. It´s not exactly the same as you do in 3D but it works. Ok not always. Sometimes you get some artefacts around the front object. But that´s why I said. MAKE A TEST!   
    Maybe you can search for a tutorial but it´s really simple to do that.
    
    Cheers

To which @scrimski (scrimski) replied

    There is a DOF toy script on www.scriptspot.com, which calculates the min and max range for the z-depth based on focal length, focus distance and f-stops.

After which, @andrewjohn81 (andrewjohn81) added

    Yes, I agree Wurz. You are right. That was what I was saying.  
    I was under the impression, however, that he wanted to Widen the Plane of focus, but still have a high amount of blur. That was what I was saying is impossible in real photography.
    
    The focus is always a plane. Anything in front of or behind that is actually out of focus. Of course, this sometimes is so minute that you can't see it. But the theory is still the same. The more DOF effect you have, the more appearant the plane becomes.
    
    If you do this in post you can cheat. What I have done is take my zdepth image and apply a curve to it. The DOF effect is then Less appearant, but still there at closer values when the curve is applied correctly. The values still end up close to what they should be, but it's not as appearant. I suppose instead of rendering two different zdepth maps you could also apply a carefully tweaked curve to flatten out the portion you want in focus.

So @CGTalk_Moderation (CGTalk_Moderation) replied

    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.


{'source': 'discourse', 'url': 'https://forums.cgsociety.org/t/zdepth-focus/965349', 'title': 'Zdepth focus', 'views': 312, 'has_accepted_answer': False, 'word_count': 964, 'like_count': 0, 'reply_count': 10, 'participant_count': 6, 'posts': 13, 'tags': '', 'author': '@EricCartman (EricCartman)', 'participants': '@EricCartman (EricCartman), @Wurzelsepp2000 (Wurzelsepp2000), @andrewjohn81 (andrewjohn81), @pd1 (pd), @scrimski (scrimski), @CGTalk_Moderation (CGTalk_Moderation)', 'image_url': '', 'created_at': '2006-08-02T07:45:43.000Z', 'last_posted_at': '2006-08-03T06:29:46.000Z'}