Hm. Maybe filtering doesn't work for depth data? (It can happen, depth 
is a bit tricky to texture with) Try to test if you get at least 
bilinear filtering. If not, you need to write your own inter-mipmap 
filter routine in the shader. (Not that hard, use frac()/floor() and 
ceil() funcs. See some existing filtering shaders.)

Cheers,
/Marcus

Stefano wrote:
> hi Marcus,
> unfortunately I already use trilinear filtering.. any other hints? :(
> 
>     nIMG = Image::create();
>     addRefCP(nIMG);
>     beginEditCP(nIMG);
>         nIMG->set(GL_DEPTH_COMPONENT32_ARB, 1, 1, 1, 1, 1, 0, NULL);
>     endEditCP(nIMG);
> 
>     nTX = TextureChunk::create();
>     addRefCP(nTX);
>     beginEditCP(nTX);
>         nTX->setImage(nIMG);
>         nTX->setInternalFormat(GL_DEPTH_COMPONENT32_ARB);
>         nTX->setExternalFormat(GL_DEPTH_COMPONENT_ARB);
>         nTX->setMinFilter(GL_LINEAR_MIPMAP_LINEAR);
>         nTX->setTarget(GL_TEXTURE_2D);
>     endEditCP(nTX);
> 
> 2007/5/7, Marcus Lindblom < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
> 
>     Be sure to use trilinear filtering, i.e. set min_filter to
>     gl_linear_mipmap_linear.
> 
>     /Marcus
> 
>     Stefano wrote:
>      > Hi there OSGers!
>      > Here we are againg with my simple depth-of-field effect.. :P I
>     grab the
>      > color buffer in a texture, i grab the depth buffer in another
>      > texture and then I simply use this fragment shader with a
>      > polygonforeground
>      > to do the job:
>      >
>      > uniform sampler2D image;
>      > uniform sampler2D depth;
>      > uniform float threshold;
>      > uniform float maxAmount;
>      > uniform float depthBlur;
>      >
>      > void main(void) {
>      >  vec4 dd = texture2D(depth, gl_TexCoord[0].xy);
>      >  float x = (dd.r-threshold)/(1.0-threshold)*maxAmount;
>      >  gl_FragColor = texture2D(image, gl_TexCoord[0].xy, x);
>      > }
>      >
>      > * image and depth are obviously the color and the depth buffer
>      > textures.
>      > * threshold is just the starting z value from which i want DOF to be
>      > applied
>      > * maxAmount is the maximum mipmap i'll use with the deepest z value
>      >
>      > Everything works as it should, except for the x variable. It shoud be
>      > between 0 an maxAmount, which it is, and its changes should be
>     smooth,
>      > as z values in the depth buffer smoothly change from point to point.
>      > Unfortunately what i'm getting is something very similar to a floor
>      > function, instead ( http://steffoz.altervista.org/1.png )
>      > The unexplicable thing is that the problem must be exactly in that
>      > line.. if I render the depth buffer with gl_FragColor = dd what I get
>      > is a smooth rendering ( http://steffoz.altervista.org/2.png )..
>     what is
>      > wrong?!
>      > I really can't find the reason for this behaviour.. any
>     suggestions? I
>      > could attach some other screenshots to better describe the situation,
>      > if useful.
>      >
>      > Thank you very much,
>      > Stefano Verna
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      >
>     -------------------------------------------------------------------------
>      > This SF.net email is sponsored by DB2 Express
>      > Download DB2 Express C - the FREE version of DB2 express and take
>      > control of your XML. No limits. Just data. Click to get it now.
>      > http://sourceforge.net/powerbar/db2/
>     <http://sourceforge.net/powerbar/db2/>
>      >
>     ------------------------------------------------------------------------
>      >
>      > _______________________________________________
>      > Opensg-users mailing list
>      > [email protected]
>     <mailto:[email protected]>
>      > https://lists.sourceforge.net/lists/listinfo/opensg-users
>      >
> 
> 
>     -------------------------------------------------------------------------
> 
>     This SF.net email is sponsored by DB2 Express
>     Download DB2 Express C - the FREE version of DB2 express and take
>     control of your XML. No limits. Just data. Click to get it now.
>     http://sourceforge.net/powerbar/db2/
>     _______________________________________________
>     Opensg-users mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/opensg-users
> 
> 
> 
> 
> -- 
> Stefano Verna
> mail/gtalk: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> skype: steffoz
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to