POV-RaySP = POV-Ray with Splines
The Problem
POV-Ray is a powerful ray-tracer,
which includes also support for animation.
A missing feature is the ability, to define splines and use them e.g. for
the definition of motions.
Assume you want to move a sphere from the origin one unit to the right and
then back to the origin. The clock variable changes from 0 to 1 during the
sequence. You would have to define something like:
#if (clock < 0.5)
#declare pos=clock*2*<1,0,0>
#else
#declare pos=(1-clock)*2*<1,0,0>
#endif
sphere { pos 1 pigment { color Yellow } }
In a more complex motion the definition of pos would become much
more complex.
Now assume that POV-Ray would allow to define splines:
#declare pos=spline {
linear_spline
0,<0,0,0>
0.5,<1,0,0>
1,<0,0,0>
}
sphere { pos(clock) 1 pigment { color Yellow } }
In this case, this isn't much shorter, but easier to read and write: At
first (clock=0) the position is the origin (<0,0,0>), at clock=0.5
the position is (<1,0,0>) and at the end (clock=1) the position is
again (<0,0,0>). The way between this points is determined by
interpolation.
Good News
It's possible to use splines in the modified, unofficial version POV-RaySP,
the POV-Ray with splines.
How to get
The very short way: The POV-RaySP patch has become part of the
unofficial POV-Ray distribution MegaPov. You can find it at:
POV-RaySP without all other patches you can get in two ways:
as full source package (like povuni_s.tgz) and as patch for
the official sources povuni_s.tgz Version 3.01.
To install POV-RaySP on an unix system, you have to use one of the following
ways:
- The source package:
-
- Download the source package (830k) of POV-RaySP from
here.
- Untar the package with
tar xzf povsp_s.tgz
or
zcat povsp_s.tgz | tar x
The recommended place to do this is /usr/local. The directory
/usr/local/povray3 will be created.
- Follow the instructions in povray3/source/unix/CMPL_Unix.doc to
build POV-Ray.
- The patches:
-
Install also povuni_d.tgz with the standard include files, which
you can get from the
POV-Ray Server.
On other systems the modified sources should compile too, but no test
has been done yet.
Syntax for splines
See also:
A small tutorial with examples
All Syntax descriptions from the original
POV-Ray documentation are
valid for POV-RaySP too.
Additional syntax for splines:
- Declaration:
-
#declare identifier = spline { /* name of the spline */
[ linear_spline | cubic_spline ] /* type of spline */
FLOAT, <VECTOR< | FLOAT , /* argument / value - pair */
.. /* more argument/value pairs follow */
}
Note: argument/value pairs needn't be sorted by argument value.
Example:
#declare pos=spline {
linear_spline
0,<0,0,0>
0.5,<1,0,0>
1,<0,0,0>
}
- Usage:
- Splines work like function and may be used at (nearly) every place,
where a float or vector value is expected.
The following examples assume we have defined a spline named Spline:
/* a moving sphere */
sphere { Spline(clock) 1 pigment { color Yellow } }
/* a sphere which changes it's size */
sphere { <0,0,0> Spline(clock) pigment { color Yellow } }
/* the same, but with a x-component of a spline vector */
sphere { <0,0,0> Spline(clock).x pigment { color Yellow } }
The usage of splines is described more detailed in this
small tutorial.
Special properties of "pure" splines
The way, how splines are calculated is not exact the same as
for splines in SOR, prism and lathe objects.
- Outside the range between the lowest and highest defined argument
the value of the spline is constant and equal to the value for the
lowest or highest argument.
- Cubic splines can be calculated in the range between the second and
last but one argument. In the remaining parts linear splines are used.
- quadratic_spline is not implemented.
Known Bugs
- Specifying two argument/value pairs with the same argument delivers
no error message but strange results.
- The declaration of a new variable using splines directly doesn't work.
Instead of
#declare Angle=Spline(clock)
one has to use
#declare Angle=<0,0,0>+Spline(clock)
Copyright ...
All copyright informations from then original
POV-Ray documentation
are valid for POV-RaySP too. The additional parts for splines are
copyright 1997 Wolfgang Ortmann <noo@uni-jena.de>.
For comments, remarks, bug reports and suggestions contact the author
Wolfgang Ortmann
|