[Soc-2010-dev] Sculpt Status - Week 2
jason.a.wilkins at gmail.com
Sat Jun 5 05:13:51 CEST 2010
* Optimized the code that finds where in the mesh to sculpt. This code used
ray-casting to find bounding boxes, and then tested every triangle in the
nodes where it hit.
The first problem was that it worked bottom up in the bounding box
hierarchy, meaning it tested all leaf nodes even if the ray completely
missed the model. This isn't a big deal since models in the worse case may
have thousands, not millions of leaf nodes. But I arranged for the code to
work top down anyway because it simplified the code is required for the next
optimization which was to sort any intersected boxes by distance and then do
testing from closest to furthest. The result of this is that usually only
one node has all of its triangles tested. This reduced the percentage of
time spent testing triangles by more than half.
* This needed to be optimized because with future changes, like drawing the
brush on the model and the "Lock Brush Size" feature I added this week, ray
casting will happen every time the mouse moves instead of just when its
* The clay brush now has two controls that effect its shape, a strength and
an offset. This brings it in line with how it works in zbrush.
* Integrated "Unlimited Clay" so that people trying the sculpt branch can
play with it as well. I do not intend to do much with it except making sure
* I disabled the "texcache" because it re-implements a lot of features
already present in Blender's texture mapping facilities and it is too low
resolution for certain tasks (in fact, some textures are infinitely large).
The plan is to find better ways to improve texturing performance without
I also spent a lot of time working on problems that resulted not so much in
code and features but in a better understanding of how Blender works. This
consisted to two major areas, programming the UI and symmetric sculpting.
All I have to say about UI programming is that I dread any time I want to do
something new with it...
To be honest this has been one of those weeks where I feel like I'm banging
my head against a wall. With each blow I expect the problem to finally give
way but all I end up with is a headache.
The good news is that I better understand the nature of the wall...
I'm referring to sculpting with symmetry turned on and what happens when two
instances of the brush act on the same area. I tried several solutions and
none of them were satisfactory. The original behavior of the brush was
preferable in all cases.
What I tried, so that if I do not return to and solve this problem somebody
has a record of what didn't work:
Solution: Setting any component of a vertex that moves past the line of
symmetry to zero.
Failed: Vertex does not end up where it would if you clipped its
displacement vector against the plane.
I didn't try to do this because of the other problem, lots of points bunch
up on the clipping plane
Solution: Do not even touch the vertexes on the other side of the line of
Failed:Brushes work by repeatedly applying an operation to the vertexes in a
spherical region. A freehand stroke is made by evenly spacing a series of
such operations so that they look continuous. At the line of symmetry the
spacing is uneven, resulting in a dip, and eventually a seam appears on the
line of symmetry.
Solution: Reduce the effect of the brush on vertexes close to the line of
Failed: I had a buggy implementation, but decided to move on to a different
idea, I still need to try this one though.
Solution: Test each vertex to see if more than one brush will effect it,
reduce the effect of the brush on it.
Failed: If 3 brushes effect and area each is reduced by 1/3, and next to it
is an area where things are reduced 1/2 and 1/4. This creates a
I attempted to come up with a continuous solution,and some had deceptively
Ultimately I believe I can't put a band-aid on this one. Symmetry will have
to become an integral part the data structures and algorithm instead of the
current solution of applying each symmetry daub one after another.
Next week I'm going to tackle easier tasks in an effort to raise my moral :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Soc-2010-dev