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
                                                       

The Concept of
the Spline Curves

The harmonic connection of a row of points.
           

The Spline Function "spline{ ... }":
A spline function is a relation between given time values and according vectors of positions (anchor points). POV-Ray calculates with this function all values between these given points for a curve which connects these anchor points.
#declare Spline_1 =
  spline {
   natural_spline
  -0.2, <-2,1.0,-2>,//control point

   0.0, <-0,1.0,-2>,//start point
   0.2, < 2,1.0,-2>,
   0.4, < 2,1.0, 0>,
   0.6, < 0,1.0, 0>,
   0.8, < 0,1.0, 2>,
   1.0, < 2,1.0, 2>,//end point

   1.2, < 4,1.0, 2>//control point
  }

spline demo
Spline - the effect of the control points
Complete scene description for POV-Ray:
"spline_demo.pov"

In POV-Ray there are 4 different types of splines:
linear_spline   = Straight lines are connecting the anchor points (This is default).
quadratic_spline = Connecting the anchor points by a smooth curve of 2nd order.
cubic_spline   = Connecting the anchor points by a more smooth curve of 3rd order.
natural_spline = Connecting the anchor points by a very smooth curve of 3rd order

For animation paths without jerky motions it's optimal to use the spline types cubic_spline and natural_spline. Using cubic_spline and natural_spline we have to define additional control points before and behind our anchor points to control the bending of the curve in our start and end points.
In the image above "Spline Demo" the anchor points are yellow and the control points are red. With a While loop the spline curve is marked with little spheres:
 #declare Nr = 0;     // start
 #declare EndNr = 1;  // end
 #while (Nr< EndNr)   // -----------------------------------
 sphere{ <0,0,0>,0.07
          texture{ pigment{color rgb <1-Nr/2,0.75+Nr/4,0>}
                  finish {diffuse 0.9 phong 1}
                }
         translate Spline_1(Nr)
       } // end of sphere

 #declare Nr = Nr + 0.005;  // next Nr
 #end // -------------------------------------- end of loop


top

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