Menu

#2 Missing and/or misplaced triangles

1.0
open
None
2016-02-02
2015-08-12
WCOmohundro
No

The 10/08/2015 build of CSG has a fundamental problem with some corrupted triangles after blending shapes. For certain blends, an expected triangle in the final shape will be missing, or will be seemingly misshaped. I have found no pattern of when the problem occurs, although it is more likely with base shapes composed of a large number of polygons.

In particular, I have seen it happen when blending with the jme3 standard test "teapot" mesh, and when combining a cube with a helictical pipe.

I have been chasing this problem for some time now with no real solution. I am posting this ticket so that anyone using the 10/08/2015 build will not be confused if they see some odd visual artifacts.

I have been tracing after possible over/underflow problems and floating-point rounding problems. The base algorithm seems to be correct as simple shapes blend quite nicely. But there must be some conditions with a large number of smaller triangles that throws the processing off.

I am NOT a 3D graphics expert, just an old java hand trying to make the CSG work. If anyone out there understands the problems of BSP (Binary Space Partitioning) processing and the CSG boolean math, and can point me in the right direction --- well, all help is most appreciated.

Discussion

  • WCOmohundro

    WCOmohundro - 2015-08-14

    While nibbling away at this problem, I have introduced CSGEnvironment, where the various epsilon tolerances and depth limits are now set. In this way, I can alter the processing on a per-shape basis. For example, I have found that the union of a unit (1,1,1) cube with a 1.2 sphere works just fine so long as the sample values are kept rather low. But bump the sphere samples up to 64, and the BSP process hits its recursive depth limit. You can use CSGEnvironment to define a custom depth that allows the process to complete, which gives you a nice looking bumpy cube.

     
  • WCOmohundro

    WCOmohundro - 2015-08-21

    I have been attacking this problem in several ways, with some better results but nothing definitive about when a shape will be generated properly or not. Further web search found this paper:
    [https://www.andrew.cmu.edu/user/jackiey/resources/CSG/CSG_report.pdf]
    in which the authors discuss BSP and CSG. In particular, there was this:

    the Boolean operation would yield results with minor geometry artifacts. The artifacts that appear in some of our results appear to manifest themselves when operations are performed on objects with low
    polygon count. We believe that this occurs due to the lower resolution of one model relative to the other, and thus when the BSP trees of both models are merged, we occasionally are left with extraneous triangles that must get pushed through the BSP tree more than once but end up getting catalogued incorrectly.

    So it would appear that mine is not the only code that has this problem. Unfortunately, there is nothing more definitive about exactly what is going wrong that produces the 'artifacts'

     

    Last edit: WCOmohundro 2015-08-21
  • WCOmohundro

    WCOmohundro - 2015-10-22

    I have found more references on the web concerning 'artifacts' as an inherent problem of the BSP approach to CSG.
    I have found and implemented a different processing approach, which does not seem to have any of the BSP artifact problems. It uses an Inside/Outside/Boundary classification system on the faces of two solids. I have produced quite complex shapes with very high triangle counts with no defects in the resulting surface.
    The BSP option remains, but by default, you will get the new IOB processor.

     
  • WCOmohundro

    WCOmohundro - 2015-10-31

    I did stumble across an infinite iteration with the IOB processor with a sample blend that produced splits resulting in very, very, very small triangles. I included a code update to handle some boundary conditions, and tweaked the 'tolerances' to eliminate such small faces. My samples are now working.

    You need at least the 30Oct2015 build to get these changes.

     
  • WCOmohundro

    WCOmohundro - 2016-02-02

    The 01Feb2016 build contains significant bug fixes for both missing/bogus triangles and infinite split problems. If you have experienced any rendering issues with CSG, please download and retest with this library.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.