Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

CSG result is broken #319

nico opened this Issue Mar 24, 2013 · 1 comment


None yet
2 participants

nico commented Mar 24, 2013

Consider this file:

module cells() {
  r = sqrt(3 / (1 + 2*sqrt(5)/5) - 1);
  for (j = [0, 180]) rotate([0, j, 0])
    for (i = [4:4]) rotate([0, 0, i * 360 / 5])
      for (k = [0, 1])
        rotate([0, -atan(r) - 2*k*atan(r*cos(180/3)), 0])
        rotate([0, 0, 180*k])
        rotate([0, 0, 30])
        difference() {
          translate([0, 0, 0.001]) cylinder(1, 0, r/sqrt(3)+0.01, $fn=6);
          translate([0, 0, 0.3]) cylinder(1, 0, r/sqrt(3), $fn=6);

difference() {
  sphere(1, center=true, $fn=20);

It looks right, but if I change 4:4 to 0:4 (or even just 3:4), the difference as the bottom is rendered as a union instead. The output pane contains"WARNING: Normalized tree is growing past 4000 elements. Aborting normalization." when this happens (there are 80 elements with the input above).

Is the input invalid somehow?


kintel commented Mar 25, 2013

It's possible to increase the max. number of allowed CSG elements in Preferences->Advanced->Turn off rendering at NNN elements. As the number of elements increase, rendering speed goes down (for F5 only).

To be able to render an OpenCSG preview (F5) of this object, it's necessary to "unpack" all the differences into separate operations. This is called CSG normalization and is described in the paper at http://www.cc.gatech.edu/~turk/my_papers/pxpl_csg.pdf.

I've been wanting to write up some guidelines to "demystify" this process to make it easier to understand when and why some types of models render slowly with OpenCSG. I need to find a way of explaining it in a intuitive way though.

@kintel kintel closed this Apr 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment