# Raytracing

## Mechanics simulation experiments

In May/June 2002 i started some experiments simulating mechanical systems in POV-Ray. Here you can find a selection of animations i made during those experiments.

### basic movement

 The first tests used simple a simple forward euler integration method. Collisions with the environment are calculated with impact formulas. The first animation on the right shows such a system with a single point mass moving under the influence of gravity. Energy loss during collisions is modeled as a multiplier for the speed <1 for every collision occurring. Animation 1: single ball (mpeg, 240x180, 380k) I then added collision detection between multiple moving balls. In contrast to the environment collisions these are modeled though elasticities from the beginning on. Later i also implemented elasticity based environment collisions. The animation on the right shows 16 balls with different radii interacting in such a simulation. Animation 2: multiple balls (mpeg, 320x240, 449k)

### more complex objects

 Next i started implementing connections between the masses. With these simulating more complex structures is possible without much extending the simulation system. Friction turned out to be a critical aspect with such systems. In addition much more integration steps were necessary for the relatively stiff connections. The animation shows two small cubes, each made of 8 masses connected at the edges and the face diagonals. Animation 3: small cubes (mpeg, 320x240, 623k) More complex geometries turned out to be very slow when simulated in POV-SDL. Here you can see a relatively soft larger cube deforming when hitting the ground. In addition to the elasticity also damping is simulated for the connections now. Animation 4: deforming larger cube (mpeg, 320x240, 249k) The environment collisions are meanwhile also modeled as elasticities. This is achieved with help of the IsoCSG library and the vGradient() macro from POV-Ray 3.5 math.inc for calculating the gradient of the environment function. This way arbitrarily complex geometries can be used for the environment. This animation shows a cube similar to the last one, but with solid faces and a more complex environment to interact with. Animation 5: solid cube interacting with more complex environment (mpeg, 320x240, 376k)

There are many possible geometries that can be simulated with such a system of masses connected through elasticities, here are a few more examples:

### water interaction

I also made some tests with water interaction using a very simple yet effective method for generating water waves described in:

This method of course has it's limitations, especially when the waves are stronger. The following 2 animations show some of these problems.

Some further discussion of some of these simulations can be found on the povray.org newsserver:

Subject: balls simulation (665k)
Date: Mon, 13 May 2002 00:09:01 +0200
Newsgroups: povray.binaries.animations
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3CDEE7FD.B2EA955@gmx.de
http://news.povray.org/3CDEE7FD.B2EA955@gmx.de

Subject: ball simulation 2 (2x500k)
Date: Wed, 15 May 2002 18:51:08 +0200
Newsgroups: povray.binaries.animations
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3CE291FC.E1C0909C@gmx.de
http://news.povray.org/3CE291FC.E1C0909C@gmx.de

Subject: Balls connected (377+500k)
Date: Thu, 30 May 2002 13:46:19 +0200
Newsgroups: povray.binaries.animations
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3CF6110B.FF7822E7@gmx.de
http://news.povray.org/3CF6110B.FF7822E7@gmx.de

Subject: balls 4x4x4 grid (249+198k)
Date: Sun, 02 Jun 2002 11:40:02 +0200
Newsgroups: povray.binaries.animations
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3CF9E7F2.777F427@gmx.de
http://news.povray.org/3CF9E7F2.777F427@gmx.de

Subject: More Balls (623+376k)
Date: Wed, 05 Jun 2002 12:13:54 +0200
Newsgroups: povray.binaries.animations
From: Christoph Hormann <chris_hormann@gmx.de>