Hi Peterakos,

Try changing the internal format of the output buffer to float32. I guess
it is a precision problem. During the SSAO implementation of effect
compositor (in osgRecipes now) I also encountered the problem and using 32
bit float values seems good to me.

Wang Rui


2012/11/9 Peterakos <hay...@gmail.com>

> 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)
> That causes problems in my next pass which uses the depth texture to
> create an ssao image. (attached 2)
>
> How can i get the right depth values in depth texture ?
>
> Thnx.
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to