Hidden Line Removal
Hidden Line Removal
Hallo
I would like to display a scene, but with hidden lines removed. I have read various articles about enabling Z buffers and/or stencil buffers. Here is a 'definition' of hidden line removal :
http://en.wikipedia.org/wiki/Hidden_line_removal
Can anybody please provide me with some ideas?
Thanks
Anton
I would like to display a scene, but with hidden lines removed. I have read various articles about enabling Z buffers and/or stencil buffers. Here is a 'definition' of hidden line removal :
http://en.wikipedia.org/wiki/Hidden_line_removal
Can anybody please provide me with some ideas?
Thanks
Anton
-
- Posts: 49
- Joined: Tue Jan 23, 2007 12:36 pm
- Location: Bedford, UK
-
- Posts: 49
- Joined: Tue Jan 23, 2007 12:36 pm
- Location: Bedford, UK
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
A simply approach for the fixed pipeline: Use an invisible version of the mesh, scaled by 0.999 in all dimensions, and turn of the color write.This should fill the zbuffer in order to avoid painting the wires at positions invisible from the current viewpoint. Pretty much the same as for the outline rendering, just that the inner mesh is invisible this time.
Not rendering the full tris of the wireframe is not possible without much manual rendering, though, and lots of edge detection and stuff AFAIK.
Not rendering the full tris of the wireframe is not possible without much manual rendering, though, and lots of edge detection and stuff AFAIK.
-
- Posts: 49
- Joined: Tue Jan 23, 2007 12:36 pm
- Location: Bedford, UK
Hi Hybrid,
This may be something I will implement as I too need 'retro style' wireframe graphics..
Just a couple of questions though:
1/ You mention 'color write', what is color write and how do I turn it off?
2/ When you say invisible mesh for the inner part - presumably you dont mean: as this would not render anything.. could you clarify please?
Many Thanks,
Bob
This may be something I will implement as I too need 'retro style' wireframe graphics..
Just a couple of questions though:
1/ You mention 'color write', what is color write and how do I turn it off?
2/ When you say invisible mesh for the inner part - presumably you dont mean:
Code: Select all
scenenode->setVisible(false);
Many Thanks,
Bob
Scaling would not be the proper operation to get the hidden-line effect, but to shift the vertices along the normals a bit inside the object, and then, proceed exactly as Hybrid has suggested.
Or a 2 passes effect, where the first renders only the Zbuffer of the scene, and, without clearing the Zbuffer, the next renders only the wireframe lines.
Or a 2 passes effect, where the first renders only the Zbuffer of the scene, and, without clearing the Zbuffer, the next renders only the wireframe lines.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 49
- Joined: Tue Jan 23, 2007 12:36 pm
- Location: Bedford, UK
Actually it is not necessary to do any scaling at all, two passes do the trick very well.
First past a zbuffer write with alpha test set to never write to the color buffer,
The second pass set to write if buffer is equal or less.
If you do a line thickness in OpenGl the resulting image looks just like Maya, or Xsi wire frame render.
First past a zbuffer write with alpha test set to never write to the color buffer,
The second pass set to write if buffer is equal or less.
If you do a line thickness in OpenGl the resulting image looks just like Maya, or Xsi wire frame render.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Ok, just as cassini suggested. Works right away, just render the mesh two times. First with ColorMask set to ECP_NONE, then with wireframe enabled, ZBuffer set to ECF_LESSEQUAL (to avoid missing lines where the mesh is intersecting the wireframe) and Thickness set tom something larger than 1.f for better recognizable effect (the latter only works under OpenGL). Looks terrific