POV-Ray : Newsgroups : povray.general : Flapping wings? Server Time
7 Aug 2024 11:25:39 EDT (-0400)
  Flapping wings? (Message 1 to 8 of 8)  
From: Mahalis
Subject: Flapping wings?
Date: 11 Oct 2001 11:34:16
Message: <3bc5bbf8$1@news.povray.org>
How would I make wings on an object flap at a certain speed relative to the
clock?
ex:
#declare flapSpeed=50;
object{Wing rotate ???}


Post a reply to this message

From: Bob H 
Subject: Re: Flapping wings?
Date: 11 Oct 2001 12:50:37
Message: <3bc5cddd@news.povray.org>
"Mahalis" <don### [at] fakeycom> wrote in message
news:3bc5bbf8$1@news.povray.org...
> How would I make wings on an object flap at a certain speed relative to
the
> clock?
> ex:
> #declare flapSpeed=50;
> object{Wing rotate ???}

I use Chris Colefax's clock modifier for such things.  You can specify a
"repeat" number along with an oscillation for example.

http://www.geocities.com/ccolefax/

Bob H.


Post a reply to this message

From: Bill DeWitt
Subject: Re: Flapping wings?
Date: 11 Oct 2001 13:15:18
Message: <3bc5d3a6@news.povray.org>
"Mahalis" <don### [at] fakeycom> wrote in message
news:3bc5bbf8$1@news.povray.org...
> How would I make wings on an object flap at a certain speed relative to
the
> clock?
> ex:
> #declare flapSpeed=50;
> object{Wing rotate <sin((clock*50)*(2*pi))*Xdimension,
cos((clock*50)*(2*pi))*Ydimension, 0>}

    Or something like that.


Post a reply to this message

From: Josh English
Subject: Re: Flapping wings?
Date: 11 Oct 2001 15:15:16
Message: <3BC5EF4E.CFCBD22B@spiritone.com>
Mahalis wrote:

> How would I make wings on an object flap at a certain speed relative to the
> clock?
> ex:
> #declare flapSpeed=50;
> object{Wing rotate ???}

The simple solution goes something like this:
#declare min_angle = -45;
#declare max_angle = 45;
#declare center_angle = (min_angle + max_angle)/2;
#declare amplitude = abs(max_angle - center_angle);

#declare wing_angle = center_angle + cos(clock)*amplitude;

This would be a constant motion up and down, but most flapping requires a
shorter downstroke and a longer upstroke, so you can make a few adjustments:

#declare frac_clock = clock - int(clock); // The wave works between 0 and 1,
but not between 1 and 2
#declare wing_angle = center_angle + cos(pow(frac_clock,0.8))*amplitude;

This creates a slightly more realistic flapping motion. I recommend values
between 0.5 and 1. The closer to 1 you get, the smoother the flapping.

--
Josh English
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Josh English
Subject: Re: Flapping wings?
Date: 11 Oct 2001 15:21:41
Message: <3BC5F0F2.B190CE6D@spiritone.com>
Josh English wrote:

> <snip>
> #declare frac_clock = clock - int(clock); // The wave works between 0 and 1,
> but not between 1 and 2
> #declare wing_angle = center_angle + cos(pow(frac_clock,0.8))*amplitude;

Oops. This should be:
#declare wing_angle = center_angle + cos(2*pi*pow(frac_clock,0.8))*amplitude;

This of course gives you the rotation value you're looking for. Without that
2*pi bit you get a really strange motion.
Another thing I could add is that this gives one flap per second, if you want
more flaps per second change the frac_clock definition to:

#declare frac_clock = (clock*2) - int(clock*2);  // Two Flaps per second


--
Josh English
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Bill DeWitt
Subject: Re: Flapping wings?
Date: 12 Oct 2001 09:19:12
Message: <3bc6edd0@news.povray.org>
// more like this
////////////// Camera //////////////////////
camera {                                  //
        right      < -1.333, 0.0, 0.0 >   //
        up         <  0.0, 1.0, 0.0 >     //
        direction  <  0.0, 0.0, 1.0 >     //
        location   <  5.0, 5.0, 20.0 >   //
        look_at    <  0.0, 0.0, 0.0 >     //
       }                                  //
////////////// end Camera //////////////////


///////////////  Light  ////////////////
light_source { < -100.0, 100.0, 100.0 >
color rgb < 1.0, 1.0, 1.0 > }
///////////////////////////////////////
///////////////  Light  ////////////////
light_source { <  100.0, 100.0, 100.0 >
color rgb < 1.0, 1.0, 1.0 > }
///////////////////////////////////////

#declare Ydimension = 30.0;
#declare zdimension = 60.5;
 #declare flapSpeed=12;

