POV-Ray : Newsgroups : povray.animations : Animation block...acceleration on the x axis. Server Time
27 Apr 2024 08:32:53 EDT (-0400)
  Animation block...acceleration on the x axis. (Message 11 to 20 of 23)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 3 Messages >>>
From: RC
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 15:10:01
Message: <web.49a4526f21b0f15ae1acfc5e0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "RC" <nomail@nomail> wrote in message
> news:web.49a42d8221b0f15ae1acfc5e0@news.povray.org...
> > "Chris B" <nom### [at] nomailcom> wrote:
> >>
> >> #declare ObjectX = frame_number*0.1+div(frame_number+1,3)*0.9;
> >
> > Ahhh, interesting, and it works, but with this the motion of each frame
> > changes,
> > its always 0.1 in between and a full 0.9 on the third. I'm looking to have
> > them
> > move more evenly. If frames 1,2,3 are moving 1.0, 4,5,6 all should move
> > the
> > same amount as what ever value the 4th frame was incremented. Does that
> > make
> > sense?
> >
>
> Maybe it would help if you could list the values you'd like to generate for
> the x-displacement for say the first 12 frames.
> In fact, if all else fails you could list the 60 displacements into an array
> and simply index the array using the frame_number variable.
>
> Regards,
> Chris B.

Ya, I'm trying to avoid hard coding the values into an array, because eventually
I will want this for the rendering of several hundred frames. No way to have the
code count/render for three clocks then add a value to our function? That's why
I was trying to use an if statement initially. In the end, once I figure this
out, I will need to count the displacement so when I get to the end of my
image, I can roll it back in the opposite direction, but no need to get ahead
of myself...

1-1fps
2-1fps
3-1fps
4-2fps
5-2fps
6-2fps
7-3fps
8-3fps
9-3fps
10-4fps
11-4fps
12-4fps etc.

*Appreciate your time. Chris B.


Post a reply to this message

From: Chris B
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 16:17:32
Message: <49a463ec$1@news.povray.org>
"RC" <nomail@nomail> wrote in message 
news:web.49a4526f21b0f15ae1acfc5e0@news.povray.org...
> "Chris B" <nom### [at] nomailcom> wrote:
>>
>> Maybe it would help if you could list the values you'd like to generate 
>> for
>> the x-displacement for say the first 12 frames.
>
> 1-1fps
> 2-1fps
> 3-1fps
> 4-2fps
> 5-2fps
> 6-2fps
> 7-3fps
> 8-3fps
> 9-3fps
> 10-4fps
> 11-4fps
> 12-4fps etc.
>

I'm still not quite sure I'm getting it, but I'll take another stab at it.

What you've listed is simply 'div(frame_number,3)+1', so if that's what you 
need then it's easy, but I can't see how that fits with your descriptions 
and I can't see what fps means in this context. In my experience fps 
normally means frames per second, but I don't see how that would be relevant 
here.

Is this the speed? ie the distance travelled per frame? If so you'd get a 
displacement from the initial position of:

Frame 0 - 0 units in 'x'
Frame 1 - 1 unit in 'x'
Frame 2 - 2 units in 'x'
Frame 3 - 4 units in 'x'
Frame 4 - 6 units in 'x'
Frame 5 - 8 units in 'x'
Frame 6 - 11 units in 'x'
Frame 7 - 14 units in 'x'
Frame 8 - 17 units in 'x'
Frame 9 - 21 units in 'x'
Frame 10 - 25 units in 'x'
Frame 11 - 29 units in 'x'
etc?

If that's what you need then the following code should give you this:


#declare ObjectXDisplacement = 0;
#declare Speed = 1;
#local I = 1;
#while (I<=frame_number)
  #if (mod(I,3)=0) #declare Speed = Speed+1; #end
  #declare ObjectXDisplacement = ObjectXDisplacement+Speed;
  #local I = I+1;
#end
#debug concat("Frame Number: ",str(frame_number,3,0),"  ObjectXDisplacement: 
",str(ObjectXDisplacement,3,0),"\n")


Here's hoping that's what you want :-)

Regards,
Chris B.


