Depth Of Field / DOF

Has anyone a Depth Of Field Post Effect handy?

Would anyone be able to adapt this http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update) to Playcanvas?

We’ve made a few attempts at a Bokeh effect. None were completely satisfactory, bad interface, too slow, etc.

I believe @vaios tried a few here: https://playcanvas.com/project/6461/overview

https://playcanvas.com/editor/code/6461/posteffect_dof.js
https://playcanvas.com/editor/code/6461/posteffect_dof2.js

If I remember right, the second one is better but could be a bit slow at runtime. Worth trying out though.

dof.js just blurs the image overall, dof2.js throws an error in the fragment shader (ERROR: 0:16: ‘unpackFloat’ : no matching overloaded function found)

Also, I can’t seem to fork the Titanfall Viewer Project? The light.js throws all kind of errors, so I’m not sure what do do here.

Looks like unpackFloat has moved some in the shader. I’ve updated dof2 to include it’s own method and fixed light.js

Try it now.

1 Like

Ah now it works, very cool! I exposed the bluramount to the UI, which gives me a bit more control. A bit slow though, like you said.