This is my second attempt to create a depth of field shader with bokeh. the first one is here:
http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html
And I am really glad that it got popular quite fast.
This one is much more flexible and I have added few new features.
• variable sample count to increase quality/performance
• option to blur depth buffer to reduce hard edges
• option to dither the samples with noise or pattern
• bokeh chromatic aberration/fringing
• bokeh bias to bring out bokeh edges
• image thresholding to bring out highlights when image is out of focus
yet to do
• add multi-shape bokeh (does anyone knows how to make procedural pentagon or hexagon?)
• bokeh vignetting at screen edges
• some minor fixes
screenshots:
fragment shader HERE
October 26, 2011
October 25, 2011
nicer SSAO
yet another screen-space ambient occlusion shader.
original technique is HERE by Arkano22.
I tuned it up a bit adding my circular texture sampling and pattern sample filtering.
Right now it is the best depth-only based SSAO I have come across.
another screenshot with noise dithering and "garea = 0.4;" instead of "garea = 0.6;" to lighten scene a bit.
scene with and without ssao:
glsl frag shader HERE
and blend file HERE
original technique is HERE by Arkano22.
I tuned it up a bit adding my circular texture sampling and pattern sample filtering.
Right now it is the best depth-only based SSAO I have come across.
another screenshot with noise dithering and "garea = 0.4;" instead of "garea = 0.6;" to lighten scene a bit.
scene with and without ssao:
glsl frag shader HERE
and blend file HERE
October 13, 2011
NVIDIA FXAA
Antialiasing has been an exclusive thing for the PC gamers over the gaming consoles. Well of course if you could afford a proper GPU to play recent games in FullHD at 16xQMSAA... until now.
Recently I have been quite interested in post-process antialiasing approaches. They are really useful for deferred renderers and for lower-end PCs and Consoles as the antialiasing process is done after the rendering the scene - as a post-process filter, just like a color correction, SSAO, Depth of Field and HDR filters.
I first stumbled upon something that tried to imitate antialiasing was in Crysis - they extracted the edges of the rendered image , blurred the rendered image and mixed the unblurred and blurred image with edges as a mask. Since then over the time the quality has increased so much that post-process AA techniques are comparable to real antialiasing. Here are more popular ones I found: NFAA, DLAA, SSAA, MLAA, SRAA, SMAA, GBAA, GPAA and SDAA... yeah there are a lot of techniques to choose. I personally really like Humus techniques (last 3), but unfortunately they require additional buffers which I cannot access in BGE right now. But few of these techniques does not require any additional buffers at all, some of them uses depth buffer and normal buffer to find the edges.
Today I have here another post-rocess antialiasing approach - FXAA by Timothy Lottes at NVIDIA.
"Fast Approximate Antialiasing" is a new anti-aliasing technique, based on several existing anti-aliasing techniques, including MLAA. FXAA is being used in Battlefield 3, DeusEx:HE, F.E.A.R.3 .
I really like FXAA because it requires only the rendered scene buffer as input and it is really simple to integrate in any game engine.
comparison shots by the Timothy himself from TheForceUnleashed2:
http://timothylottes.blogspot.com/2011/04/nvidia-fxaa-ii-for-console.html
screenshots from BGE:
without FXAA:
with FXAA
glsl fragment shader HERE
blend file for Blender 2.5x HERE
button 1 - disables FXAA
button 2 - anables it
Recently I have been quite interested in post-process antialiasing approaches. They are really useful for deferred renderers and for lower-end PCs and Consoles as the antialiasing process is done after the rendering the scene - as a post-process filter, just like a color correction, SSAO, Depth of Field and HDR filters.
I first stumbled upon something that tried to imitate antialiasing was in Crysis - they extracted the edges of the rendered image , blurred the rendered image and mixed the unblurred and blurred image with edges as a mask. Since then over the time the quality has increased so much that post-process AA techniques are comparable to real antialiasing. Here are more popular ones I found: NFAA, DLAA, SSAA, MLAA, SRAA, SMAA, GBAA, GPAA and SDAA... yeah there are a lot of techniques to choose. I personally really like Humus techniques (last 3), but unfortunately they require additional buffers which I cannot access in BGE right now. But few of these techniques does not require any additional buffers at all, some of them uses depth buffer and normal buffer to find the edges.
Today I have here another post-rocess antialiasing approach - FXAA by Timothy Lottes at NVIDIA.
"Fast Approximate Antialiasing" is a new anti-aliasing technique, based on several existing anti-aliasing techniques, including MLAA. FXAA is being used in Battlefield 3, DeusEx:HE, F.E.A.R.3 .
I really like FXAA because it requires only the rendered scene buffer as input and it is really simple to integrate in any game engine.
comparison shots by the Timothy himself from TheForceUnleashed2:
http://timothylottes.blogspot.com/2011/04/nvidia-fxaa-ii-for-console.html
screenshots from BGE:
without FXAA:
with FXAA
glsl fragment shader HERE
blend file for Blender 2.5x HERE
button 1 - disables FXAA
button 2 - anables it
GLSL Cubic Lens Distortion
Few years ago I ported HLSL Cubic Lens Distortion shader made by a really nice guy François Tarlier. I slightly modified it, but the algorithm basically is the same one used in SynthEyes.
I encourage to visit François homepage and blog for Blender, AfterFX, compositing, VFX and mathcmoving related stuff. He is a former Environment and VFX artist at Ubisoft hehe.
Here are few screenshots of the shader in action:
undistorted:
distorted w chromatic abberration and slight blurring at edges:
lens distortion & my BPCEM reflection scene:
a screenshot in my real-time snowflake growth demo with lens distortion shader applied:
more info about the snowflake project HERE
download link to snowflake demo blend (for Blender 2.5x & 2.6x):
HERE
download link to blend file for lens distortion demo (for Blender 2.5x & 2.6x):
HERE
controls: mouse&WASD - camera movement
1 - disables the filter
2 - enables the filter
glsl fragment shader:
http://dl.dropbox.com/u/11542084/lens_distortion
I encourage to visit François homepage and blog for Blender, AfterFX, compositing, VFX and mathcmoving related stuff. He is a former Environment and VFX artist at Ubisoft hehe.
Here are few screenshots of the shader in action:
undistorted:
distorted w chromatic abberration and slight blurring at edges:
lens distortion & my BPCEM reflection scene:
a screenshot in my real-time snowflake growth demo with lens distortion shader applied:
more info about the snowflake project HERE
download link to snowflake demo blend (for Blender 2.5x & 2.6x):
HERE
download link to blend file for lens distortion demo (for Blender 2.5x & 2.6x):
HERE
controls: mouse&WASD - camera movement
1 - disables the filter
2 - enables the filter
glsl fragment shader:
http://dl.dropbox.com/u/11542084/lens_distortion