DOF testing not getting desired results

Hello all,

I have seen some forums on this subject and they seemed a little older and was wondering if there was anything new.

I assume for PC dof is the boken post effect.
I import the script into a test scene PlayCanvas | HTML5 Game Engine

in the scene i have the settings as
max blur 0.2
aperture 1
Focus 5

I assume focus is the focal distance? If that is the case wouldn’t the second box be crisp?

I also know that dof is expensive so i didnt know if that had changed or if it would work with a very simple scene so was going to run some tests.

It’s reasonably expensive … nothing you’d need to worry about for running on PC, but yes on lower power mobile devices.

Here’s an example … you can use keys to disable other effects and inspect only DOF. See the source code as well.

Also grab up to date file from here, not sure how old is the one you got:

thank you @mvaligursky for the quick response.

I am using the newest library and now have it that the focal distance should be following the ball. But still does not seem to be working correctly

the DOF changes as the ball moves, but yeah it does not seem to match the position. I’m not sure what the problem is, but @ray was looking at that effect a month ago, he might know more?

1 Like

Oddly, focus needs to negative. Maybe because negative Z is forward in the coordinate system.

See here for ‘fixed’ version:


that’s much better!

awesome. Thank you very much @mvaligursky and @yaustar