POV-Ray : Newsgroups : povray.animations : skeletal animation using POV-RAY : Re: skeletal animation using POV-RAY Server Time
17 May 2024 04:30:00 EDT (-0400)
  Re: skeletal animation using POV-RAY  
From: melo
Date: 6 Feb 2008 19:35:00
Message: <web.47aa51553df0d7073c0d56f20@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "melo" <mel### [at] coxnet> wrote in message
> news:web.47a94d403df0d7073c0d56f20@news.povray.org...
> > "Chris B" <nom### [at] nomailcom> wrote:
> >>
> >> What you really want to get to is something like:
> >> l_hip_ctl = LeftHipFromPreviousStage + <-21*IBP, 0, 0>
> >> One hack would be to effectively accumulate the rotations.
> >
> > well,  not all rotations go up and up, for accumulations to work.
>
> You can accumulate any mix of positive and negative rotations.
>

Well, I was so excited that I might find a solution, I started implementing the
array approach right away with slight modifications and simplist approach that
came to mind.  Even with that I managed to shut myself in the foot:

1. Declared the array as a 2d array
  #declare AVAR = array[23][23];
                         //  first dim is for Key-Frame id, goes by odd numbers
                         //  1..23, second is for Animation control variables
                         //  whose indeces are defines as
  #declare HumanoidRoot_ind = 1;
  #declare neck_ind = 2;
  #declare lower_back_ind = 3;
  #declare l_hip_ind = 4; //
  #declare l_knee_ind = 5; //
  .. snip goes all the way to index 23

2. Initialized its element to be all 0 rotation vectors
#declare Frame = 1;
#while ( Frame < 23 )
   #declare AVarIndex = 1;
   #while ( AVarIndex < 23 )
      #declare AVAR[Frame][AVarIndex] = <0, 0, 0>;
      #declare AVarIndex = AVarIndex + 1;
   #end
   #if ( Frame = 5 | Frame = 6 | Frame = 17 | Frame = 18 )
      #declare Frame = Frame + 1;
   #else
      #declare Frame = Frame + 2;
#end


3. Changed my code in my Range stmts to something like, to simulate simplest
linear interpolation

   #range( 2.0, 3.0 )
      //== FRAME 5 page 113 in Caharacter Animation
      #declare Frame = 5;
      #declare IBP = clock - 2.0;  // In-Between Position counter
      #declare Action = 1.15; // "Stride.Left.Frame5
      // Now create linear combinations of joint locations from prev key-frame
      // and current key frame.  Contribution from prev key-frame linearly
      // disappears from 1 ->0, while current pose's contribution
      // increases    from 0 -> 1. I WANT SOMETHING BETTER!!
      #declare AVAR[Frame][l_hip_ind] = AVAR[Frame-1][l_hip_ind]*(1-IBP)  +
            <-25, 0, 0>*IBP; // Target: <-25*IBP, 0, 0>;
      #declare AVAR[Frame][l_knee_ind] = AVAR[Frame-1][l_knee_ind]*(1-IBP) +
      <25, 0, 0>*IBP;  // Target: <25*IBP, 0, 0>;
      // Some poses are the same between this frame and prev frame.  So, just
      // define it.
      #declare AVAR[Frame][l_ankle_ind] =  <0, 0, 0>;
      #declare AVAR[Frame][lower_back_ind] = <-10, 0, 0>;
      #declare AVAR[Frame][HumanoidRoot_ind] = <10, -60, 0>;

      #declare Human_Trans_1_1_05 =
      transform {
         //scale 5 // <5, 5, 5>
         translate l_step_size*clock*z
         //rotate <10*IBP, -60, 0>
         };

      Move_Humanoid( Frame, Action )
      #declare Humanoid_1_1_05 = Humanoid;  // make a copy with transformations
                                            // for Stride.Left.Frame5 move
      object{ Humanoid_1_1_05 transform Human_Trans_1_1_05 }
   #break

4. I changed rotation specification in Move_Humanoid( Frame, Action )
macro to something like:
      #if ( VZero( AVAR[Frame][l_hip_ind] ) )
      #else
         Rotate_Around_Trans( AVAR[Frame][l_hip_ind], JOC_l_hip )
         //Rotate_Around_Trans( l_hip_ind, vtransform( JOC_l_hip, Human_Trans )
)
      #end

Well, I have not finished making all the changes to see if he moves smoother.

AND, As oppesed to linearly switching between previous and current poses in each
of my animation stages, I would appreciate your input as to what worked the best
..  In initial frame of the current stage, just repeat the last pose of the
previous stage?  Then use some trig funtion to move into current pose?

My Key-Frame counter corresponds to Animation Stage each of which have a target
pose.

I hope to reduce the number of key-frames I am defining and come up with a
better interpolation methodology.  Since you have been at skeletal animation
far longer, I would value your input there.

I'll report on how this approach goes..

Is there some info on how I can get POV-RAY dump the values of all variables
declared whenever it reports an error during rendering, and I have on darn clue
as to what I might have done wrong.  That is how to debug ones' code with
POV-RAY.

WOW, you have started playing with muscles.  Once skeletal animation is done, I
need to map it to muscular animation.  See in human beings joint rotations
happen to be the end result of muscle contractions.  That step would be what
will be needed for movement studies in vertabrates.

I love to write/chat with you how you were able to get muscles manipulated.

Thanks,

Meltem


> >> // Initialise all variable
> >> #declare l_hip_ctl = 0;
> >
> > Did you mean
> >  #declare l_hip_ctl = <0,0,0>;
> > or is POV-RAY more variable type neutral?
>
> It's not quite neutral, but it does promote floats to vectors if it needs
> to.
>

So good to learn short cuts.

> > I hear you.  It makes perfect sense.  Now let me make an uneducated guess,
> > what
> > if we played with clock so it does not advance linearly.  Say, I like to
> > raise
> > my right arm:
> >   #declare myClock = a*clock*clock + b*clock + c;
> >   r_shoulder_ctl = <180*myClock, 0, 0>
>
> That is the sort of thing, though I've found trigonometrical functions like
> the sine function are often more handy than quadratics for smoothing out the
> start and end of movements.
>
> > My gosh you got facial expressions, hair, clothing items all added to your
> > PovPerson?  I guess with face skeletal animation does not work?  Jaw is
> > the
> > only movable joint, while there are numerous muscles moving facial organs,
> > generating expressions?!
>
> Indeed! Skeletal animation is just the first step. Muscle deformation comes
> next. I started work on deforming the upper and lower eyelid meshes as they
> opened and closed and had started splitting out the mesh around the mouth to
> implement something like the lipsync macro that Rune
> (http://runevision.com/3d/anims/) developed. I also have a deformable mesh
> for each finger segment, but never got round to integrating my muscular
> finger code back into the main deck of POV-Person SDL.
>
> > I hope there is doc with POVPerson, could it be used in research?
> > Could it be used in story telling?
>
> There is documentation on the web site. I also have further documentation
> for bits I developed since V2. I think there are many things it could be
> used for. The SDL and the documentation is licensed to encourage reuse.

Could you define what you mean by licensing here?

I will start playing with POVPerson, see what I can do with it, not before I get
my person moving.  The learning curve has been steep, exponential even, but hey
I like to think/hope I learned better by doing it myself than trying to get
someone else's code working for my purposes.

Thank you Chris,


Meltem
Laguna Beach, CA USA

>
> Regards,
> Chris B.


Post a reply to this message

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