Post a reply to this message

From: Stephen
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 17:23:19
Message: <7ps8q4hv45ljto9071p64u5brp06cm2f4i@4ax.com>
On Tue, 24 Feb 2009 21:17:28 -0000, "Chris B" <nom### [at] nomailcom> wrote:

>I can't see what fps means in this context.

Just a guess Chris, Feet Per Second
-- 

Regards
     Stephen


Post a reply to this message

From: RC
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 17:50:00
Message: <web.49a4793d21b0f15ae1acfc5e0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "RC" <nomail@nomail> wrote in message
> news:web.49a4526f21b0f15ae1acfc5e0@news.povray.org...
> > "Chris B" <nom### [at] nomailcom> wrote:
> >>
> >> Maybe it would help if you could list the values you'd like to generate
> >> for
> >> the x-displacement for say the first 12 frames.
> >
> > 1-1fps
> > 2-1fps
> > 3-1fps
> > 4-2fps
> > 5-2fps
> > 6-2fps
> > 7-3fps
> > 8-3fps
> > 9-3fps
> > 10-4fps
> > 11-4fps
> > 12-4fps etc.
> >
>
> I'm still not quite sure I'm getting it, but I'll take another stab at it.
>
> What you've listed is simply 'div(frame_number,3)+1', so if that's what you
> need then it's easy, but I can't see how that fits with your descriptions
> and I can't see what fps means in this context. In my experience fps
> normally means frames per second, but I don't see how that would be relevant
> here.
>
> Is this the speed? ie the distance travelled per frame? If so you'd get a
> displacement from the initial position of:
>
> Frame 0 - 0 units in 'x'
> Frame 1 - 1 unit in 'x'
> Frame 2 - 2 units in 'x'
> Frame 3 - 4 units in 'x'
> Frame 4 - 6 units in 'x'
> Frame 5 - 8 units in 'x'
> Frame 6 - 11 units in 'x'
> Frame 7 - 14 units in 'x'
> Frame 8 - 17 units in 'x'
> Frame 9 - 21 units in 'x'
> Frame 10 - 25 units in 'x'
> Frame 11 - 29 units in 'x'
> etc?
>
> If that's what you need then the following code should give you this:
>
>
> #declare ObjectXDisplacement = 0;
> #declare Speed = 1;
> #local I = 1;
> #while (I<=frame_number)
>   #if (mod(I,3)=0) #declare Speed = Speed+1; #end
>   #declare ObjectXDisplacement = ObjectXDisplacement+Speed;
>   #local I = I+1;
> #end
> #debug concat("Frame Number: ",str(frame_number,3,0),"  ObjectXDisplacement:
> ",str(ObjectXDisplacement,3,0),"\n")
>
>
> Here's hoping that's what you want :-)
>
> Regards,
> Chris B.

Ah-ha! Works! That mod function is exactly what I was looking for. Thank you for
your patience. RC


Post a reply to this message

From: Chris B
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 17:53:55
Message: <49a47a83$1@news.povray.org>
"Stephen" <mcavoysAT@aolDOTcom> wrote in message 
news:7ps8q4hv45ljto9071p64u5brp06cm2f4i@4ax.com...
> On Tue, 24 Feb 2009 21:17:28 -0000, "Chris B" <nom### [at] nomailcom> wrote:
>
>>I can't see what fps means in this context.
>
> Just a guess Chris, Feet Per Second
> -- 
>
> Regards
>     Stephen

Ah yes. I never thought of that. :-)

So it would be speed rather than displacement. Hopefully the code will fix 
the problem then. If it's anything other than 1 POV-Ray unit = 1 Foot  it 
may need  scaling.

Regards,
Chris B.


Post a reply to this message

From: Stephen
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 18:09:12
Message: <uev8q4p04uoudu37jtutg209cg150m378d@4ax.com>
On Tue, 24 Feb 2009 22:53:51 -0000, "Chris B" <nom### [at] nomailcom> wrote:


>>>I can't see what fps means in this context.
>>
>> Just a guess Chris, Feet Per Second

