# Depth of field in viewport and render different

I've same values for depth of field for viewport and render but I'm getting different results.

This is depth of field correctly working in viewport, this is the aim:

This is what I get after rendering:

These are my settings:

• Enable "high quality" to have the viewport show the correct depth of field. – user1853 Apr 28 '18 at 4:59
• @cegaton ok that worked, both, render and viewport now show same DoF, but I want the earlier version of DoF from viewport in my render, what am I doing wrong? When I increase the F-stop value everything blurs, the 'sphere' shouldn't get blurred, I want the focus to be around sphere. – Suraj Sirohi Apr 28 '18 at 6:14
• @SurajSirohi Where is the origin point of the sphere? I suspect that's where the focal plane is placed (have not tested). Instead of selecting the object you want in focus directly, try setting to an empty and placing that on the surface on your object. Or use the distance setting by pressing E while moused over the distance slider and then clicking in the 3D view. – gandalf3 Apr 28 '18 at 7:34
• @gandalf3 thanks, it worked, it was the distance between the camera and the focus point, the camera was too far and the clipping start was set too far. Also set origin to geometry. – Suraj Sirohi Apr 28 '18 at 8:03
• Instead of an Object use an empty to control focus distance. Also it hiela if you enable the display for "limits" on the camera section. That way you can visualize clipping and focus distandas. – user1853 Apr 28 '18 at 12:17