Wednesday, March 28, 2012

Revisiting Lens Effect / Bokeh

Hi all
this time i'm revisiting lens effect called bokeh.
last week a friend of mine asked me about my film dof effect, and he asked if i'm supporting bokeh effect, i told him that i used to do it with FFT and with dx11 i can do it better.
as i don't have dx11 card (i'v old geforce 240 gt with dx10.1) i can't do the effect like crytek and unreal samaritan demo.
so is there another technique to do it without dx11? well yes...
what we can do is to create a huge vertex buffer that contain quads, one quad per pixel, and inside the vertex shader we can place and size them as needed.
this technique will work on dx9 hw and should be done on half or quarter size render target because the hugh amount of vertices it required, this technique add as new feature to unreal engine.
i don't really like the idea of having huge VB per pixel, so can we do better?
i did simple test in render monkey and create a "pentagon filter" inside the pixel shader, i control the size via simple circle of confusion value just to test and see if its working.
the filter uses 30 samples per pixel and its very fast, not that i had the chance to test the VB technique, but its faster than crytek method which is very fill rate heavy.
anyway, here is a short movie that show this simple test i did, enjoy :)


1 comment:

Squid said...

Hmm, this is quite interesting. But could you please explain how you reach this in details?