>
>Ah yes. I never thought of that. :-)
>
>So it would be speed rather than displacement. Hopefully the code will fix 
>the problem then. If it's anything other than 1 POV-Ray unit = 1 Foot  it 
>may need  scaling.
>

The cobwebs blew away and 60 mph = 88 fps sprang to mind. 
I was thinking along the lines of using the switch directive but I'm modelling
an animated chain drive and it is so labour intensive I can't stop to think :)
Congrats BTW.
-- 

Regards
     Stephen


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 21:28:14
Message: <49a4acbe@news.povray.org>
RC wrote:
> At what point in the code
> would I include a variable that changes the "function of t" value every
> three frames?

It doesn't work that way.

Suppose you want a variable to multiply by two every frame. You don't put
a = a * 2 assuming it will run on every frame, because a would be deleted
and re-initialized on the next frame. You need a = pow(2, frame_number), so
that 'a' is 2 to the uhh... frame_number'th power :)


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Animation block...acceleration on the x axis.
Date: 24 Feb 2009 21:29:13
Message: <49a4acf9@news.povray.org>
RC wrote:
> No way to have the code count/render for three clocks then add a value to
> our function?

No, because "our function" is not preserved from one frame to the next. All
values are reset.


Post a reply to this message

From: Kenneth
Subject: Re: Animation block...acceleration on the x axis.
Date: 26 Feb 2009 03:30:00
Message: <web.49a651aa21b0f15af50167bc0@news.povray.org>
These animation accelleration questions have also intrigued/perplexed me
recently. I'm just now coming in at the tail-end of the discussion here, and I
see some good suggestions and explanations, better than what I've come up with
on my own.

Although not specifically what you're asking for, I did come up with a simple
way of starting off an animation's CAMERA motion at slow-to-zero speed, ramping
up to 'full speed' by the mid-point of the animation, then ramping back down to
slow-to-zero at the end:

#if(clock <= .5)
#declare my_clock = 1/2*pow(2*clock,2);
#else
#declare my_clock = 1 - 1/2*pow(2*(1 - clock),2);
#end

then just plug my_clock into your camera motions, with some appropriate
multiplier(s). This could be used for an object's motion instead. The exponent
in the pow() equations can be varied, and things will still come out right-- as
far as I've been able to determine, anyway. However, with this simple scheme,
there is never a point when the camera is moving at a constant speed; it's
always ramping either up or down.

As-is, though, it adds a bit of 'movie realism' to a moving (or panning/tilting)
camera.

Ken W.


Post a reply to this message

From: RC
Subject: Re: Animation block...acceleration on the x axis.
Date: 26 Feb 2009 11:25:00
Message: <web.49a6c25121b0f15ae1acfc5e0@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> These animation accelleration questions have also intrigued/perplexed me
> recently. I'm just now coming in at the tail-end of the discussion here, and I
> see some good suggestions and explanations, better than what I've come up with
> on my own.
>
> Although not specifically what you're asking for, I did come up with a simple
> way of starting off an animation's CAMERA motion at slow-to-zero speed, ramping
> up to 'full speed' by the mid-point of the animation, then ramping back down to
> slow-to-zero at the end:
>
> #if(clock <= .5)
> #declare my_clock = 1/2*pow(2*clock,2);
> #else
> #declare my_clock = 1 - 1/2*pow(2*(1 - clock),2);
> #end
>
> then just plug my_clock into your camera motions, with some appropriate
> multiplier(s). This could be used for an object's motion instead. The exponent
> in the pow() equations can be varied, and things will still come out right-- as
> far as I've been able to determine, anyway. However, with this simple scheme,
> there is never a point when the camera is moving at a constant speed; it's
> always ramping either up or down.
>
> As-is, though, it adds a bit of 'movie realism' to a moving (or panning/tilting)
> camera.
>
> Ken W.

Yes, why is it that you can never hold the value of the changed variable unless
its just for one particular instance? I find it strange that it seems so
difficult to change one variable for speed and have it maintain a constant
value throughout any number of frames you wish with the ability to change it at
any time without it reverting back to the declared value on the next cycle. I
guess you would have to write that value to a separate file and reference it
that way?


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 3 Messages >>>

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