Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
logo
    3D Animations with POV-Ray
        Some basics and examples on animations.
Italiano Italiano
Français français
Deutsch Deutsch
Home
- 3D Animations Gallery
- POV-Ray Tutorial

  3D Animation Tutorial
   Index of Content
  0. Basic Knowledge
     1. Basic Example
     2. Example 2
     3. Images to Animated Gif
     4. From Images to Video
     5. Basic Terms
     6. Animation Commands  
  I. Cyclic Animations
     1. Rotating Objects
     1.2. Planets in Orbit
     1.3. Clock Animation
     2. Rotating Camera
     2.1. Straight Moving Camera
     3. Western Wheel
         Problem
     3.1. Rolling Wheels
     4. Gears
     4.1. Roller Chain
     4.2. Bike Chain
     5. Swinging Pendulum
     5.1. Newton's Cradle
     5.2: Rock the Rocker
     6. Spiral Pendulum
     7. Coupling Rods
     7.1. Connecting Rods
     8. Psychedelic + Op-Art
     9. Counters + Countdowns
    10. Folding of a Cube
  II. Non-linear Movements
     1.0 Speed Up/Slow Down 1
     1.1 Speed Up/Slow Down 2
     2. Fall + Bounce
     3. Acceleration by
          physical Formulas
  > 4. Speed Controll by
          Spline Functions
  III. Animation Paths
      with Spline Curves
     1. Spline Curves
     2. Closed Splines
     3. Animation Paths
                                                       

Speed Controll
by Spline Functions
Non-linear movements in Animations
for simulations of realistic accelerations and decelerations
by the spline function in POV-Ray.

Using the Spline Functions for Controlling Movements
With this function we can create realistic sequences of movements without any calculations with physical formulas in a very easy way.
Example: We move a sphere along the x axis.
Therefore we define a row of points where we want the sphere to be. Here the time scale runs from 0 to 1 in eaqual steps each of 0.100.
//----------------------------------------
// coordinates for the points of a spline
#declare P0 = <-0.50, 0, 0>;//control
#declare P1 = < 0.00, 0, 0>;
#declare P2 = < 0.50, 0, 0>;
#declare P3 = < 1.00, 0, 0>;
#declare P4 = < 1.50, 0, 0>;
#declare P5 = < 2.00, 0, 0>;
#declare P6 = < 5.00, 0, 0>;
#declare P7 = < 8.00, 0, 0>;
#declare P8 = < 8.50, 0, 0>;
#declare P9 = < 9.00, 0, 0>;
#declare P10= < 9.50, 0, 0>;
#declare P11= <10.00, 0, 0>;
#declare P12= <10.50, 0, 0>;//control

#declare Spline_1 =
  spline {
    natural_spline
   -0.100, P0, // control point
    0.000, P1, // starting point
    0.100, P2,
    0.200, P3,
    0.300, P4,
    0.400, P5,
    0.500, P6,
    0.600, P7,
    0.700, P8,
    0.800, P9,
    0.900, P10,
    1.000, P11, // end point
    1.100, P12  // control point
  }// end of spline ---------------
//---------------------------------------
Note 1: For a spline of the type 'natural_spline' we need the
control points 'P0' and 'P12' before and after the spline.
The values of the spline function here are declared between 'P1' and 'P11'.
Note 2: The time values run from -0.1 to 1.1 in steps by 0.100.
Spline points
The following test shows the points of the spline:
(This section can be commented out by '/* */', if every thing works right!)
//----------------------------------------
// visual test of the spline points
#declare Marker   =
 sphere{<0,0,0>,0.05 pigment{Red}}
#declare Marker_C =
 sphere{<0,0,0>,0.05 pigment{Yellow}}
//--------- set msrkers:
object{ Marker_C translate P0 }
object{ Marker translate P1 }
object{ Marker translate P2 }
object{ Marker translate P3 }
object{ Marker translate P4 }
object{ Marker translate P5 }
object{ Marker translate P6 }
object{ Marker translate P7 }
object{ Marker translate P8 }
object{ Marker translate P9 }
object{ Marker translate P10 }
object{ Marker translate P11 }
object{ Marker_C translate P12 }
// end test of the spline
//---------------------------------------

Now we can animate a moving sphere by
an animation with a clock running from 0 to 1.
//----------------------------------------
// The moving sphere:
sphere{ <0,0,0>,0.5
  texture{
    pigment{ rgb<1.0,1.0,1>*0.05 }
    finish { phong 1 reflection{ 0.1 } }
    translate<0,0.5,0>
    translate Spline_1(clock)
      } // end of sphere
//---------------------------------------
Spline move
Scene descriptions
for POV-Ray:
"Spline_move_1.ini" and
"Spline_move_1.pov"

Spline move
Scene descriptions for POV-Ray:
"Spline_move_1.ini" and "Spline_move_1.pov"
top

© Friedrich A. Lohmüller, 2012
www.f-lohmueller.de