Today I tried about a half-dozen of methods from shadertoy, to draw lines using a vertex-geometry-fragment shader, but none worked. Obviously the flaw is with my software.
Do you have any tiny working examples in OpenGL 4 that draws thick lines? I can't seem to replicate anyone's results.
Here is the full source, including the line shaders:
taby said: Any ideas on how the hidden line removal using my code?
Ideally you have edge normals for back face culling.
But if not, the only way i see is a depth prepass, so you can do a depth test with some depth bias. Though, to get the perfect bias, you'd again need the angle between edge and adjacent triangles. And even then artifacts will remain.
So i would go for the edge normals, orienting the edge quad to the edge normal. While calculating those edge normals, you could also reject convex / coplanar edges.
The cell shading approach (drawing extruded back face mesh) might be easier and look better, even if the lines become thinner on a corner than on an edge. Not sure.
P.S. I am trying my best to implement half-transparent lines, like you had suggested. I’m listening to you…. Just takes me a while to process these thoughts of yours . Thanks again, man.