Depth of Field with GLSL

Started by
9 comments, last by Pragma 16 years ago
For my first post on this forum I would like to share with you my last experiments on the topic of Depth of Field. I've always been fascinated by this post-processing effect and, since some days, I'm studying a freely available paper from ShaderX2 (Real-Time Depth of Field Simulation) in order to implement it. The source of the demo is not yet freely available because I'm still tuning some parts, but you can already see it in action in this HD video: GLSL_DoF_HD. [wink]

.: Blog | LinkedIn | Twitter | GitHub | YouTube :. All problems in computer graphics can be solved with a matrix inversion. - James Blinn

Advertisement
I have released the sources, they are online in my OpenGL demos page.
I have also implemented the second example from the ShaderX2 paper.

The relative posts on my blog are the following:
  1. I love depth of field

  2. Depth of field reloaded


Have a look of them in action on my YouTube channel, or in high resolution on my Vimeo page.

.: Blog | LinkedIn | Twitter | GitHub | YouTube :. All problems in computer graphics can be solved with a matrix inversion. - James Blinn

Hey Encelo,
there is a more advanced effect in ShaderX3 ... it should actually run even faster.
It comes from the same team and builds on the ShaderX2 article. You might also find the PDF file on the ATI website :-)
What is the obsession poeple have with these fake camera-type effects (DOF, lens flare, bloom, etc).. this is computer rendering, not photography..why fake a defect of optical lenses...
Quote:Original post by Matt Aufderheide
What is the obsession poeple have with these fake camera-type effects (DOF, lens flare, bloom, etc).. this is computer rendering, not photography..why fake a defect of optical lenses...


It isn't a "defect". The way we perceive the real world, whether through cameras or through our own human vision system, is shaped by the optics of lenses
Depth of Field is how the human eye perceives things (the wider your pupil the more light is let in just like a lens aperature). I agree though on lens flare though, I think its overdone and lens flair is not a desirable effect to have in a photo (Thats why you always shoot with a lens hood especially when using a wide angle! Sorry for the rant, Im a photographer :D).

One thing I do notice though about simulated depth of field it does not create the nice bokeh effects of a real lens. Most simulated depth of field I see just blurs and object the farther away it is relative to where the camera is. Bokeh in a camera lens is different, its created by the shape of the aperature. (Look up Canon 85mm 1.2L pictures for some amazing bokeh).
Quote:It isn't a "defect". The way we perceive the real world, whether through cameras or through our own human vision system, is shaped by the optics of lenses

It is indeed a defect because its prevents perfect viewing of everythang at once in focus...computers dont have that limitations.. why struggle to emulate a deficiency? Especially goign so far as to make it physically (optically) correct...that's just wierd.

I'm not saying such effects may not have a stylistic use in some circumstances, but the original poster gushes over DOF like its a chocolate sundae on his website.. I dont get it.
Quote:Original post by Matt Aufderheide
It is indeed a defect because its prevents perfect viewing of everythang at once in focus...computers dont have that limitations.. why struggle to emulate a deficiency? Especially goign so far as to make it physically (optically) correct...that's just wierd.


I'd guess for the same reason we have gravity, weather, people dying, and other natural phenomena in games: because they happen in real life.


Quote:Original post by Matt Aufderheide
I'm not saying such effects may not have a stylistic use in some circumstances, but the original poster gushes over DOF like its a chocolate sundae on his website.. I dont get it.


He likes DOF, so what? No need to troll his thread...


Quote:Original post by Chrono1081
One thing I do notice though about simulated depth of field it does not create the nice bokeh effects of a real lens. Most simulated depth of field I see just blurs and object the farther away it is relative to where the camera is. Bokeh in a camera lens is different, its created by the shape of the aperature. (Look up Canon 85mm 1.2L pictures for some amazing bokeh).


Yeah, it's an unfortunate consequence of the techniques used for faking the effect. Real DOF simulation requires more information than what you have rendered to the back-buffer (or render-target surface), and generally it's just too expensive to obtain that information. So a screen-space blur is used instead, despite it being completely wrong (but then again people like to use screen-space blur for shadows too, and that's also completely wrong!).
Quote:Original post by Matt Aufderheide
Quote:It isn't a "defect". The way we perceive the real world, whether through cameras or through our own human vision system, is shaped by the optics of lenses

It is indeed a defect because its prevents perfect viewing of everythang at once in focus...computers dont have that limitations.. why struggle to emulate a deficiency? Especially goign so far as to make it physically (optically) correct...that's just wierd.

I'm not saying such effects may not have a stylistic use in some circumstances, but the original poster gushes over DOF like its a chocolate sundae on his website.. I dont get it.


Don't worry, I've always found those effects (blur, dof, and even HDR) quite ugly, and I prefer playing without them. But some like them, so let them implement those techniques if they want :D.

This topic is closed to new replies.

Advertisement