POV-Ray : Newsgroups : povray.binaries.animations : Multi-Stage Animation Macro test Server Time
22 Dec 2024 00:13:03 EST (-0500)
  Multi-Stage Animation Macro test (Message 1 to 5 of 5)  
From: Anthony D  Baye
Subject: Multi-Stage Animation Macro test
Date: 12 Mar 2013 14:35:00
Message: <web.513f74977b158278d97ee2b90@news.povray.org>
A simple animation to test my multi-stage animation macros.

Scene file: Three rotating segmented rings.  Four separate timelines, each with
three stages.

I've made a note of the command-line for encoding the 600-frame animation in
mencoder, but you'll need to remove the back-slashes.

If you like my method, I can upload the macros.

Regards,
A.D.B.

/*
 Persistence of Vision Ray-Tracer Scene Description File
 Name: Rings.pov
 Vers: 3.6
 Desc:
 Date: 01-30-08
 Auth: Anthony D. Baye
 Note: mencoder mf:\/\/\*.png -mf w=1024:h=768:fps=30:type=png -ovc x264
-x264encopts preset=slow:tune=film:crf=20 -of avi -o Rings.avi
*/

#include "kolors.inc"
#include "metals.inc"
#include "glass.inc"
#include "anim.inc"

/* !--- Global Settings ---! */
#declare ANI = clock_on;
/* !-----------------------! */
#default { pigment { Orange } finish { ambient 0.3 diffuse 0.6 } }

light_source { <0.0, 30.0 -15.0> color rgb 1 media_interaction off }
camera {
 location <3.0, 5.0, -10.0>
 look_at 0.0
 }


#declare colors =
array [7] {
 Red,
 Orange,
 Yellow,
 Green,
 Blue,
 Indigo,
 Violet
 }

#macro Ring(Rad, segCount, Tilt, Phase)

#local rSpan = 360/segCount;
#declare ringSeg =
difference {
 merge {
  cylinder { <0.0, 0.0, -0.3125> <0.0, 0.0, 0.3125> Rad }
  cylinder { <0.0, 0.0, -0.25> <0.0, 0.0, 0.25> Rad+0.03125 }
  }
 cylinder { <0.0, 0.0, -0.34375> <0.0, 0.0, 0.34375> Rad-0.1875 }
 cylinder { <0.0, 0.0, -0.25> <0.0, 0.0, 0.25> Rad-0.125 }
 box { <0.0, -(Rad+0.0625), -0.34375> <(Rad+0.0625), (Rad+0.0625), 0.34375>
  rotate -(rSpan/2)*z }
 box { <0.0, -(Rad+0.0625), -0.34375> <-(Rad+0.0625), (Rad+0.0625), 0.34375>
  rotate (rSpan/2)*z }
 union {
  difference {
   cylinder { <0.0, 0.0, -0.34375> <0.0, 0.0, 0.34375> 0.1875 }
   cylinder { <0.0, 0.0, -0.31251> <0.0, 0.0, 0.31251> 0.09375 }
   box { <0.0, -0.21875, -0.375> <-0.21875, 0.21875, 0.375> }
   }
  cylinder { -0.25*z, -0.34375*z  0.109375 }
  cylinder { 0.25*z, 0.34375*z  0.109375 }
  cylinder { -0.28125*z, 0.28125*z  0.046875 }
   translate -0.09375*x
   rotate -(rSpan/2)*z
   translate <(Rad-0.09375)*sin(radians((rSpan/2))),
    (Rad-0.09375)*cos(radians((rSpan/2))), 0.0>
  }
 union {
  difference {
   cylinder { <0.0, 0.0, -0.34375> <0.0, 0.0, 0.34375> 0.1875 }
   cylinder { <0.0, 0.0, -0.31251> <0.0, 0.0, 0.31251> 0.09375 }
   box { <0.0, -0.21875, -0.375> <0.21875, 0.21875, 0.375> }
   }
  cylinder { -0.25*z, -0.34375*z  0.109375 }
  cylinder { 0.25*z, 0.34375*z  0.109375 }
  cylinder { -0.28125*z, 0.28125*z  0.046875 }
   translate 0.09375*x
   rotate (rSpan/2)*z
   translate <-(Rad-0.09375)*sin(radians((rSpan/2))),
    (Rad-0.09375)*cos(radians((rSpan/2))), 0.0>
  }
  pigment { White }
//  finish { F_MetalC }
  finish {
   ambient 0.3
   diffuse 0.6
 //  roughness 0.01
 //  specular 0.5
   }
  rotate 90.0*x
 }

union {
#local a = 0;
#local cIndex = 0;
#while(a < 360)

#if(cIndex > 6)
 #local cIndex = 0;
#end

 object { ringSeg rotate (a + Phase)*y
  rotate Tilt pigment { colors[cIndex] } }

#local cIndex = cIndex + 1 ;

#local a = a + (360 / segCount);
#end
 }

#end

#local C = 18;
#local O = 180/C;
#local S = degrees(15)*clock;
#local D = (2*pi*3) / C;

#if(ANI)
     initAnimation(<0,0,20>)
#end

union {
     Ring(3.0, 18, 120.0*z, (Timer(1, <0,0,0>, <0,0,5>,
300)+Timer(4,<0,0,5>,<0,0,20>,4500)+Timer(1, <0,0,15>, <0,0,20>, -300)))
     Ring(3.5, 18, 60.0*z, (Timer(1, <0,0,1>, <0,0,6>,
300)+Timer(4,<0,0,6>,<0,0,19>,4500)+Timer(1, <0,0,14>, <0,0,19>, -300)))
          rotate (Timer(1, <0,0,4>, <0,0,7>,
150)+Timer(4,<0,0,7>,<0,0,16>,1200)+Timer(1, <0,0,13>, <0,0,16>, -150))*y
     }
