Morphing by rotation: A Genetic Algorithm

 

Today was a fun, fun Sunday!

Here is how to reproduce:

  • Use 2 chromosomes. The first one is a list of 3D positions (xyz float coordinates) and the second a list of colors (rgb) of the same size. I used 200 triangles.
  • I used a population size of 50, rank selection (pick the 25 most fit in each generation), coordinate- and color channel-wise mutation rate of 0.001, crossover rate of 0.7.
  • Uniform crossovers – each coordinate/color component gets an equal chance to come from parent1 or parent2.
  • Render from the front and side. I used XY and ZY coordinate pairs.
  • Compute the difference between the input image and the rendered image. To do this with OpenGL, I render two passes: one with Subtract and another with ReverseSubtract blend, then Add them together.
  • Calculate the sum of differences and use this as a fitness value.
  • Let 10K-20K generations pass.

You can also get the project (C#) on github: https://github.com/mgeorgoulopoulos/LisaGA

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s