[Bf-committers] New Booleans & Smooth Meshes (maybe I need math help, maybe a shading glitch)

Ton Roosendaal ton at blender.org
Thu Dec 16 18:26:58 CET 2004


Hi Ted,

I've heard good stories of your work on booleans. :)
Coincidentally, I've just exchanged mails with the original coder of  
the booleans in Blender (Laurence) and he said your approach was  
promising, and since he still has no time for his work, we should  
better try to seduce you integrating it in Blender.

Don't ask me to review/test the code now (hope others will!), but just  
tell us if you were intended to (re)code it in C/C++ as library for in  
blender? A good generic booleans lib can be of use for many cool  
(realtime) modeling tools.

But of course I can help on the smoothing issue. The issue seems to be  
one of the following;
- vertices being double in the geometry, and/or faces of zero size
- the geometry is very 'uneven', so the vertex normals (that calculate  
form the faces) are distorted

But, instead of images, just send me some of the blend files with  
intersection error samples. I can check that for you!

-Ton-


On 16 Dec, 2004, at 10:21, Ted Schundler wrote:

> I've been working on improved booleans for Blender. There were some
> short comings in my initial approach, so it's still in its python
> script testing phase. (Anyone interested in testing it out can check
> out the thread on Elysiun)
>
> One problem that I had with the current booleans is with performing
> operations on smooth objects. It tends to have not very smooth shading
> of the subdivided faces.
>
> I initially thought this was due to the way it adds random extra
> verticies and edges of adjacent faces end up not actually being
> completely shared. So, bad interpolation for smooth faces makes sense.
> My boolean operations don't do that, but they still have problems with
> smooth objects. Here's an example (left image):
> http://astro.scu.edu/~ted/oss/blender/boolean/smoothboolproblem.jpg
>
> And for futher experiments, I built this test case:
> http://astro.scu.edu/~ted/oss/blender/boolean/sb_nh.jpg
> If you look at towards the middle bottom you can see the shading is
> not smooth along of the edges.
>
> So, my best guess is that somehow normals aren't getting computed
> correctly. I suspected this is because the new verticies are based on
> intersecting flat faces. So, I decided to calculate intersections
> based in implied smooth geometry, (more on this described below) and
> it made things worse:
> http://astro.scu.edu/~ted/oss/blender/boolean/sb_sh.jpg
>
> And now I don't really know what to do. Personally getting this to
> yield good results with smooth objects is important. Using the
> relatively new "Rotate Edge" function (useful little function,
> thanks), sometimes the effect can be improved, but not always.
> However, thinking about it more, the problem doesn't really make
> sense. Smooth shading is accomplished by interpolating vertex normals,
> right? So, shouldn't it be impossible to have discontinuity in shading
> along an edge? The vertex normals should be the same for both faces
> since it is smooth, so the only effect would be somewhat awkward
> shading, not the sharp contrast along edges in the images.
>
> So, I'm wondering if this is a bug in Blender's shading, or if anyone
> has other ideas for addressing this issue.
>
>
>
> ----------------------------------------------
> Notes:
> For the flat mesh boolean operations, the intersection points are
> calculated by testing intersections between edges and faces and a
> ray->plane intersection. There are also special tests for intersecting
> edges as it because necessary to deal with some special cases.
>
> For the smooth intersections, the same idea was used - intersecting
> edges with faces. However the edges are bezier curves, and the face is
> still a plane. In the test, a sphere is cut by a plane, so all the
> intersection points are along the sphere's edges and lie in the face
> of that one plane. There is no need (for this test) to actually
> calculate the smooth faces, just edges.
> The curves for the edges are cubic bezier curves. The length of the
> tangents is 1/3 the length of the edge (that values seemed to produce
> nice results). The direction of the tangents are determined by
> crossproducts with the vertex normal and direction of the edge to
> produce a vector in the right direction along the edge that is also
> perpendicular to the vertex normal. To test this, I had it generate a
> new mesh of only edges representing the smooth edges:
> http://astro.scu.edu/~ted/oss/blender/boolean/sb_wire_top_l.png
>
> The blue circle is a circle of radius 1 made of 98 verticies. The
> orange is a low resolution (7x7) UV sphere. Having an odd number of
> rings, there is no middle ring (so it doesn't touch the blue circle).
> And the pink is the new interpolated version. As you can see, is comes
> quite close to what the actual geometry should be. (thanks to luke for
> colored meshes)
>
> For finding the intersection, here's how the math works:
> There are three cubic equations genetated Fx(u),Fy(u),Fz(u).
> The plane can be defined as Ax+By+Cz+D=0.
> So the intersection is A*Fx(u)+B*Fy(u)+C*Fz(u)+D=0.
> The resulting cubic equation in terms of u is solved. The first
> rational solution found is used. For these tests the other 2 solutions
> don't matter.
>
>
>
>
> Ted
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list