'Nonsolid' and messed up geometry after boolean operation

I know that a topic about boolean pops up every now and then, but i didn’t find one concerning messed up geometry as i experienced lately.

So here is what i try to do:
I need to do some boolean operations with a big sphere and some cylinders (~10-20 cylinders with a different material) that get subtracted from the sphere on it’s surface. if i would do all this by hand i think it would take ages and wouldn’t be as accurate :-/

So i tried to use the boolean tools in blender to do the geometry thing for me. But after performing the subtraction i get a lot of holes in the mesh around the ‘touching’ edges and some faces are even generated where they do not belong at all (i.e standing away from the final objet into nothingness). Not to speak if some faces reaching into the othere materials space (the result is a sort of zigzag line of color)

I hope i did explain my problem good enough. I suspect the algorithm that blender uses for booleans is currently not the best implemention ever. Especially after i’ve read about the BooleanDevelopment project, which is kinda old, but displays similar problems with the current algo.

It woudl be cool if anybody could point me to a way of making ‘solid’ boolean operations somehow in blender.

Thanks for any tips,
Werner

In my experience booleans (even if I used them a LOT in 3DS and PovRay) in Blender are completely usless, for 2 reasons, first the most of the time is buggy and you wont get what you expect, second because it will create so many triangles that you will have several problems during the renders, maybe you will save time modelling but then you will get crazy fixing here and there all the mess (at least that is what happened to me). I suggest you to use some other modeler, like Wings 3D for example, and export to Blender, or try to model it thinking at some trick or workaround to make it faster.

If you post the picture here of what you want maybe someone can give a suggestion on modeling.

That can be often solved by increasing hte resolution of the models before the boolean operation&render. No matter of how messy the triangles make the mesh; high resolution meshes often compensates for that.

I could live with a triangle mess, but the current functions destroy the mesh my opening holes in it and doing other bad stuff as described above.

Concerning the useless boolean: I figured so much (see my original post), but what i need is a workaround for boolean operations. Preferable in Blender, since i’m working an several different platforms and alot of nice tools are onyl available for so much of them … not to speak of the additional installation mess :-/

, maybe you will save time modelling but then you will get crazy fixing here and there all the mess (at least that is what happened to me). I suggest you to use some other modeler, like Wings 3D for example
I do not want to sound harsh, but this suggestion doesn’t help me at all :wink:
Leaving the fact aside that i recently changed from wings3D to Blender exactly because of support for boolean (but not only, a lot of other feature have played a role here as well) … how exactly does this help me (or anybody else having similar problems) to do correct booleans?
… on the other side i didn’t follow Wings3D development in the past month. Maybe they have added boolean since then?

, and export to Blender, or try to model it thinking at some trick or workaround to make it faster.

If you post the picture here of what you want maybe someone can give a suggestion on modeling.

I do not want to model the whole thing out of one thing, i know how to do that, but i really do not want to do it.

If the boolean tools in blender do not let me do clean boolean operations i’m searching for other tools (or blender-scripts) that do.

Thanks for your answer anyway. Now i know i’m not the only one having problems with the boolean tools in Blender :wink:
Werner

EDIT: BTW, shouldn’t the planet in your avatar image be more brown-ish? I mean “Arrakis” doesn’t really fit a glowing blue star, no? :wink:

That’s the problem, I could live too with some imperfections on the model, but not completely falling apart or wrong.

I was told by different Blender experts to work and think like Blender has no boolean feature

Concerning the useless boolean: I figured so much (see my original post), but what i need is a workaround for boolean operations.

Personally I don’t know any workaround or script for working booleans on blender.

I do not want to model the whole thing out of one thing, i know how to do that, but i really do not want to do it.

That’s a problem :wink:

Thanks for your answer anyway. Now i know i’m not the only one having problems with the boolean tools in Blender :wink:

I just wanted to report my experience with it and say that will be a sort of miracle if in Blender will be possible to cut away 20 cylinders from a sphere using booleans and having a nice result. I used PovRay quite a lot and booleans are the most used modelling method in that program, they are really great, sharp and clean, but it is PovRay with it’s good sides and limitations. Blender too has it’s good sides and limitations, and booleans (and everything concerning) are to be forgotten until they will develope a new version. BTW just my opinion I am not an expert user.

EDIT: BTW, shouldn’t the planet in your avatar image be more brown-ish? I mean “Arrakis” doesn’t really fit a glowing blue star, no? :wink:

