# Doubts on Post Processing Effects

**URL:** <https://forum.babylonjs.com/t/doubts-on-post-processing-effects/18681>\
**Category:** Questions\
**Created:** [February 25, 2021, 12:10pm UTC](https://forum.babylonjs.com/t/doubts-on-post-processing-effects/18681 "2021-02-25T12:10:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayakannan](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jayakannan](https://forum.babylonjs.com/u/jayakannan)\
**Post date:** [February 25, 2021, 12:10pm UTC](https://forum.babylonjs.com/t/doubts-on-post-processing-effects/18681/1 "2021-02-25T12:10:50Z")

</div>

How to set autofocus in DepthOfField in Default Rendering Pipeline.  
For Example, Once I go near to any objects in the scene, its focus needs to be changed automatically and make the object clear. Is It Possible?

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [February 25, 2021, 12:43pm UTC](https://forum.babylonjs.com/t/doubts-on-post-processing-effects/18681/2 "2021-02-25T12:43:47Z")

</div>

Did you try to walk through this example? - [https://playground.babylonjs.com/#8F5HYV#9](https://playground.babylonjs.com/#8F5HYV#9)

---

<div class="post-metadata">

**Author:** ![tabrock](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@tabrock](https://forum.babylonjs.com/u/tabrock)\
**Post date:** [March 31, 2021, 11:33pm UTC](https://forum.babylonjs.com/t/doubts-on-post-processing-effects/18681/3 "2021-03-31T23:33:05Z")

</div>

Hey this is 100% possible. In addition to following the guide above I’d recommend adding a function to scene.onAfterRenderObservable() to get the updated distance value after every frame.

In my case below, I have a mesh I wish to target and I use the built it meshDistanceToCamera function to calculate the distance. It’s calculated in meters and babylon’s default render pipeline DOF expects millimeters, so we have to multiply it by 1000.

I hope this helps!

- note SceneManager.Meshes is just a dictionary of meshes.
