gpu based math image synthesis

Generating images via the evaluation of a complex mathematical function in the cartesian plane has been done to death, see e.g., Karl Sims’ Genetic Images. But with the explosion of GPU based computing we can now rapidly explore these spaces. I whipped up a short program that does this. The basic procedure is:

  • Construct a string defining the function, for example:

“pow(p.y*9.5*p.y/p.x/p.y,acos(sqrt(p.x*p.x + p.y*p.y)))”

  • insert this into a function within a fragment program;
  • compile and use the program;
  • draw a rectangle covering the screen so that each fragment is fired.

The image generation is practically instantaneous. In my implementation I randomly generate functions as a key is pressed so you can quickly get a glimpse at the possibilities.

I also attempted an implementation in PixelBender, however as you cannot compile shader code at runtime the above method does not work. I began work on a general shader that reads in the function information (encoded in an image) and evaluates it at runtime, however I became stuck upon realising that recursive function calls are not possible and hence a manual stack has to be implemented. Gah.


SDS3 First Prototype

It’s been just over a year now since the idea of a volumetric developmental system coupled with physical simulation (the Simplicial Developmental System) became the focus of my PhD. Since then I have built a 2d prototype and have been working out the theory and implementation details for a usable 3d version. I still have much more work to go trying to get something interesting done by January, but here is a sneak preview of the system I’ve been building.