Labels

Showing posts with label DoF. Show all posts
Showing posts with label DoF. Show all posts

December 19, 2011

GLSL depth of field with bokeh v2.4

here is a new update on the depth of field shader.
changes:
• again totally redone the depth of field calculation with 2 possible options:

- Physically accurate DoF simulation calculated from "focalDepth" ,"focalLength", "f-stop" and "CoC" parameters.
- Manual - artist controlled DoF simulation calculated only from "focalDepth" and individual controls for near and far blur planes.

• added "circe of confusion" (CoC) parameter in mm to accurately simulate DoF with different camera sensor or film sizes.
• optical lens vignetting factor based on f-stop value and user defined properties.
• cleaned up the code
• some optimization

Shader is HERE
Blend is HERE

controls:
Mouse+WASD - look/movement
LMB - drag the focal point object
1 - enables DoF rendering
spacebar - toggles debug view
Up/Down arrowkeys - zoom in/out (changes focal length)
Left/Right arrowkeys - changes f-stop value

December 9, 2011

GLSL depth of field with bokeh v2.3

This is a major update for my depth of field w. bokeh shader.
I have added a python lens control file which gets focus distance from an object, adds control of "f-stop" variable, which controls "aperture" value for the shader.

list all of the new features:

• new and physically more accurate DoF, using real lens equations
• two extra input variables - focal length (in mm), aperture iris diameter (in mm)
• added a debug visualization of focus point and focal range (red line = focal point, green area = focal range)

separate python file:
• sets focus distance from an object
• added slow adaptive focusing for natural feel
• option to control aperture diameter with f-stop values (range: f/1, f/1.4, f/2, f/2.8, f/4, f/5.6, f/8, ..... f/256)
• focal length control (default range from 6mm to 600mm)

Shader is HERE
lens control file HERE (made for Blender)
Blend is HERE



debug focal plane and depth range visualization:



v2.2 was done yesterday and I just did not had the time to post it here.

November 22, 2011

GLSL depth of field with bokeh v2.1

This is an update from the previous post on DoF bokeh shader.
The main addition is an option of pentagonal shape bokeh. The technique is hackish, but it works. Still I am looking for a more simpler way to make procedural n-gonal shapes of sampling.

The shader is made on 2006 iMac with Mobility Radeon card so it should work on any hardware supporting OpenGL

Screenshots are captured with high sample count, but the point is to show the features and capabilities of the shader.

some of the main features explained with images:

threshold & gain:
brings out highlights by "threshold" value and enhances them with "gain"
as you can see this is the main part that makes the distinct look of the bokeh blur. Without bringing out highlights, the blur looks like just a regular circular blur.








fringe:
adds chromatic aberration for the blur (small overlay image shows r,g,b color offset of the sample)



bias:
shifts the weights of the samples on the bokeh edges





pentagon:
pentagon shape of the bokeh (still needs some work)
edit: i have removed the "scale" factor, it is now automatic.




GLSL frag shader: HERE

October 26, 2011

GLSL depth of field with bokeh v2

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

June 8, 2011

ROME "3 DREAMS OF BLACK"

ROME "3 DREAMS OF BLACK" is an interactive film/music clip powered by WebGL

The exciting part is that I got emailed by the lead developer Branislav Ulicny (Altered Qualia) to inform me that he ported my GLSL depth of field with bokeh filer to WebGL. And recently I found out it is being used in this project.

my involvment in video at 2:00 ;)



to see it yourself
go here:
www.ro.me
the tech behind it:
www.ro.me/tech