Greebler

“Greebles” are those thousands and thousands of little tiny details you’ve seen on the surface of spaceships in science fiction movies.  Think of the star destroyers from Star Wars — all those tiny grey dohickeys all over the ship are called “greebles.”

I’m interested in generating greeble-like textures not because I want to model spaceships (though I suppose that could be fun) but because the idea of variegated and detailed 3-D surfaces appeals to me as the procedural equivalent of a bas-relief.  My first attempt at executing this used Cinder and OpenGL, but I found that the images I was able to render didn’t include a very essential property of greebling or bas-relief: self-shadowing.  Without pieces of the structure casting shadows on other pieces of the structure, the surface looks dull and lifeless.  It’s possible to create shadow maps in OpenGL, but the way a basic shadow map works is that you have a distinct shadow-casting object and a surface being shadowed.  With the kind of complex surfaces I was planning to model, almost every object would be both shadowed and shadowing another object.  So, rather than diving even deeper into advanced types of shadow maps and/or shadow volumes, I just ditched OpenGL and turned to POV-Ray.

POV-Ray turned out to be perfect for this.  The syntax is simple and the usage is easy: in your text file, you just describe the objects in your scene, cameras, lights, etc., and compile it.  Here is the result of my first attempt at an autogreebling algorithm:

The algorithm is recursive: basically there’s a function that takes as input a rectangular area on the x-y plane specified in terms of left, right, top, and bottom edges.  This function extrudes a box of that area in the z direction and then subdivides randomly into 4 smaller areas, and then recursively calls itself.  When the area of a box gets small enough, the base case is reached and the recursion stops.

I’m hoping to do more with this technique.

Fan

I’ve been experimenting with a “low-alpha buildup” technique.  The idea is to draw simple visual elements (e.g. lines, points) over and over at a very low alpha value (below 0.05, i.e. almost invisible) according to some parametric function of t (time), and don’t “erase” anything by repainting the background color.  The idea is that over time, there will be a slow buildup of color at various points determined by the function.  In effect, this technique seems similar to what an illustrator does with a pencil where they gradually build up color or texture by drawing lightly over the same areas again and again.

Here’s an example I’m calling “fan.”  The algorithm works like this: it draws white bezier curves over and over at low alpha, oscillating the locations of the control points and anchor points along four equally-spaced lines that fan out from the top of the image to the bottom.  From left to right, the lines are:

  1. Anchor point, varies by c1 * sin(t)
  2. Control point, varies by c2 * cos(t)
  3. Control point, varies by c3 * sin(t)
  4. Anchor poiint, varies by c4 * cos(t)

The image below was produced when c1 = c4 = 1.2 and c2 = c3 = 0.1, with a timestep of π/128

Fan

Fan