partial hidden surface removal

Started by
5 comments, last by Thomas Obermaier 21 years, 6 months ago
hi! i''m working on a wireframe 3d engine (don''t laugh it is for special devices...) okay. i''m looking for a fast technique of hidden surface removal. at the moment i''m doing only backface culling (after projection). but when i have 2 front facing polygons and the nearer one is covering the 2nd face i don''t know exactly how to remove the part that is drawn into the 1st polygon (remember: wireframe) so it looks like this:


|\ 1st
| \
| |\
|_|_\
  |  \
  |___\ 2nd

 
but it should look like this:


|\ 1st
| \
|  \
|___\
  |  \
  |___\ 2nd

 
at the moment i''m currently filling the faces with the backgroundcolor but i think there must be a faster way? the polygons are depth sorted and i don''t want to use a true depth buffer (because this device hasn''t much memory ...) thanks in advance thomas
Advertisement
wireframe = lines
lines = edges

so, run a check to see if any of your edges cross each other, and if so, just reduce the line further away to the point where it crosses the line in front.

You should be able to find some tutorials (if needed) on line-line intersection.
Hallo,

try drawing front-to-back, then using line intersection tests (sutherland or the like) to see where the polygon behind the previous polygon intersects it.
if a vertex lies inside another polygon, clip the polyogn against the line and draw the new polygon(s). you could also figure out which lines are ''wrong'', and just redraw them with background color instead of filling the entire poly.

btw is this for a nokia handy or something :-) ?
Actually I think, that the ''fill with black and draw outlines'' will be faster than explicit clipping of the edges. At least, with a substancial number of faces in the view. The cost of intersecting and clipping will quickly become overwhelming (in addition to that, clipping can easily introduce floating point accuracy problems). There are, however, a number of methods to accelerate this type of hidden line removal.

Filling the face with the BG colour, on the other hand, is pretty fast (no textures, no lighting, ...). You don''t have to use the depth buffer, if your faces are z sorted: just draw them back to front, first the filled face in BG colour, then the grid over it. Repeat for all faces.

How much faces per frame are you targetting ? If it''s a very low number, say 50 to 100, then the clipping might actually be a viable solution.

/ Yann
If the display resolution is very low, this is also a point in favour of black filling.

What kind of stuff are you drawing - I mean triangle count and size, and is in indoors, outdoors, in space or what?
I''m working on a wire-frame 3D engine for a "special device" myself
As stated, there are many ways to handle what you''re asking for, depending on what kind of scenes you''re expecting.
Also, it would help if you could tell us what this "special device" is.
Using polygon to polygon clipping for HSR (or rather hidden line removal, but they require you to perform the same tasks) is nasty ...

How about a span buffer algorithm?

This topic is closed to new replies.

Advertisement