Archived

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

gorgorath

CSG Errors

Recommended Posts

Hey fellow developers My Constructive Solid Geometry(CSG) processor is almost working, but there are a few little bugs that need to be squished. In some cases the processor, will split polygons that are unnecessary. To illustrate this i''ve uploaded a screenshot of what excactly is going wrong: http://home.hccnet.nl/pj.holverda/CSG_Problems.jpg the ''green'' polygon is split by the infinite blue plane, but as you can see, this shouldn''t be the case. Is there a simple solution for this ''cause i ran out of idea''s. ? Paul

Share this post


Link to post
Share on other sites
Only split a polygon if it intersects the polygon that you got the "infinite plane" from. You get issues with T-junctions by taking that route, so be aware that you''ll have to fix them to avoid pixel dropouts.

Share this post


Link to post
Share on other sites
thnks,

for the reply, i''ve been testing this also, but then there is another problem. Say we have a cilinder, which top is excactly ''ONPLANE'' with the bottom of a cube. So the sides of this cilinder never intersects with the polygon of the cube.( The uppermost vertices are onPlane with them) But in order to create legag geometry ( for the BSP compiler ) the cube''s polygon needs to be splitted. If it''s unclear what i described i can take another screenshot

cheers,

Paul

Share this post


Link to post
Share on other sites
Split if the faces intersect at all, and use a non-conservative intersection test so that they''ll split even if they''re very barely touching (2 points one side, 3rd point on the plane).

I take it you''re performing a CSG union, using a BSP-like traversal of the faces. If faces are co-planar (within some epsilon) then you test something: if face normals oppose each other, treat them as if they are completely on the back of the other face plane; if they face the same direction, then the 1st one is on the front and the 2nd is on the back. By 1st and 2nd, I mean the 1st is the first face you encounter in your deterministic traversal. This results in deletion of faces that will be hidden inside the resulting outer surface, and prevents z-fighting between coplanar faces by removing all but the first one.

Here''s a good CSG page, and another, and another.

Share this post


Link to post
Share on other sites