POV-Ray : Newsgroups : povray.advanced-users : Tracking animation 'state' Server Time
28 Dec 2024 00:18:30 EST (-0500)
  Tracking animation 'state' (Message 1 to 8 of 8)  
From: Ross Del Duca
Subject: Tracking animation 'state'
Date: 11 Jun 2004 19:45:03
Message: <40ca43ff@news.povray.org>


a macro that takes "spread" and "flap" values to determine their position -
which can in turn be based on the clock.

What I'm trying to add now is a way to have the 'skin' stretch as if

motion of the wing (i.e. up or down) but I'm stumped about how to do this

track what the last frame rendered was, so that I can then determine which
way to stretch the bicubic patch?

Thanks all!


Post a reply to this message

From: John VanSickle
Subject: Re: Tracking animation 'state'
Date: 11 Jun 2004 23:40:21
Message: <40ca7b25@news.povray.org>
Ross Del Duca wrote:

> I've created a model of flapping wings.  There are ribs, with bicubic
> patches forming the 'skin' between the wings.  The wings are generated with
> a macro that takes "spread" and "flap" values to determine their position -
> which can in turn be based on the clock.
> 
> What I'm trying to add now is a way to have the 'skin' stretch as if
> experiencing wind resistance.  To do that - I need someway to know the
> motion of the wing (i.e. up or down) but I'm stumped about how to do this
> since each frame is rendered individually.  Is there an easy way for me to
> track what the last frame rendered was, so that I can then determine which
> way to stretch the bicubic patch?

You're using a formula based on the clock variable to generate the
wing's position, right?

If so, then use differential calculus to derive the formula for the
wing's velocity at any given moment.

Regards,
John


Post a reply to this message

From: Andrew C on Mozilla
Subject: Re: Tracking animation 'state'
Date: 12 Jun 2004 05:24:40
Message: <40cacbd8$1@news.povray.org>
Read up on POV-Ray's IO directives. The standard way to do stuff like 
this is to

1. load position data from the previous frame
2. calculate (and draw) new positions
3. save new positions to file [overwriting what's there]

HTH.

Andrew @ home.


Post a reply to this message

From: Ross Del Duca
Subject: Re: Tracking animation 'state'
Date: 12 Jun 2004 13:36:32
Message: <40cb3f20@news.povray.org>
That's the hit.  Thank.  I remember when I first started playing with povray
(a whopping 3 weeks ago or so) I skimmed over that part thinking 'I'll look
into that later.'

Didn't make the connection in relation to this problem.

One thing though - it occurred to me this would make the value of the
'stretch' dependant on the number of frames being rendered in a set - true?

Also, I'd be glad to post the code if anyone is interested.  Is there a
particular newsgroup specific to code postings of this nature?

Again, thanks....

Andrew C on Mozilla wrote:

> Read up on POV-Ray's IO directives. The standard way to do stuff like
> this is to
> 
> 1. load position data from the previous frame
> 2. calculate (and draw) new positions
> 3. save new positions to file [overwriting what's there]
> 
> HTH.
> 
> Andrew @ home.


Post a reply to this message

From: Ross Del Duca
Subject: Re: Tracking animation 'state'
Date: 12 Jun 2004 13:38:44
Message: <40cb3fa4@news.povray.org>
This is the part of pov that is proving the most interesting to me (well,
other than seeing the things that I can create on the screen.)  By that I
mean, I'm being forced to recall math skills that I haven't had cause to
use since college.

Made me feel kind of silly when, initially, I couldn't even recall
immediately how to get the formula for a line based on two points.  *sigh*

John VanSickle wrote:

> You're using a formula based on the clock variable to generate the
> wing's position, right?
> 
> If so, then use differential calculus to derive the formula for the
> wing's velocity at any given moment.
> 
> Regards,
> John


Post a reply to this message

From: Andrew C on Mozilla
Subject: Re: Tracking animation 'state'
Date: 13 Jun 2004 08:38:00
Message: <40cc4aa8$1@news.povray.org>
> That's the hit.  Thank.  I remember when I first started playing with povray
> (a whopping 3 weeks ago or so) I skimmed over that part thinking 'I'll look
> into that later.'
> 
> Didn't make the connection in relation to this problem.

Fair enough.

But yeah, this is (one of) the reasons those commands are even there. ;-)

(That and making scenes that write scenes - and other weird stuff.)

> One thing though - it occurred to me this would make the value of the
> 'stretch' dependant on the number of frames being rendered in a set - true?

Ah, yes... do you have to be a bit careful here.

I've done physical simulations with POV-Ray in the past. Generally I get 
these to work off the current frame number rather than the clock. I then 
hard-code the number of frames per second the animation should be played 
at, and work it out from there.

Of course, there's nothing to say *you* have to do it that way. ;-)

You may want to glance over the section on animation variables - clock, 
clock_delta, frame_number, etc. All good to know about so you can decide 
what suits what you're trying to do.

> Also, I'd be glad to post the code if anyone is interested.  Is there a
> particular newsgroup specific to code postings of this nature?

This group and povray.animations for general chat about *how* to code it.

povray.text.scene-files and povray.binaries.scene-files for large slabs 
of code. (See the News server FAQ for the difference between them.)

Anyway, have fun!
Andrew @ home.


Post a reply to this message

From: Andrew C on Mozilla
Subject: Re: Tracking animation 'state'
Date: 13 Jun 2004 15:00:43
Message: <40cca45b$1@news.povray.org>
>> 1. load position data from the previous frame
>> 2. calculate (and draw) new positions
>> 3. save new positions to file [overwriting what's there]
> 
> 
> Doesn't this fail kind of irrecoverably if you have to restart the 
> animation for some reason? Would it not be better to save each state to 
> a different file, so you can pick up in the middle?

Well, yeah, that's doable also...

...as is computing *all* the data for the entire animation during the 
parsing of frame 1, and reading it back thereafter. (Not sure if this 
would gain you anything - possibly less overhead in parsing input files.)

...or any other combination that takes your fancy. ;-)

Andrew @ home.


Post a reply to this message

From:
Subject: Re: Tracking animation 'state'
Date: 17 Jun 2004 22:35:01
Message: <40d254d5$1@news.povray.org>
// Hi Ross,
      //
      // you could write a macro like this:

#macro CalculateFrameParameters (TheClock)
  #declare Flap = sin(radians(TheClock*360*FlapsInAnimation));
  #declare Spread = /* whatever*/;
  /* ... */
  #end//macro

      // Then do this at the beginning of each frame:

#declare ShortTime = 0.01; // or clock_delta
CalculateFrameParameters (clock-ShortTime)
#declare OldFlap = Flap;
#declare OldSpread = Spread;
CalculateFrameParameters (clock)

      // Now a comparison of OldFlap and Flap
      // tells direction and intensity of
      // the motion. For example:

#declare WingSpeed = (Flap-OldFlap)/ShortTime;
#if (WingSpeed>0)
    /* wing goes up */
  #else
    /* wing goes down */
  #end


      // If your formulas don't like TheClock<0
      // then add the following statement between
      // "#macro ..." and "#declare Flap ...":

  #if (TheClock<0) #declare TheClock = 0; #end



      //    Sputnik


Post a reply to this message

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