What you are describing is called "Physically Based Modeling".  It could be implemented as a separate program from POV-Ray that could produce POV-Ray files.  It's also possible (I suppose) to integrate it into POV-Ray directly.

To do it, you need something called a "Numerical Differential Equation Solver".  This is a software package that can take the initial positions and velocities of the various objects and step them forward in time.  The simplest kind of differential equation solver is called Euler's method:

   1) Calculate the forces based on the current positions of all objects
   2) Calculate the accelerations using   a = F/m
   3) Calculate the new velocities using    vNew = vOld + (a * tDelta)     where tDelta is the time step size
   4) Calculate the new positions using    pNew = pOld + (vNew * tDelta)
   5) Repeat from step 1

Unfortunately, this technique suffers from numerical instabilities unless all the forces are "soft and squishy".  A better technique is called Adaptive 4th Order Runge Kutta.  It's not that hard to implement, but it's beyond the scope of what I can describe here.

Complications:
   1) Rigid objects that can rotate require you to model the orientation, angular momentum, and torques.  This are more complicated.
   2) Collisions are hard in general - especially if you have objects that are in continuous contact.
   3) Many of POV-Ray's shapes cause problems for a physics modeling system. What's the mass of an infinite plane? How do you calculate the inertia tensor of a quadric surface?  These are hard problems.
   4) To do physical modeling of many of the objects, you'd have to break them into polygon meshes

(PLUG:) You may be interested in looking at ElastoLab - a 2D physics simulator I wrote.  You can download it from www.simberon.com.  If you wish, I can answer questions offline.  Email me at david@simberon.com.

David Buck
Simberon Inc.

yogesh_c wrote:

I am new to the message board thing, so I apologize if this message doesn't come across properly.

I am interested in receiving any and all critiques of an idea I have about an extension of POV-Ray's ability to animate.  Since I don't really know how to program, and I have very little sense of how POV-Ray actually works, it may be a really stupid idea--I just don't know enough to be able to say.  Even if it is, I would appreciate hearing that so I can put the idea to bed.

My idea has three parts:

    1.  What if the program could take information not only about the surfaces and textures of ray traced objects, but also about their physical characteristics.  Things such as mass, stiffness, co-efficient of friction, viscosity, etc.

    2.  What if it could also process information about forces acting on objects.  This type of information could include global settings such as gravity, or wind (could this be modeled using texture map patterns?), as well as local forces acting on specific objects.  It might do two things with this information: first, it might set up motion vectors for objects based on the information given in the properties statements (see 1, above), and, second, it might deform objects based on the same information

    3.  Finally, what if POV could process motion vectors  and deformations from the reactions and interactions of specific groups of objects (specified by the user) and calculate new sets of deformations and vectors based on these new sets of data.  I mean by this that POV would be able to calculate the interaction of specified objects, allowing them to bounce off each other, or roll along, or otherwise interact, or deform each other according to the individual properties of the objects.  I don't know if the program could use its ability to "see" surfaces by shooting rays in order to check for these interactions between specified objects in a scene, but that is my initial thought.

In creating an animation, then, one would specify global and object properties, specify forces at play in the scene, and let the program do the rest of the work in calculating the motion, deformation and events in the scene over the length of the animation in question.

One of the things that I like about this idea is that it would make many types of impressive animation fairly simple to pull off.  A ball rolling down a height field, or a foot stepping into wet sand might become basic animation sequences, rather than the results of hard labor and much skill.  I can imagine POV even pulling off complex animation such as an object floating on the surface of the ocean, reacting realistically to the forces at work, or the motion of wind in the leaves of a tree, some time in the near future, when computers get fast enough and large enough to handle this kind of complexity.

Another thing I like about it is that it seems to me like a simple extension of the way in which POV-Ray currently works (conceptually, I mean--making POV-Ray do this might be an entirely different story).  My idea is that POV would simply get the ability to store Physical Properties in the same way that it stores textures, and that it would work with those and the forces at play in any animation to create "photo realisitc" types of motion in its function as generator of animation, just as it creates "photo realistic" images from its scene parser and renderer.

Thank you for any comments you have about this idea.  I will be grateful for anything you could say either to squelch it, express interest or boredom with it, or improve it in any way.

my e-mail address is: ericfisher@wans.net

Thanks again for any replies,

Eric Fisher