Ring(4.0, 12, 0.0, (Timer(1, <0,0,2>, <0,0,7>,
300)+Timer(4,<0,0,7>,<0,0,18>,4500)+Timer(1, <0,0,13>, <0,0,18>, -300)))


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Multi-Stage Animation Macro test
Date: 12 Mar 2013 14:50:01
Message: <web.513f765ba7adf009d97ee2b90@news.povray.org>
It didn't upload the video...

The uploader is saying it's too large, but the max size is listed as 5000k and
my file is only 4.5MB = 4608k.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Multi-Stage Animation Macro test
Date: 12 Mar 2013 15:00:00
Message: <web.513f7a6ba7adf009d97ee2b90@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> It didn't upload the video...
>
> The uploader is saying it's too large, but the max size is listed as 5000k and
> my file is only 4.5MB = 4608k.

I've uploaded it to my youtube account, but it's unlisted, so you'll need the
link:

http://youtu.be/5QbNjuJ5hQk

Feel free to leave comments.

Regards,
A.D.B.


Post a reply to this message

From: waggy
Subject: Re: Multi-Stage Animation Macro test
Date: 12 Mar 2013 21:35:00
Message: <web.513fd6a6a7adf00921be1230@news.povray.org>
Nice work!

I've recently been doing some POV-Ray animation, as well. I use a different .pov
file for each scene, and derive scene clocks from the global clock. I've also
found it helpful to define a "transition" clock between scenes. It runs [-1,1],
and both scene files on either side of the transition key frame (when the
transition clock is zero) are loaded during the transition time period. The
scene transition clock is used to make scene "transition in" and "transition
out" effects.

I like to upload a lossless video. I don't know if mencoder supports it, but
this seems to work well using ffmpeg (Linux version). The compression seems
pretty good. It compressed 322MiB of gzipped PNG source frames to a 41 MiB
lossless video. Youtube seems to handle this lossless encoding fine.

ffmpeg -b 1000k -r 30 -f image2 -i FrameFolder/FrameName%04d.png \
 -vcodec libx264 -pix_fmt yuv420p -preset veryslow \
 -tune animation -qp 0 AnimName.mkv

Unfortunately, few players can deal with the lossless H.264 encoding, so I
experimented until I found a high-quality lossy combination that seems to play
ok under stock Win7, Mac, and Linux. (Compression is similar to above.)

ffmpeg -b 1000k -r 30 -f image2 -i FrameFolder/FrameName%04d.png \
 -vcodec libx264 -pix_fmt yuv420p -preset veryslow \
 -profile baseline -tune animation -crf 1 AnimName.mp4

Here's what I'm working on. It currently has five short scenes.

http://www.youtube.com/watch?v=eX3i1ioAvBA

I still have a lot of work to do on it.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Multi-Stage Animation Macro test
Date: 12 Mar 2013 23:05:01
Message: <web.513fec21a7adf009d97ee2b90@news.povray.org>
"waggy" <hon### [at] handbasketorg> wrote:
> Nice work!
>
> I've recently been doing some POV-Ray animation, as well. I use a different .pov
> file for each scene, and derive scene clocks from the global clock. I've also
> found it helpful to define a "transition" clock between scenes. It runs [-1,1],
> and both scene files on either side of the transition key frame (when the
> transition clock is zero) are loaded during the transition time period. The
> scene transition clock is used to make scene "transition in" and "transition
> out" effects.
>

Can't say I understand from your video just what is going on.

> I like to upload a lossless video. I don't know if mencoder supports it, but
> this seems to work well using ffmpeg (Linux version). The compression seems
> pretty good. It compressed 322MiB of gzipped PNG source frames to a 41 MiB
> lossless video. Youtube seems to handle this lossless encoding fine.
>
> ffmpeg -b 1000k -r 30 -f image2 -i FrameFolder/FrameName%04d.png \
>  -vcodec libx264 -pix_fmt yuv420p -preset veryslow \
>  -tune animation -qp 0 AnimName.mkv
>
> Unfortunately, few players can deal with the lossless H.264 encoding, so I
> experimented until I found a high-quality lossy combination that seems to play
> ok under stock Win7, Mac, and Linux. (Compression is similar to above.)
>
> ffmpeg -b 1000k -r 30 -f image2 -i FrameFolder/FrameName%04d.png \
>  -vcodec libx264 -pix_fmt yuv420p -preset veryslow \
>  -profile baseline -tune animation -crf 1 AnimName.mp4
>
> Here's what I'm working on. It currently has five short scenes.
>
> http://www.youtube.com/watch?v=eX3i1ioAvBA
>
> I still have a lot of work to do on it.

I encoded from png frames using mencoder.  The codec I used was x264, and the
command line was somewhat altered from a 2-step process where the second step
was merging audio with another tool that I couldn't find.  Fortunately, I wasn't
using audio, so it wasn't necessary.

my macros currently handle motion in four ways:
1) acceleration given Delta-V
2) acceleration given a constant of acceleration
3) steady motion given speed
4) steady motion given distance

They're probably not as elegant as Chris Colefax's spline macros.  It would be
easier, for instance, to orient a spacecraft along a spline which defines it's
path, and use another spline to define the velocity at which it traverses that
path, but I'm not good with splines.

Regards,
A.D.B.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.