Author Topic: Depth of Field on the First Day using GeeXLab  (Read 5883 times)

0 Members and 1 Guest are viewing this topic.


  • Associate
  • Posts: 1
Depth of Field on the First Day using GeeXLab
« on: August 21, 2010, 06:42:12 PM »
Hi everyone,

I'm working with OpenGL for a while, developing some minor shaders now and then, even program my own shader lab. and last night I found GeeXLab.

So, to give it a try - I wanted to create my own Depth of Field effect as PostFX step on the DepthBuffer. and I must say - I was very pleased with GeeXLab on the job.

If you are new on GeeXLab as I'm - first step is to download the samples, very useful to give a start. so, I took the BloomFX and ViewDepth examples and join them together to great DOF FX.

My Basic DOF works as follows:
Step 1: create out of focus texture - a shader that take the frame buffer color and remove all focus pixels (for my testing, pixels that the depth < 0.5).
Step 2+3: blur the out of focus texture - The problem with normal blur on DOF is that the blur should only work on pixels that out of focus (focus objects color should not blend with out of focus colors). that why the blur using the out of focus texture and no the screen buffer
Step 4: render the effect - we make a mix of the framebuffer texture and our DOF blur texture using the depth as a blend factor.

Now, what is missing? a full DOF shader should divide the depth value into 3 groups: focus range, to far range, and too close range. the current example don't have the "too close range" - but it was to late - and that might be my second day with GeeXLab.

If you want to give it a try - downloand the Xml file:


  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Re: Depth of Field on the First Day using GeeXLab
« Reply #1 on: August 23, 2010, 08:20:14 AM »
Thanks for your feedback shatzi and thanks for the explanation of your depth of field demo  :thumbup:

Your DoF effect is cool and I will use in in one of my next tests/ demos.