But you don’t remember that there is a lot of hidden water that flooded the entire planet :wink:

Post some images of what your modeling so
we can figure out a solution.

Hmm, i should really start reading the books :slight_smile: I remember from the various films+games+some summaries that they collected the water, but i doubt that it was enough to flood the whole planet (i mean it needs to come from somewhere)… anyway, if this happend in the books, i’m gonna find out sometime in the future :wink:

It still kinda looks like a glowing blue star (not a planet) in the current size though :wink:

I’ll do that when my current render is finished and i can actually work agian under blender.

But as i already said. I can solve the problem i have without using blooleans at all, but it involves a lot of work :-/ EDIT: not to speak of the problems one might have with editing this shape later … it’s possible, but more work again.

Werner

Ok, i’ve created a few screenshots of the problem i had with booleans (Blender 2.41). It’s the basic shape of my mesh and a crude arrangement of the future cylindrical ‘holes’ … and the result of the boolean opepration.


http://www.flickr.com/photos/63231715@N00/162298769/

The holes (and the ‘bad’ geometry) in the mesh are clearly visible … but not always. Sometimes they are really tiny and you need to search through them all.

Of course, i expect somebody to say something like:“You can make the whole sphere including the hole into one subsurfed mesh”, but that doesn’t help with the original problem at all. :frowning:

Werner

On a related sidenote: I needed several attemps, because the operation crashed on me a few times

I cannot help you. I instead want to ask you if we can use that image as the official poster child of the “Don’t Boolean Around! It’s Dangerous!” campaign.

Blender is not a CSG modeller, it is a subsurface modeller. You treat it as a CSG, and you’ll just be hitting Ctrl-X a lot. If you must do stuff like that, subsurf the you-know-what out of the mesh before you start doing such damage. At least then it might be passable and only require 500 tweaks instead of… that.

Yea, I bet it does segfault alot. :slight_smile: Ugh.

Yes, but only until a better boolean function is included in blender :wink:

If it’s broken, why is it there at all? To give false hope?

And Nurbs, Surfaces and Meta-objects are also subsurface-objects? That’s news to me :wink:

Blender is not a CSG [1]. Ok, that’s true, but that doesn’t exclude working bloolean functions for solid meshes.

The megabool script that is linked in the wiki-page does already come near a perfect boolean tool … but it is outdated and not really useable in current blender.

No i’m not, because i’m not using ht boolean function in a productive way yet :slight_smile:

I know, but that doesn’t work if faulty geometry is generated independent of the density of the source-meshes :frowning:

Werner

[1] EDIT: At least not in the common sense … read the wikipedia entry for CSG Quote:“In some cases, constructive solid geometry is performed on polygonal meshes, and may or may not be procedural and/or parametric.” … but that’s nitpicking i guess :wink:

Believe me, I’ve got ~15 years of love for Autodesk’s products making (to varying degrees) functional, clean objects from my ludicrous Booleans, and my brain thinks that way about modelling forever and always. (how do you model a bottle cap? Make a cylinder. Squish it. Make a cube with 2 rounded sides, like a “D” extruded, and copy it 20 times around the cylinder and subtract them from the cylinder.)

Now, Blender… I’ve come to love many things about it but I have given up trying to Boolean unless it’s a very simple function, it never works well otherwise. Which is why we have so much trouble using it for architectural uses and other engineering-type modelling.

Lucky for both of us, we’re not alone. People with programming skills and enough frustration to fuel them are coding themselves crazy… Still, you have to be more flexible in your thinking and modelling for Blendering. There’s always another way to do it better. And once you start “gettting” Blender’s way of doing things, you’ll find hybrid solutions.

But for now - there is NO WAY you’re ever going to get that to work right unless you model it right. Boolean will not save you. :smiley:

Your’re telling me? I’m a AutoCAD user [1] myself (mechanical engineer) and i know quite well how it works out.
That doesn’t mean i do not know how to model sufsurfed models. I’m doing that roughly the same amount of time as the ‘perfect’ objects.
And as you mentioned later in your post: Simple object do work (even withoput destroying the mesh woot :D) and i used them before.

But that’s not exactly the point why i’ve started the thread. My point (or better my conclusion from the answers i got so far) was/is that the current boolean functions do not work as expected, but rather destroy the mesh in a lot of cases. That I can have easier without firing up blender or posting here at all :wink:.