cylinder {
  -3*x,  3*x,  0.5  pigment { rgb 2 }
  translate 3*x
      rotate <
              0,
              cos((clock*flapSpeed)*(2*pi))*Ydimension,
              sin((clock*flapSpeed)*(2*pi))*zdimension >
              }


Post a reply to this message

From: Trevor Quayle
Subject: Re: Flapping wings?
Date: 12 Oct 2001 09:28:19
Message: <3bc6eff3$1@news.povray.org>
Of course, if you leave the clock setting as is, it runs from 0 to 1 so if
you render a movie with 100 frames and then again with 200 frames, the
flapping speed in the second movie will be half that of the first, perhaps
it's better to use frame_number, to keep it consistent no matter what the
length of the animation. But it really depends on the situation.

-tgq


"Bill DeWitt" <bde### [at] cflrrcom> wrote in message
news:3bc6edd0@news.povray.org...
> // more like this
> ////////////// Camera //////////////////////
> camera {                                  //
>         right      < -1.333, 0.0, 0.0 >   //
>         up         <  0.0, 1.0, 0.0 >     //
>         direction  <  0.0, 0.0, 1.0 >     //
>         location   <  5.0, 5.0, 20.0 >   //
>         look_at    <  0.0, 0.0, 0.0 >     //
>        }                                  //
> ////////////// end Camera //////////////////
>
>
> ///////////////  Light  ////////////////
> light_source { < -100.0, 100.0, 100.0 >
> color rgb < 1.0, 1.0, 1.0 > }
> ///////////////////////////////////////
> ///////////////  Light  ////////////////
> light_source { <  100.0, 100.0, 100.0 >
> color rgb < 1.0, 1.0, 1.0 > }
> ///////////////////////////////////////
>
> #declare Ydimension = 30.0;
> #declare zdimension = 60.5;
>  #declare flapSpeed=12;
>
> cylinder {
>   -3*x,  3*x,  0.5  pigment { rgb 2 }
>   translate 3*x
>       rotate <
>               0,
>               cos((clock*flapSpeed)*(2*pi))*Ydimension,
>               sin((clock*flapSpeed)*(2*pi))*zdimension >
>               }
>
>


Post a reply to this message

From: Mahalis
Subject: Re: Flapping wings?
Date: 12 Oct 2001 10:11:49
Message: <3bc6fa25@news.povray.org>
In the end, I decided just to use semi-transparent cones to look like
blurred, flapping wings.
--
 camera{location<0,0.25,-2> look_at 0.5*y} #declare
T=texture{pigment{crackle scale 0.5 rotate 90 turbulence 0.75 color_map{[0
rgb 1][0.05 rgb 1][0.1 rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}}
finish{ambient 1}} #declare c=difference{torus{0.5,0.1
rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}  merge{object{c
translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}} #end
//Mahalis

"Trevor Quayle" <Tin### [at] hotmailcom> wrote in message
news:3bc6eff3$1@news.povray.org...
> Of course, if you leave the clock setting as is, it runs from 0 to 1 so if
> you render a movie with 100 frames and then again with 200 frames, the
> flapping speed in the second movie will be half that of the first, perhaps
> it's better to use frame_number, to keep it consistent no matter what the
> length of the animation. But it really depends on the situation.
>
> -tgq
>
>
> "Bill DeWitt" <bde### [at] cflrrcom> wrote in message
> news:3bc6edd0@news.povray.org...
> > // more like this
> > ////////////// Camera //////////////////////
> > camera {                                  //
> >         right      < -1.333, 0.0, 0.0 >   //
> >         up         <  0.0, 1.0, 0.0 >     //
> >         direction  <  0.0, 0.0, 1.0 >     //
> >         location   <  5.0, 5.0, 20.0 >   //
> >         look_at    <  0.0, 0.0, 0.0 >     //
> >        }                                  //
> > ////////////// end Camera //////////////////
> >
> >
> > ///////////////  Light  ////////////////
> > light_source { < -100.0, 100.0, 100.0 >
> > color rgb < 1.0, 1.0, 1.0 > }
> > ///////////////////////////////////////
> > ///////////////  Light  ////////////////
> > light_source { <  100.0, 100.0, 100.0 >
> > color rgb < 1.0, 1.0, 1.0 > }
> > ///////////////////////////////////////
> >
> > #declare Ydimension = 30.0;
> > #declare zdimension = 60.5;
> >  #declare flapSpeed=12;
> >
> > cylinder {
> >   -3*x,  3*x,  0.5  pigment { rgb 2 }
> >   translate 3*x
> >       rotate <
> >               0,
> >               cos((clock*flapSpeed)*(2*pi))*Ydimension,
> >               sin((clock*flapSpeed)*(2*pi))*zdimension >
> >               }
> >
> >
>
>


Post a reply to this message

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