Hi Yvon,

The present osgVolume shaders that I've written compute the ray start
position from the initial fragment generated by rendered the backface
of the cube, then shoots the ray forward towards the eye point and
then clamps this to the dimensions of the cube.  It then computes the
texcoords for this from these ray coords.

Robert.

On Wed, Aug 5, 2009 at 7:40 PM, Yvon Halbwachs<[email protected]> wrote:
> 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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to