Hello Peterakos:
Hello.

I try to create linear values for depth using the following code:


Vertex Shader
    float depth_in_eye_space = (gl_ModelViewMatrix * gl_Vertex).z;
    depth = (-depth_in_eye_space - near)/(far - near); //depth is varying

Fragment Shader
    gl_FragColor = vec4(depth, depth, depth, 1);


The problem is that in the depth texture, many different levels of
depth are creating. (attached 1)
As Wang Rui already said, use a floating point buffer if precision is a problem. Another option would be to use the stock depth buffer (i.e. depth buffer and don't write the depth yourself) and re-linearize it in you SSAO pass,

That causes problems in my next pass which uses the depth texture to
create an ssao image. (attached 2)
The artifacts that you are seeing here will not disappear completely. As you didn't provide any shader code I can only guess that you are not biasing the lookups for the SSAO.
In my SSAO Implementation (heavily based on
http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-simple-and-practical-approach-to-ssao-r2753

I have this artifacts as well If I don't use correct bias values.

How can i get the right depth values in depth texture ?
They are right, They are just not what you want them to be
;-)

hth
Sebastian

Thnx.


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to