How to apply depth of field inside specific region?

Hi I am applying depth of field into my scene. I set focal length to 1000 because the character is 1000 away from the camera. And I would like a strong blur effect in the distance so I set aperture value to quite low, about 0.15.

The consequence is that the dof becomes very shallow. Only a slight offset from the character would cause blurring, which means other NPCs tend to be out of focus.

What I want is the dof effect only occurs in the far and near. And the scene inside the middle range should keep clear (in focus). I tried using post processing material to lerp based on scene depth. But it seems that there is no dof method available in material editor. Is there any way to handle this? Thanks!

There is a depth of field function. Maybe you can manipulate the pixel depth to achieve the desired effect. Can’t be much more of help because I don’t use DoF in my project.

Thanks. I think the DoF function outputs 0 to 1 according to in/out of focus. But it seems the output value cannot be utilized to set DoF effect. Maybe I have to write my own blur algorithm in material?

Read the page on it. A Cine Camera Actor sounds easier to use, with more settings to modify the focal region and focal distance. There’s also the Draw Debug Plane, which allows for viewing a color-coded visualization of the DOF effects currently rendered.