Mesh Generation
The mesh is generated from a graph describing the branches of a tree. This graph
is produced by the TreeDraw L-System Compiler. Generating the coarse control mesh
from the graph is a two step process:
1) construct the branch segments between joints
2) construct the joints that connect the branch segments
Creating the faces which constitute the joints is the most challenging aspect of
the design. The approach taken is to project the ends of the branches onto a sphere,
and then construct a 3D convex hull around them. Once the hull is completed, the
ends of the branches are restored to their original positions. The convex hull algorithm
that was implemented is the Randomized Incremental Algorithm first proposed by K.L.
Clarkson and P.W. Shor in 1989. The figure below illustrates the steps envolved
in joint construction.
Ttexture coordinates are assigened as the face are formed. The assignment is
such that a bark-like texture is tiled along the length of the length of each branch.
Unfortunately, zig-zagging textures seams are introduced at the across the joints.
Surface Subdivision
The mesh is now complete, however, it is a faceted and unnatural representation of
a tree. To achieve smoothness three iterations of Loop subdivision are applied to
the mesh. With each iteration the mesh better approximates a smooth surface. Loop
subdivision is designed to be applied to triangular faces, and was chosen because
the faces created by the convex hull are triangular. Every triangle is sudivided
into four smaller triangles by splitting the edges into two. The texture coordinate
of new vertex, which splits the edge, is simply the average of the texture coordinates
assigned to the endpoints of the edge. This introduces a slight distortion in the
texture mapping near the joints.