Hi,

I would like to add the computation of the z-depth value in the ray traced volume shaders. I'm pretty new to raytracing on gpu, so forgive me if this is a naive question!

I've tried to add this code in the fragment shader, just after the line "gl_FragColor = color":

      ....
      gl_FragColor = color;

      vec4 inter = gl_ModelViewProjectionMatrix * vec4(texcoord,1);
      gl_FragDepth = inter.z / inter.w;

      return;
In theory my idea is to compute the position of the intersection with the volume, and use the model view & projection transformation matrix to get z buffer value computed. It looks good... but it's not right!

Does any one have an idea about what I'm doing wrong?

Thanks for any help,

Regards,

Yvon

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

Reply via email to