Depth Of Field / DOF

Has anyone a Depth Of Field Post Effect handy?

Would anyone be able to adapt this 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:

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.