> Now, Blender... I've come to love many things about it but I have given up trying to Boolean unless it's a very simple function, it never works well otherwise. Which is why we have so much trouble using it for architectural uses and other engineering-type modelling. I don't even want accuracy, there are better programs for that type of modeling, but if i have a function in a stable program (which i think blender is) I expect that it does not destroy my work .... I better stop this sentence here, before i start sounding even more like a flamer ;), I love Blender.

Lucky for both of us, we’re not alone. People with programming skills and enough frustration to fuel them are coding themselves crazy…
What would we do without the Blender-programmers :slight_smile:
Is there already a statue of one of them somewhere? I’ve found the impressive Ton Roosendaal action-figure, but a statue would be even cooler :smiley:

Still, you have to be more flexible in your thinking and modelling for Blendering. There’s always another way to do it better. And once you start “gettting” Blender’s way of doing things, you’ll find hybrid solutions.
See above, i know how i can do this with subsurfed meshes, but it really is not the better way in this case. e.g If i want to later change the size, rotation or even shape of the modelled grooves/holes i need to either edit every one of them (the number i used in the example above is reduced quite a bit) or remove them all and model them new … that’s not intuitiv or fast at all … um, just stating the facts here, nothing more.

But for now - there is NO WAY you’re ever going to get that to work right unless you model it right. Boolean will not save you. :smiley:

Yeah, sad for us :frowning: But I’m positive that some time in the future we’ll all look back at this thread and laugh at our postings :smiley:

Just to make this thread complete … here’s a link to the current code from the wiki-page i mentioned above: http://projects.blender.org/viewcvs/viewcvs.cgi/blender/intern/boolop/?cvsroot=bf-blender
It’s in the blender soruce-tree, but i do not know if it has been integrated for the next version already (i doubt it since the last changes are from the end of 2005)

So long,
Werner

[1] The fact aside that i really dislike most of the AutoDesk-products after working with them for a long time now :frowning:

I don’t know if this is what you want, but I found it quite easy to start with icosphere, then extrude and scale a hole in it. Then subsurf modifier with 2 iterations:

http://koti.mbnet.fi/paulkp/temp/icosphere.jpg

@krice: Yes, i know that, as i stated a few times already :smiley: And as it looks right now this will be the way i’m doing my holes. But the boolean functions remain broken no matter what workaround one uses :-/

But thanks for the cool illustration anyway, i think it may be of help for others stumbling over this thread.

Werner

Reminder to self: Next time i’ll use a much more complex example instead of one thatuses only primitives and can easily be re-made using sub-surfed meshes. … maybe a 3D-string that gets punshed out of a mesh a hundred times or something like that. :wink:

In the following example, if you want to use booleans instead of modelling it’s also easier with icosphere, because it has an even structure. You can “help” boolean operations by carefully planning the source and destination objects. One thing which helps is avoid having close or intersecting edges. Instead make them cut from the middle or other part of the polygon. I have marked the image with three red arrows to see what I mean:

http://koti.mbnet.fi/paulkp/temp/booleancut.jpg

Hm, that’s a pretty good idea, i need to test that on my mesh soon.

But not today, i’m kinda busy now :slight_smile:

Werner

There are three ways to get things done:

  1. do it yourself
  2. hire someone to do it
  3. forbid your kids to do it

I opted for 1) and finally got the megabool script to work for me.

