line offsets

Hello all,

I’m trying to implement a vertex program used to render lines over my scene geometry (actually the silhouettes of my objects). The idea is to move backwards the silhouette lines of a mesh so as to have them rendered in front of their polygons. I wish to avoid glPolygonOffset (to push the polygons forward), and would prefer pulling the lines back the necessary distance.

What I’m trying for the moment is to implement, in the vertex program, the computation of the z-buffer value of the line vertex to be rendered. I then decrement this value by 1, and re-convert to eyespace z-value. The formula to compute z-buffer value from a z value can be found in the excellent learning to love your z-buffer . Simply mess around with the formula to obtain the method to compute eyespace z-value from the z-buffer value.

My question is : is there a simpler method, for example a technique to compute directly a z offset based on the z value itself, assuring us that the offsetted vertex will be found above the original vertex in the z-buffer ?

Thanks alot !

[This message has been edited by SuperTomate (edited 01-14-2004).]