Ball-based approach for modeling, animating and skinning for aquatic creatures

advertisement
Ball-based approach for modeling, animating and skinning for
aquatic creatures
Sehoon Haa, Richard Shemakaa, Yunfei Baia, Sijie Zhangb, Scott McManusa, Jarek Rossignaca
a
Department of Computer Science, Georgia Institute of Technology, USA
Department of Civil Engineering, Georgia Institute of Technology, USA
b
Abstract
We present a key frame animation of a swimming pattern consisting of 3D skinning balls, which are
designed to preserve global and local volume. We designed a concise data structure of the 3D balls which
is able to add, insert and delete balls. It can also make and store pairs, triplets and quadruplets of touching
ball, which makes the pattern flexible enough for many applications. For modifying the model, we’ve
implemented a collision test and smoothing function to avoid overlap and irregularity of the pattern shape.
In order to make a user-friendly interface for producing animations, we built a new user interface to build
key frame animations. The animations themselves are accomplished using a system based on Degrees of
Freedom (DOF) and quaternions to produce smooth changes. Lastly, we propose an algorithm to produce
a volume-preserving watertight skin by sampling the balls and generating a mesh.
1. Introduction
Problem statement
We aim to create a model which is both mathematically and structurally simple to approximately
represent and animate aquatic creatures. Based on our hierarchical ball structure, we will implement
collision tests and smoothing functions to help produce effective models. For animation, our goal is to
produce realistic creature movement and provide a user-friendly interface. In addition, we will enable the
skinning by generating 3D triangle mesh and interest in preserve the volume of balls.
Motivation
Ocean on Earth encompasses about 300 times the habitable volume of the terrestrial habitats. This
massive catalog of marine creatures is rapidly growing, but only a very few number of them have been
studied. Unfortunately, modeling and animating complex aquatic creatures is not an easy task for novice
users due to the lack of tools. Thus, we want to present a novel ball-based structure which is not only a
useful tool for modeling and animation but also a powerful visual aid in engineering and virtual
prototyping as well. This technique can also be used to create the standard animation to bring life to
animated characters.
Limitations
The ball structure for models is inherently a constraint in our implementation. Producing smooth, flowing
limbs requires more work than blocky, solid models.
Our skinning routine is designed but not entirely implemented to date.
1
Overview
Our approach comprises the following steps:
1) Hierarchical structure: Instead of saving global coordinates, we saved the local rotation, including
vectors between touching balls, rotation axis and angle. Distance constraints are maintained strictly.
Based on this, we implemented the "Ball0--Ball1--Ball2--Ball3" classes, which store the balls with no
parent, single parent, two parents and three parents respectively for making pairs, triplets and quadruplets.
2) Collision test: By integrating the ball interface classes with the actual structure, we create a single
unified object hierarchy. The collision test works in two parts by detecting collisions and resolving them.
Instead of reapplying changes in reverse when a collision is detected, we simply store two models at
runtime and update a buffered model whenever a valid change is made. When a collision is detected, the
models are swapped such that the active model never contains collided geometry. Buffering is
accomplished using a deep copy.
3) Smoothing: We get the rotation angle for every ball and adjust their rotations simultaneously.
4) Animation: By creating key frame animation with GUI we enable authoring using both a GUI as well
as a drag-and-drop interface
5) Watertight skin: The skinned mesh is constructed using sampling around then model and “ball-rolling”
to generate a watertight 3D triangle mesh.
6) Volume-preserve: We try to apply the shrinking factor alpha to reduce the radius of each ball
proportionally and find the shrinking factor alpha with binary search.
Outline of the paper
In Section 2, we review prior art. In Section 3, we present the experimental setup used in our study. In
Section 4, we point out our solution of collision test, skinning, smoothing and volume-preserving
deformation. Section 5 describes how to use our program with the user interface. Section 6 presents our
implementations and gives the performance results on several models. Section 7 concludes the paper and
points out the limitations.
2. Prior Art
We have organized the prior art into four categories.
Collision detection: Bandi (2008) proposed an adaptive spatial subdivision of the object space based on
Oct-tree structure to rectify this problem, and also proved digitization method is a technique for
efficiently updating this structure periodically during the simulation. Moore and Wilhelms (1988)
discussed collision detection and response in general, presents two collision detection algorithms,
described modeling collisions of arbitrary bodies using springs, and presented an analytical collision
response algorithm for articulated rigid bodies that conserves linear and angular momentum.
3D ball skinning: Slabaugh et al. (2008, 2010) presented an approach to compute a smooth, interpolating
skin of an ordered set of 3D balls by construction C1 continuous constrained skin, and for each ball, it is
tangent to the ball along a circle of contact; derived differential equations to minimize the skin’s surface
area, mean curvature, or convex combination of both. Kunkli (2010) discussed skinning of an ordered set
of discrete by geometric construction of two G1 continuous curves touching each of the circles at a point,
separately. By precisely defining the admissible configuration of initial circles and the desired geometric
2
properties of the skin, future touching points and tangents of the skin can be defined by applying classical
geometric methods.
Smooth: Shashikanth et al. (2007) demonstrated that the system comprising a free rigid body of arbitrary
smooth shape interacting dynamically with N closed vortex filaments of arbitrary shape in an infinite
ideal fluid possesses a Hamiltonian structure, provided that the regularization of the system’s divergent
kinetic energy is undertaken in a particular way. Zefran et al. (1995) defined a algorithm depending on
velocity or its derivatives that measures smoothness of generating smooth trajectories between an initial
and a final position and orientation in space and finds a trajectory that minimizes this functional using the
notions of Riemannian metric and covariant derivative from differential geometry and formulate the
problem as a variational problem on the Lie group of spatial rigid body displacements.
Volume-preserving deformation: Based on the space deformation model called DOGME, Aubert and
Bechmann (1997) introduced a distinctive feature of DOGME to deform polyhedra with volume
preservation. Tong et al. (2002) presented a volume-preserving approach for animating liquid flows
modeled by metaballs. They adjusted volume of liquids to an original volume by tuning the influence
radius and maximum density of metaballs, thereby avoiding distortion of the animation effect.
Conclusion on prior art
Collision detection: Due to step size along driving axis being greater than unity. The concept of driving
axis to run the DDA and is done using integer arithmetic, but incurs an integer multiplication occasionally
when an increment along driving axis induces simultaneous increments along other two axes. Our
approach is simplified due to the nature of our model (sphere collision is trivial to detect). We
implemented clone method which is more flexible for the complex tree structure.
3D ball skinning: The construction of C1 continuous constrained skin can be nicely generated from an
ordered set of 3D balls, however, our ball structure including triplets and quadruplets is more complex.
And poor initialization will cause strong self-intersection, which we are trying to improve.
Smooth: Hamiltonian structure of models the fluid particle relabeling symmetry and the rigid body
rotational and translational symmetries will cause a reduced space. Our swimming pattern requires ‘fluids
+ rigid body’ structure and Hamiltonian structure though may work well, will be time-consuming in this
situation.
Volume-preserving deformation: The approach of Tong et al. simulated drops of water falling from a
horizontal plane, which is also comparatively simple structure than ours.
3. Experimental conditions
Instead of using Processing, we ported the code into Eclipse, which can help us with debugging and code
organizing.
4. Solutions
In general, the implementation of our project consists of four main parts: modeling, storing connectivity,
animating and skinning. Modeling parts are in charges of creating/editing/saving the hierarchical structure
3
of our ball-based model. This structure will be extended with more complex connectivity, i.e. triplets of
quadruplets. Key-frame animation is implemented for animating the constructed model. At last, the ballbased model is converted into smoothed water-tight mesh with a ball-rolling algorithm.
4.1 Hierarchical structure
Our ball-based model has a tree-based structure. (This structure will be extended into a directed graph for
triplets and quadruplets) Starting from a root, every ball has a parent (which is the supporting ball) and
children. Instead of saving global coordinates, we define a position of a child ball within a local frame of
a parent ball with two rotation variables (Euler angles, so the first rotation along Y axis affects the second
rotation along Z axis) Also, rotation of a parent ball will affect local axes of a child ball.
Here's more description.
A default position of a child ball = (parent.radius + this.radius)
The first rotation axis = parent.V(0, 1, 0)
The second rotation axis = rotate “parent.V(0, 0, 1)” with the first rotation
Distance constraints are maintained strictly by its definition, so we don't need any "snap" function.
Delete Ball: Added deleteChild(Ball b) method, which deleted the selected child. Then, append the rest
children to the parent of the select ball. If the selected ball has no child, then remove the selected ball.
Insert Ball: Added insertBall() method to insert a ball between the ball selected and the first child of the
selected ball's children, to lengthen a branch. addBall() can be used to add a ball as a new child of the
selected ball (to add branches).
Smooth: Get the rotation angle for every ball, and make them less bend. To be more specific, for all angle:
angle = 0.95 * angle.
Collision detection
Every three frames which cause the model to change, we run the following algorithm
-- build a structure containing all the balls in the branch under the selected node
-- compare that structure with every ball in the model
-- reject if the distance between the centers is less than the sum of the radii
The program has a buffered model which is updated every time this collision detection returns false. If a
collision was detected, the models are swapped such that the last valid model becomes active.
4.2 Storing Connectivity
To store triplets and quadruplets, we extended our tree structure to a direct graph. For instance, let’s
assume there’s a triplet with ball A, B and C. A will be a child of some ball. B also designates A as its
parent. Thus we can say that A and B has “one parent”, so we classify them as “Ball1”. On the other hand,
C has two parents A and B, so its location is restricted by both ball A and B. Thus, ball C become “Ball2”,
which is abbreviation of a ball with two parents. The following diagram shows how we represent a
quadruplet with a directed graph.
4
Figure 1. A directed graph of a quadruplet. Arrows represent a parent-child relation.
After our discussion, based on our original Tree Structure, we implemented the "Ball0--Ball1--Ball2-Ball3" classes. The numbers after ball means how many parents they have. They are inherited from Ball
class, which provides a rich set of functions for manipulating parents and children list.
Ball0: This class is a root node; its position calculation is straightforward.
Ball1: This class has one parent, and we use same formula as 4.1 to calculate its position and local fraems.
Ball2: This type of ball has two parents. Its position is defined with two parameters: θ and Φ. θ is fixed;
Φ enable B2 rotate around axis P0P1. Then, the third ball can rotate around its two parents (Figure 2).
Figure 2. The definition of the position of Ball2
Ball3: The position of ball3 is constrained by three parent balls. The position can be analytically
calculated, but it is a little bit hard to implement due to some singular cases. Thus, instead of
implementing exact solution, we applied an iterative solution to calculate its position.
The initial position is approximated set, and they are moved by adjusting forces defined by its parents. If
the current ball is too far from some parent, the parent pulls the target. On the contrary, if the ball is too
close, the parent ball pushes away the current ball. If error becomes less than a certain threshold (1.0 for
our case), we fix the ball position and save the local position. In our experiment, the average number of
iteration is around 23.
4.3 Animation
After brainstorm, we decided to use Degrees of freedom (DOF) to implement the animation. DOFs are the
set of independent displacements and/or rotation that specify completely the displaced or deformed
position and orientation of the body. Our current UI for DOF produces figure 3. We use quaternions
which provide a convenient mathematical notation of representing time-varying translation and rotation.
5
For instance, two member variables of “Ball1” class, theta1 and theta2, changed their type from float to
class “DOF”. The global translation variables in “Ball0” class are also changed into DOF class as well.
Figure 3. DOF can adjust parameters of translation or rotation.
DOF class needs to know how to interpolate the value between two key frames. We chose to implement a
linear interpolation since it’s easy to implement but powerful enough to prove our concept. Thus, our
future work would be implementing better spline-based interpolation, such as Catmull-Rom spline. The
formula for linear interpolation is following:
Let’s assume we have two key frames (t0, v0) and (t1, v1) and want to get v at time t (t0 < t < t1).
Then v = (v0 * (t1- t) + v1 * (t – t0)) / (t1 – t0)
4.4 Skinning
Our algorithm for generating water-tight mesh (skinning) is based on sampling-based approach. Instead of
calculating exact solution for the given ball-based model, we draw a lot of samples around the ball and
use ball-rolling algorithm for calculate connectivity between samples. Thus, our algorithm comprises
sampling, ball rolling and volume adjusting.
Sampling: Our algorithm samples around the balls and a bottom of a cone defined with two adjacent balls.
Those samples are uniformly sampled. To remove the degenerate cases such as two samples are really
closed to each other, we invent two algorithms. The first one is repelling forces between samples, and the
second one is redrawing if the nearest neighbor is too close to an existing sample. Both algorithms do not
guarantee an absence of degenerate cases, but they produce a better set of samples in practice. The
following diagram shows a sample with a simple example.
Figure 4. The sampling along two adjacent balls
Ball Rolling: We use the “ball rolling” algorithm. It starts from finding the initial triangle that is
contained in a water-tight mesh. We find the initial triangle by pick some extreme point first (we use the
point with maximum z coordinate) and use BSP to ensure its validity. After finding initial triangle, we
start to roll over the edge. Conceptually, we start to “roll” a fixed-radius ball over the edge, and stopped at
the first point (sample) it reaches. Mathematically, the algorithm culls every sample that cannot fit a ball
6
between them, and finds a sample with a minimum rotation angle. It is important to note that our
algorithm is a deterministic approximation of ball rolling and does not literally roll a ball to produce its
results.
Volume Adjusting: Matching a volume of water-tight mesh is solved as following: We introduce the
shrinking factor alpha, which is how we will reduce the radius of every single ball (r’ = alpha * r). When
we shrink balls, their global positions will be maintained. Since the desired volume (sum of volumes of
all balls) is bigger when alpha is zero and less when alpha is one, we determine the shrinking factor alpha
with a binary search.
5. User interface
Here we describe how to use our program.
1) Delete Ball – keyPressed && key=='d';
2) Add Ball – keyPressed && key=='a';
3) Insert Ball – keyPressed && key=='i';
4) Smooth – key=='[' / un-smooth – key==']';
5) Make triplet – click one ball and press ' t ', then the selected ball + its parent + its grandparent become a
triplet;
6) Make quadruplet – click one ball and press ' q ', then the selected ball + its parent + its grandparent +
its parent's grandparents become a quadruplet;
7) Create animation:
a. Adjust time from Swing GUI
b. Change the pose in the processing screen: translating, changing radius, rotation are supported. Chis
will create a key frame at the current time
c. Repeat 1 and 2 to generate the desired animation
d. Reset the time and play
Figure 5. User interface for animation
6. Results
Here we present the result of our approaches by screenshot of animation frames for various swimming
patterns.
Figure 6: we can animate bending as in real time.
Figure 7: create swimming animation of octopus.
7
Figure 8: make triplet and quadruplet; make rotating and smoothing.
Figure 9: translate and change the size of balls.
Figure 6. Bend
Figure 7. Octopus
Figure 8. Triplet and quadruplet
Figure 9. Ball with various size
7. Conclusions
We have presented a new ball-based approach for modeling, animating and skinning for aquatic creatures.
We conclude that our concise data structure, collision detection, smoothing, skinning, ball rolling and
volume-preserve algorithm and method can work well for modeling, animating and skinning of
deformable aquatic creatures. We believe that this new approach may be useful for representation of
many real world objects such as aquatic creatures, flora and humans. We envision extending it to be able
to use infinite set of tiny balls to animate most things in real life.
8
Reference
Bandi, S. and Thalmann, D. , An Adaptive Spatial Subdivision of the Object Space for Fast Collision
Detection of Animated Rigid Bodies. Computer Graphics Forum, 14, 1995: 259–270.
Matthew Moore and Jane Wilhelms. 1988. Collision Detection and Response for Computer Animation.
SIGGRAPH Comput. Graph. 22, 4, 1988: 289-298.
Slabaugh, G., Rossignac, J., Whited, B., Fang, T., Unal, G., 2009. 3D Ball Skinning using PDEs for
Generation of Smooth Tubular Surfaces. Computer-Aided Design, 2010.
R. Kunkli, M. Hoffmann, Skinning of circles and spheres, Computer Aided Geometric Design, Volume
27, Issue 8, Advances in Applied Geometry, 2010.
B. N. Shashikanth, A. Sheshmani, S. D. Kelly and M. J. Wei, Hamiltonian Structure and Dynamics of a
Neutrally Buoyant Rigid Sphere Interacting with Thin Vortex Rings, Journal of Mathematical Fluid
Mechanics, 2008.
M. Zefran, V. Kumar, and C. Croke, “On the generation of smooth three-dimensional rigid body motion:’
IEEE Trans. Robotics and Auto., vol. 14, no. 4, 1998: 576-589.
Fabrice Aubert, Dominique Bechmann, Volume-preserving space deformation, Computers & Graphics,
Volume 21, Issue 5, 1997: 625-639.
Tong, R., Kaneda, K., and Yamashita, H. A volume preserving approach for modeling and animating
water flows generated by metaballs. The Visual Computer 18, 8, 2002: 469–480.
9
Download