POV-Ray : Newsgroups : povray.animations : best to animate simple moving meshes Server Time: 25 Jun 2019 19:40:32 GMT
  best to animate simple moving meshes (Message 1 to 7 of 7)  
From: noam
Subject: best to animate simple moving meshes
Date: 16 May 2012 20:55:00
Message: <web.4fb413dcb833ef0692f3bd070@news.povray.org>
Hi Guys,
I am new to the povray community, and after reading the manual I am still not
sure what's the best way to achieve my goal:

I have a simulation written in c++ in which I simulate rigid bodies moving. In
each time step each body's position and orientation change.
I want to render my simulation using POV-Ray. What is the correct way? I can
output a pov file for each frame and then render each pov file and make an
animation.
However, as the meshes are rather large and do not change between frames (only
their orientation and position change), I hope there's a simpler way to just
write the mesh once and then reference it when producing the animation.

What is the best way to achieve my goal?


Post a reply to this message

From: clipka
Subject: Re: best to animate simple moving meshes
Date: 16 May 2012 23:07:30
Message: <4fb43332$1@news.povray.org>
Am 16.05.2012 22:53, schrieb noam:
> Hi Guys,
> I am new to the povray community, and after reading the manual I am still not
> sure what's the best way to achieve my goal:
>
> I have a simulation written in c++ in which I simulate rigid bodies moving. In
> each time step each body's position and orientation change.
> I want to render my simulation using POV-Ray. What is the correct way? I can
> output a pov file for each frame and then render each pov file and make an
> animation.
> However, as the meshes are rather large and do not change between frames (only
> their orientation and position change), I hope there's a simpler way to just
> write the mesh once and then reference it when producing the animation.
>
> What is the best way to achieve my goal?

You can generate one include file (see "#include") for the shapes, 
another one specifying their locations for each frame, and tie 
everything together in a manually created .pov file.


Post a reply to this message

From: noam
Subject: Re: best to animate simple moving meshes
Date: 17 May 2012 07:45:00
Message: <web.4fb4ac639fbc2e8e92f3bd070@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 16.05.2012 22:53, schrieb noam:
> > Hi Guys,
> > I am new to the povray community, and after reading the manual I am still not
> > sure what's the best way to achieve my goal:
> >
> > I have a simulation written in c++ in which I simulate rigid bodies moving. In
> > each time step each body's position and orientation change.
> > I want to render my simulation using POV-Ray. What is the correct way? I can
> > output a pov file for each frame and then render each pov file and make an
> > animation.
> > However, as the meshes are rather large and do not change between frames (only
> > their orientation and position change), I hope there's a simpler way to just
> > write the mesh once and then reference it when producing the animation.
> >
> > What is the best way to achieve my goal?
>
> You can generate one include file (see "#include") for the shapes,
> another one specifying their locations for each frame, and tie
> everything together in a manually created .pov file.

Thanks! That solves almost everything, but how would I create an array for the
orientation matrices (I assume I would to create an array of matrices and then
index through it using 'clock')?


Post a reply to this message

From: Christian Froeschlin
Subject: Re: best to animate simple moving meshes
Date: 17 May 2012 14:02:07
Message: <4fb504df$1@news.povray.org>
noam wrote:

> Thanks! That solves almost everything, but how would I create an array for the
> orientation matrices (I assume I would to create an array of matrices and then
> index through it using 'clock')?

If you just want to apply transformations to your object you can
create an array such as

#declare TRANSFORMS = array[42];

#declare TRANSFORMS[0] = transform {rotate 90*x translate 5*z};
#declare TRANSFORMS[1] = ...
...

and use it like this

object
{
   ...
   transform {TRANSFORMS[i]}
}

Of course you can also use a twodimensional array (or multiple
arrays) to holds the individual rotation and translation parameters
or matrix elements.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: best to animate simple moving meshes
Date: 17 May 2012 14:13:03
Message: <4fb5076f$1@news.povray.org>
Christian Froeschlin wrote:

> #declare TRANSFORMS = array[42];

actually, since you have multiple objects you probably want
this to be something like

#declare TRANSFORMS = array[NUM_OBJ][NUM_TRANSFORMATIONS];

// Object 0
#declare TRANSFORMS[0][0] = transform {rotate 90*x translate 5*z};
#declare TRANSFORMS[0][1] = ...

// Object 1
#declare TRANSFORMS[1][0] = transform {rotate 40*x translate 5*z};
#declare TRANSFORMS[1][1] = ...

And in your shapes include file

#declare SHAPES = array[NUM_OBJ];

#declare SHAPES[0] = mesh {...}
#declare SHAPES[1] = mesh {...}
...

and use it as

#declare FRAME = <transformation index from "clock" or "frame_number">

#declare I = 0;

#while (I < NUM_OBJ)
   object
   {
     SHAPES[I]
     transform {TRANSFORMS[I][FRAME]}
   }
   #declare I = I + 1;
#end


Post a reply to this message

From: Warp
Subject: Re: best to animate simple moving meshes
Date: 18 May 2012 13:53:09
Message: <4fb65445@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Christian Froeschlin wrote:

> > #declare TRANSFORMS = array[42];

> actually, since you have multiple objects you probably want
> this to be something like

> #declare TRANSFORMS = array[NUM_OBJ][NUM_TRANSFORMATIONS];

> // Object 0
> #declare TRANSFORMS[0][0] = transform {rotate 90*x translate 5*z};
> #declare TRANSFORMS[0][1] = ...

> // Object 1
> #declare TRANSFORMS[1][0] = transform {rotate 40*x translate 5*z};
> #declare TRANSFORMS[1][1] = ...

  I think you can make it more concise:

#declare TRANSFORMS = array[NUM_OBJ][NUM_TRANSFORMATIONS]
{ { transform {rotate 90*x translate 5*z},
    transform {rotate 90*x translate 5*z},
    ...
  },
  { transform {rotate 90*x translate 5*z},
    transform {rotate 90*x translate 5*z},
    ...
  },
  ...
};

-- 
                                                          - Warp


Post a reply to this message

From: noam
Subject: Re: best to animate simple moving meshes
Date: 20 May 2012 16:00:01
Message: <web.4fb913fa9fbc2e8e34c116050@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Christian Froeschlin <chr### [at] chrfrde> wrote:
> > Christian Froeschlin wrote:
>
> > > #declare TRANSFORMS = array[42];
>
> > actually, since you have multiple objects you probably want
> > this to be something like
>
> > #declare TRANSFORMS = array[NUM_OBJ][NUM_TRANSFORMATIONS];
>
> > // Object 0
> > #declare TRANSFORMS[0][0] = transform {rotate 90*x translate 5*z};
> > #declare TRANSFORMS[0][1] = ...
>
> > // Object 1
> > #declare TRANSFORMS[1][0] = transform {rotate 40*x translate 5*z};
> > #declare TRANSFORMS[1][1] = ...
>
>   I think you can make it more concise:
>
> #declare TRANSFORMS = array[NUM_OBJ][NUM_TRANSFORMATIONS]
> { { transform {rotate 90*x translate 5*z},
>     transform {rotate 90*x translate 5*z},
>     ...
>   },
>   { transform {rotate 90*x translate 5*z},
>     transform {rotate 90*x translate 5*z},
>     ...
>   },
>   ...
> };
>
> --
>                                                           - Warp

Thanks guys! I used something in the general notion of what you did.


Post a reply to this message

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