#### Archived

This topic is now archived and is closed to further replies.

# partial hidden surface removal

This topic is 5721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
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 :-) ?

##### Share on other sites
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

##### Share on other sites
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?

##### Share on other sites
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.

##### Share on other sites
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?

• 38
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631362
• Total Posts
2999577
×