Wednesday, 5 August 2015

Morphing in Computer Graphics

Transformation of object shapes from one form to another morphing
Morphing methods can be applied to any motion or transition involving a change in shape
Given two key frames for an object transformation. Adjust the object specification in one of the frame so that the number of polygon edge is the same for the two frames.

This pre-processing step is illustrated in below figure.

A straight –line segment in key frame K is transformed into two line segments in key frame K+1.

As key frame K+1 has an extra vertex, add a vertex between vertices 1 and 2 in key frame K to balance the number of vertices in the two key frames.

Use linear interpolation to generate the in-betweens, transits the added vertex in the key frame K into   vertex 3 along the straight line as shown in the below figure.
The triangle linearly expanding into quadrilateral


Suppose to equalize the edge count, and parameters Lk and LK+1  denote the number of line segments in two consecutive frames. 

Then define

LMAX = max (Lk, LK+1)

LMIN = min (Lk, LK+1)

The preprocessing is accomplished by 

1. Dividing  Ne edge of key frame min into Ns+1  sections
2. Dividing the remaining lines of key framemin into  Ns sections

Example

 If  Lk = 15 and LK+1 = 11

Divide 4 lines of keyframek+1 into 2 sections each. The remaining lines of are left intact.

If vertex count is equalized, use parameters VK and VK+1 to denote the number of vertices in the two consecutive frames.

Here

Vmax = max (VK , VK+1)       Vmin = min (VK , VK+1)  
And     Nls = (Vmax – 1) mod (Vmin -1)
            Np = int (Vmax – 1)/ (Vmin -1)

Preprocessing using vertex count is performed by 

1. Adding  Np  points to Nls  line sections of keyframemin
2. Adding Np - 1  points to the remaining edges of keyframemin

For the triangle to quadrilateral example, VK = 3 and VK+1  = 4

Both Nls and Np are 1, so add one point to one edge of key frame, no points would be added to the remaining lines of keyframek+1

Simulating Accelerations

If vertex positions at key frames are given, then fit the positions with linear or nonlinear paths.


Figure below illustrates a non linear fit of key frame positions

This determines the trajectories for the in-betweens. To simulate accelerations, adjust the time spacing for in-betweens.

For constant speed, use equal – interval time spacing for the in-betweens.

Suppose if n in-betweens are needed for key frames at times t1and t2, the time interval between key frames is then divided into n+1 sub intervals, yielding an in-between spacing of
                                              ∆t = t2 – t1
                                                        N+1
Calculate the time for any in-betweens as
                              
                       tBj = t1+ j∆t , j=1,2,3,--------n

And determine the values for coordinate positions, color, and other physical parameters.

The start- up and slow- down portions of an animation path is modeled with sp line (or) trigonometric functions.

Parabolic and Cubic time functions have been applied to acceleration modeling.

Trigonometric functions are more commonly used in animation package.

To model increasing speed, the time spacing between frames is increased, so that greater changes in position occur as the object move faster.

The increasing interval size is obtained with the function 1- COSθ, 0< θ<π/2

For n in-betweens the time for jth in-between is calculated as 

              tBj   = t1 + ∆t[1 – cos(jπ/2(n+1)], j=1,2,------n


Example

Figure below illustrates a plot of trigonometric acceleration function and the in-betweens spacing for n = 5.


Model  the decreasing speed with sinθ in the range of  . The time position of an in-between is defiened as 
tBj = t1+ ∆t sin j π/2(n+1) , j=1,2,3,--------n

The plot ok the function and the decreasing size of the time intervals is shown in below figure


Motion contain both speed-ups and speed-downs 

To model a combination of increasing – decreasing speed by first increasing the in-between time spacing, then decrease this spacing.

The function accomplished for this time changes is

½(1 – COSθ )     0<θ<π/2

The time for jth in-between is calculated os 

     tBj  = t1 + ∆t { 1 – COS[j π/(n+1)]/2}  j=1,2,3,4-------------n

Processing the in-between is simplified by initially modeling “skeleton” objects.

This allows interactive adjustment of motion sequences.

After the animation sequence is completely defined objects can be fully rendered.

Motion Specifications

There are several ways in which the motion of objects can be specified in an animation system

Direct Motion Specification

The straight forward method o defining a motion sequence is direct specification of motion parameters.
The rotation angles and translation vectors are given explicitly
Then the geometric transformation matrices are applied to transform coordinate positions.
Use an approximating equation to specify certain kinds of motions.
Approximate the path o a bouncing ball, for instance, with a damped , rectified , sine curve

A  -  initially amplitude
W – Angular frequency
Θ – is the phase angle
K – damping constant

These methods can be used for simple user program animation sequences.

Goal – Directed Systems

The systems are referred to as goal directed because they determine specific motion parameters which are given of the animation.

Example

Specify an object to “walk” or to “run” to a particular destination (or) state the object to “pick up” some other specified object.
The input directives are then interrupted in terms of component motions that will accomplish the selected task 
Human motions, for instance, can be defined as an hierarchical structure of sub motions for the torso , limbs and so forth.

Kinematics and Dynamics

Animation sequence can be constructed using kinematic (or) dynamic descriptions.
With a kinematic description , the animation can be specified by giving motion parameters with out reference to the forces that cause the motion.
Kinematic specification of motion can also be given by simply describing the motion path. This is often done using sp line curves.
An alternative approach is to use inverse kinematics 
This method is often used for complex objects by giving positions and orientations of an end node of object, such as hand (or) foot.
The system then determine the motion parameters of other nodes to accomplish the desired motion
Dynamic descriptors, require the specification of the forces that produce the velocities and accelerations
Descriptors of object behaviour under the influence of forces are generally referred as physically based modelling.
Applications of physically based modelling include complex rigid – body systems and such non rigid systems as cloth and plastic materials.

---------------------------------------------------------------------------
Article By:
S.Guru Jyothi
Asst.Prof.
CSE Department
Sphoorthy Engineering College

Sphoorthy Engineering College


No comments:

Post a Comment