If anybody is interested, here’s the diff to the megabool_r12.py version (unfortunately the enire script is to long to post, but i’ll gladly send it via email if needed.

OUT-DATED


4,5c4,5
< Name: 'MegaBool r12'
< Blender: 234
---
> Name: 'MegaBool r12 (hoehrer_mod v1)'
> Blender: 241
91c91
< __version__ = "r12 02-May-05"
---
> __version__ = "r12 hoehrermod v1 2006-06-08"
431c431,432
<             vsum=(dA+dB)/2
---
>             vec_temp = dA+dB
>             vsum = Vector(vec_temp[0]/2, vec_temp[1]/2, vec_temp[2]/2)
1204c1205,1206
<                 self.normal=VecMultMat(Vector(list(nmFace.no)+[1]),parent.norm)
---
>                 #self.normal=VecMultMat(Vector(list(nmFace.no)+[1]),parent.norm)
>                 self.normal = Vector(list(nmFace.no)+[1]) * parent.norm
1217c1219,1221
<             self.center/=len(self.v)
---
>             #self.center/=len(self.v)
>             #self.center = [self.center[0]/len(self.v), self.center[1]/len(self.v), self.center[2]/len(self.v)]
>             self.center = Vector(self.center[0]/len(self.v), self.center[1]/len(self.v), self.center[2]/len(self.v))
1403c1407,1408
<             self.norm=CopyMat(matrix)
---
>             #self.norm=CopyMat(matrix)
>             self.norm=Matrix(matrix)
1407c1412,1413
<                 self.verts.append(bVert(VecMultMat(Vector(list(v.co)+[1]),matrix),VecMultMat(Vector(list(v.no)+[1]),self.norm)))
---
>                 #self.verts.append(bVert(VecMultMat(Vector(list(v.co)+[1]),matrix),VecMultMat(Vector(list(v.no)+[1]),self.norm)))
>                 self.verts.append(bVert(Vector(list(v.co)+[1]) * matrix,Vector(list(v.no)+[1]) * self.norm))
1926,1928c1932,1935
<         cookie.select(0)
<         cutter.select(0)
<         newobj.select(1)
---
>         newobj.Layer = cookie.Layer
>         cookie.select(1)
>         cutter.select(1)
>         newobj.select(0)
1963,1965c1970,1973
<         cookie.select(0)
<         cutter.select(0)
<         newobj.select(1)
---
>         newobj.Layer = cookie.Layer       
>         cookie.select(1)
>         cutter.select(1)
>         newobj.select(0)
2001,2003c2009,2012
<         cookie.select(0)
<         cutter.select(0)
<         newobj.select(1)
---
>         newobj.Layer = cookie.Layer       
>         cookie.select(1)
>         cutter.select(1)
>         newobj.select(0)
2039,2041c2048,2051
<         cookie.select(0)
<         cutter.select(0)
<         newobj.select(1)
---
>         newobj.Layer = cookie.Layer       
>         cookie.select(1)
>         cutter.select(1)
>         newobj.select(0)

EDIT: The only drawback i’ve seen so far is that materials are not preserved :-/

Werner

two things:

  1. you changed the formatting, anyone patching _r12 with this should use -l

  2. after patching, it doesn’t work.


  File "megabool_r12.py", line 431
    vec_temp = dA+dB
                   ^
IndentationError: unindent does not match any outer indentation level

BTW, could you toss up a screenie of the same meshes but with the megabool version for a quick yes/no for new thread readers?

Ok, here’s the modified megabool script used on two different spheres (the right one is subsurfed 1 time before boolean operation):


Imgur

I’ll try to find a decent upload space for the entire script soon.
EDIT: Finally found a stop to put the whole script. This is the version that works for me and that i used for the examples above:
megabool_r12_hoehrermod_v1.zip

The most recent diff-code (to megabool_r12.py) is here … in “unified” format:


--- D:\backup\__etc\__blender_div\megabool\megabool_r12.py    Fri Jun 09 08:32:28 2006
+++ D:\backup\__etc\__blender_div\megabool\megabool_r12_hoehrermod_v1.py    Fri Jun 09 09:23:15 2006
@@ -1,8 +1,8 @@
 #!BPY
 
 """
-Name: 'MegaBool r12'
-Blender: 234
+Name: 'MegaBool r12 (hoehrer_mod v1)'
+Blender: 241
 Group: 'Object'
 Tooltip: 'Perform boolean operations on meshes and get nice results.'
 """
@@ -88,7 +88,7 @@
 """
 
 __author__ = "Theodore K. Schundler"
-__version__ = "r12 02-May-05"
+__version__ = "r12 hoehrermod v1 2006-06-08"
 __email__ = ('Author EMail, tschundler:scu*edu')
 __url__ = ('elysiun','Script Web Page, http://astro.scu.edu/~ted/oss/blender/boolean/')
 
@@ -99,6 +99,10 @@
 from Blender import Mathutils
 from Blender.Mathutils import *
 import time
+
+# added/changed by hoehrer
+import sys
+sys.setrecursionlimit(int( 10 * sys.getrecursionlimit() ))
 
 traversalCookie=0
 messages=""
@@ -427,8 +431,13 @@
                 MergeVert(vB,vC)
             #is there a way to do this w/o normalization?
             dA.normalize()
-            dB.normalize()
-            vsum=(dA+dB)/2
+            dB.normalize()
+            
+            # added/changed by hoehrer
+            #vsum=(dA+dB)/2
+            vec_temp = dA+dB
+            vsum = Vector(vec_temp[0]/2, vec_temp[1]/2, vec_temp[2]/2)
+            
             ang=DotVecs(dA,dB)
             if ang>0.9999: #this is a test for parallel edges -- see stuff in FindIntersectLineLine3D to avoid sqrt
                 print "ML(): BUG? Edges folded over..."
@@ -1200,8 +1209,11 @@
         if virtual:
             self.normal=0
         else:
-            if parent.matrix:
-                self.normal=VecMultMat(Vector(list(nmFace.no)+[1]),parent.norm)
+            if parent.matrix:
+                # added/changed by hoehrer
+                #self.normal=VecMultMat(Vector(list(nmFace.no)+[1]),parent.norm)
+                self.normal = Vector(list(nmFace.no)+[1]) * parent.norm
+                
                 self.normal.resize3D()
             else:
                 self.normal=Vector(nmFace.no)
@@ -1213,9 +1225,13 @@
                 bv.f.append(self) #maybe not needed...
                 self.v.append(bv)
                 self.allVerts.append(bv)
-                self.center+=bv.tco
-            self.center/=len(self.v)
-            
+                self.center+=bv.tco
+
+            # added/changed by hoehrer
+            #self.center/=len(self.v)
+            #self.center = [self.center[0]/len(self.v), self.center[1]/len(self.v), self.center[2]/len(self.v)]
+            self.center = Vector(self.center[0]/len(self.v), self.center[1]/len(self.v), self.center[2]/len(self.v))
+
             self.bb=BuildBounds(self.v[0].tco,self.v[1].tco)
             self.bb=ExpandBounds(self.bb,self.v[2].tco)
             
@@ -1399,12 +1415,18 @@
         self.matrix=matrix
         if (matrix):
             rotmatrix=matrix.rotationPart()
-            self.rot=rotmatrix
-            self.norm=CopyMat(matrix)
+            self.rot=rotmatrix
+            
+            # added/changed by hoehrer
+            #self.norm=CopyMat(matrix)
+            self.norm=Matrix(matrix)
+
             self.norm.invert()
             self.norm.transpose()
-            for v in m.verts:
-                self.verts.append(bVert(VecMultMat(Vector(list(v.co)+[1]),matrix),VecMultMat(Vector(list(v.no)+[1]),self.norm)))
+            for v in m.verts:
+                # added/changed by hoehrer
+                #self.verts.append(bVert(VecMultMat(Vector(list(v.co)+[1]),matrix),VecMultMat(Vector(list(v.no)+[1]),self.norm)))
+                self.verts.append(bVert(Vector(list(v.co)+[1]) * matrix,Vector(list(v.no)+[1]) * self.norm))
         else:
             for v in m.verts:
                 self.verts.append(bVert(Vector(list(v.co)),Vector(list(v.no))))

If there is another “IndentationError” (this seems to be due to the forum that messes up the coding somehow) make sure the displayed line matches the Indentation (TABs) of the previous/next line … this depends on the context, see the patch-text for an example.

And another link to the MegaBool forum thread: Booleans in Blender that work (and now without patching!)

Werner

I surrender. :frowning: I’ll patch it manually. But just so you know… If I turn on loose whitespace, then it completes, but then I get the screwed-up whitespace. (any computer language that relies on whitespace and column position… grr.) If I don’t then


patching file megabool_r12.py
Hunk #4 FAILED at 431.
Hunk #5 FAILED at 1209.
Hunk #6 FAILED at 1225.
Hunk #7 FAILED at 1415.
4 out of 7 hunks FAILED -- saving rejects to file megabool_r12.py.rej

Only the first 3 chunks merge, and get progressively off from insertion point. Hunk #7 is off by like 12 lines! You either have to stop entering all those newlines for formatting so you can read, or you need to put more context lines in the diff. (or just put the whole script up on freefiles or any place.)


edit: ah, great. you host it just as I finish manually fixing it. :smiley: Thanks though!

Try megabool_r12_hoehrermod_v1.zip (i’ve edited the post above as well)

EDIT: And just for the record, i hate the py-language for it’s whitespace handling as well :frowning:

Werner