how to render motion of a 3d rigid object using povray

340 Views Asked by At

I run a rigid body simulation of a few objects, and I want to render this simulation using povray.

The objects' meshes stay the same, all that changes is the location and orientation of each object. What is the best way to iteratively generate the images for the movie in povray? I could just write an entire pov file in each iteration and then send them all to povray, but as each mesh is very large, I would like to have to write it only once. Is it possible?

And if there is a better way to do this, please tell me...

2

There are 2 best solutions below

3
On

Write the mesh into an inc file using a #define and giving it a name. In your main .pov file, you should be able to define arrays or splines containing the rotations and translations then use the clock variable to index into it and render an animation.

0
On

Here's a way to flesh out David Buck's advice, with a single .pov file, rendered as an animation.

#include "transforms.inc"
#declare myOriginalObj = /* you do the work here, with mesh aligned to "y axis"*/
#declare newDirection =  /* you do the work here: make new alignment vector,
     as a function of clock  */
#declare newPosition =   /*you do the work here: create vector for new position,
     as a function of clock  */
#declare newObj=object{
    myOriginalObj
    Reorient_Trans(y,newDirection)
    translate newPosition
    }
object{newObj}

further reading: http://povray.tashcorp.net/tutorials/dd_makesnow/