Rendering

Rendering engine + python = cool videos

I use POV-Ray rendering to render scenes that I created using python and a POV-Ray python library. With python I can control the spheres position and color in way that I can describe in code. The positions and colors of the balls vary slowly over time to create hundreds of individual frames, which I combine into videos using python. The colors of the balls are controlled by height, density or time.

Moving dots

The idea to create videos of moving dots was based on my previous work on parametric curves and my desire to learn more python.

All of the spheres follow a parametric path, slightly faster than the previous sphere. It is simple but it can create some pretty emergent behavior.

2D waves

To create wave simulations I created a 2D array of spheres, then altered set the height of each sphere based on a wave equation of the form:

\[\\ y=A\sin(kx-\omega t) \\\]

These waves can be summed to create shaped waves using finite fourier series as shown:

Alternatively the waves can be summed to show interfere waves from different sources:

Other

I have also made other animations using assorted methods to define the spheres movements:

3D waves

The next obvious step was to upgrade to 3D waves and other patterns: Defining the waves in 3d was much more complicated as each sphere needs to move towards and away from the origin of the wave, so each sphere is moving in a unique direction, rather than just up and down. The equations I devised are:

\[x=A\frac{x_g-x_o}{d}\sin(kd-\omega t) \\ y=A\frac{y_g-y_o}{d}\sin(kd-\omega t) \\ z=A\frac{z_g-z_o}{d}\sin(kd-\omega t) \\\]

Where \((x_g,y_g,z_g)\) is the grid position of the sphere, and \((x_o,y_o,z_o)\) is the position of the wave’s origin and \(d\) is the distance between the origin of the wave and grid position of the sphere. These displacements can also be summed to simulate interference between several waves.