Tech Forums > General Discussion

Accessing the depth buffer in GLSL

<< < (2/4) > >>

oli3012:
Good idea! I'll look up to it.

oli3012:
I finally succeeded to eradicate most of the visual artifacts in my DOF shader!  My biggest problem was the bleeding effect caused by the merging of the blur buffer and the scene. I played a bit with the kernel and sampler values and finally found a way to attenuate it.

Though, I wanted to try other approaches, so I did another version of the DOF shader. In this one, instead of blurring all the scene and merging it to the initial image in concordance with the depth buffer, I do the blur passes by interpolating the kernel value in function of the depth buffer. This technique is far more GPU intensive, though it yields better results. It totally eradicates the bleeding artifact, gives a smoother blur and gives the impression of a smoother focal transition when moving the camera.

Here is a picture that shows the two techniques:



The fast DOF is probably better for games though, the visual difference isn't so noticeable, but the performances are far better (2x faster: 200fps vs 400fps on my 8800gt).

Here is the code if you want to check it out! http://www.mediafire.com/?yqwzjzqmjnl

oli3012:
Oh yesss! I finally found a way to optimize my DOF shader with manual down sampling :P Now it is as fast as the fast DOF, but without loosing quality!

Here is the link: http://rapidshare.com/files/322500510/dof_demo3.rar.html

oli3012:
If the link is broken, you can use this one: http://www.mediafire.com/?h3tdfjvyzxg

Crysis-Like post-effect, here it is :P

JeGX:
Yeah!

Maybe a little remark: I don't know if you can use a texture in the same time as source and as destination like you do here with blurBuffer:

--- Code: ---<step name="_2" target="blurBuffer" gpu_shader="VerticalBlur" >
  <texture render_texture="blurBuffer" render_texture_type="COLOR" />
  <texture render_texture="sceneBuffer" render_texture_type="DEPTH" />
</step>

--- End code ---

I think you should use another render texture and do some ping-pong between two render textures:

--- Code: ---...
<render_texture name="blurBuffer1" type="COMPOSITE" />
<render_texture name="blurBuffer2" type="COMPOSITE" />
...
...
<step name="_1" target="blurBuffer2" gpu_shader="VerticalBlur" >
  <texture render_texture="blurBuffer1" render_texture_type="COLOR" />
  <texture render_texture="sceneBuffer" render_texture_type="DEPTH" />
</step>

<step name="_2" target="blurBuffer1" gpu_shader="HorizontalBlur" >
  <texture render_texture="blurBuffer2" render_texture_type="COLOR" />
  <texture render_texture="sceneBuffer" render_texture_type="DEPTH" />
</step>
....
...

--- End code ---


Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version