### Present Remotely

Send the link below via email or IM

CopyPresent to your audience

Start remote presentation- Invited audience members
**will follow you**as you navigate and present - People invited to a presentation
**do not need a Prezi account** - This link expires
**10 minutes**after you close the presentation - A maximum of
**30 users**can follow your presentation - Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

### Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.

You can change this under Settings & Account at any time.

# Artificial Evolution for Computer Graphics

Basic Implementation of Karl Sims Algorithm with Pyevolve (HacDC NARG)

#### Transcript of Artificial Evolution for Computer Graphics

Artificial Evolution for Computer Graphics Karl Sims how "evolutionary techniques of variation and selection can be used to create complex simulated ... textures" Thinking Machines Corporation (1991) Graphics and Genetic Algorithm 3d Plant Structures Symbolic Expressions as Genotypes LISP Machine S-expressions +, -, *, /, mod, round, min, max, abs, expt, log, and,

or, xor, sin, cos, atan, if, dissolve, hsv-to-rgb, vector,

transform-vector, bw-noise, color-noise, warped-bw-noise,

warped-color-noise, blur, band-pass, grad-mag, grad-dir,

bump, ifs, warped-ifs, warp-abs, warp-rel, warp-by-grad.

a. X

b. Y

c. (abs X)

d. (mod X (abs Y))

e. (and X Y)

f. (bw-noise .2 2)

g. (color-noise .1 2)

h. (grad-direction (bw-noise .15 2) .0 .0)

i. (warped-color-noise (* X .2) Y .1 2)

- A random scalar value such as .4

- A random 3-element vector such as #(.42 .23 .69)

- A variable such as the X or Y pixel coordinates.

- Another lisp expression which returns a b/w or color image. Basic Images A recursive mutation scheme is used to mutate expressions. Lisp expressions are traversed as tree structures and each node is in turn subject to possible mutations. Each type of mutation occurs at different frequencies depending on the type of node:

1. Any node can mutate into a new random expression. This allows for large changes, and usually results in a fairly significant alteration of the phenotype.

2. If the node is a scalar value, it can be adjusted by the addition of some random amount. 3. If the node is a vector, it can be adjusted by adding random amounts to each element. 4. If the node is a function, it can mutate into a different function. For example (abs X) might become (cos X). If this mutation occurs, the arguments of the function are also adjusted if necessary to the correct number and types. 5. An expression can become the argument to a new random function. Other arguments are generated at random if necessary. For example X might become (* X .3). 6. An argument to a function can jump out and become the new value for that node. For example (* X .3) might become X. This is the inverse of the previous type of mutation. Finally, a node can become a copy of another node from the parent expression. For example (+ (abs X) (* Y .6)) might become (+ (abs (* Y .6)) (* Y .6)). This causes effects similar to those caused by mating an expression with itself. It allows for sub-expressions to duplicate themselves within the overall expression. 80 - 100 20 2 40

(round (log (+ y (color-grad (round (+ (abs (round (log (+ y (color-grad (round (+ y (log (invert y) 15.5)) x) 3.1 1.86 #(0.95 0.7 0.59) 1.35)) 0.19) x)) (log (invert y) 15.5)) x) 3.1 1.9 #(0.95 0.7 0.35) 1.35)) 0.19) x)

Pyevolve Bad Practice def gp_log(a): return log(a)

def gp_add(a, b): return a+b

def gp_sub(a, b): return a-b

def gp_mul(a, b): return a*b

def gp_sqrt(a): return sqrt(abs(a)) gp_mul ( gp_sqrt ( gp_makeartg ( gp_sub ( gp_makeart3 ( gp_add ( gp_makeart3 ( gp_log ( b ) )gp_invert ( gp_makeartg ( c ) ) ) )gp_add ( gp_makeartc ( gp_sub ( gp_invert ( a )gp_abssin ( c ) ) )gp_makeartd ( gp_makeart2 ( gp_makeart2 ( a ) ) ) ) ) ) )gp_cos ( gp_makeartb ( gp_makeartc ( gp_makeartc ( gp_makeartf ( gp_makeart3 ( gp_abssin ( a ) ) ) ) ) ) ) ) Judge each image Mutation + Mating Haven't make interface PIL

Full transcriptor, xor, sin, cos, atan, if, dissolve, hsv-to-rgb, vector,

transform-vector, bw-noise, color-noise, warped-bw-noise,

warped-color-noise, blur, band-pass, grad-mag, grad-dir,

bump, ifs, warped-ifs, warp-abs, warp-rel, warp-by-grad.

a. X

b. Y

c. (abs X)

d. (mod X (abs Y))

e. (and X Y)

f. (bw-noise .2 2)

g. (color-noise .1 2)

h. (grad-direction (bw-noise .15 2) .0 .0)

i. (warped-color-noise (* X .2) Y .1 2)

- A random scalar value such as .4

- A random 3-element vector such as #(.42 .23 .69)

- A variable such as the X or Y pixel coordinates.

- Another lisp expression which returns a b/w or color image. Basic Images A recursive mutation scheme is used to mutate expressions. Lisp expressions are traversed as tree structures and each node is in turn subject to possible mutations. Each type of mutation occurs at different frequencies depending on the type of node:

1. Any node can mutate into a new random expression. This allows for large changes, and usually results in a fairly significant alteration of the phenotype.

2. If the node is a scalar value, it can be adjusted by the addition of some random amount. 3. If the node is a vector, it can be adjusted by adding random amounts to each element. 4. If the node is a function, it can mutate into a different function. For example (abs X) might become (cos X). If this mutation occurs, the arguments of the function are also adjusted if necessary to the correct number and types. 5. An expression can become the argument to a new random function. Other arguments are generated at random if necessary. For example X might become (* X .3). 6. An argument to a function can jump out and become the new value for that node. For example (* X .3) might become X. This is the inverse of the previous type of mutation. Finally, a node can become a copy of another node from the parent expression. For example (+ (abs X) (* Y .6)) might become (+ (abs (* Y .6)) (* Y .6)). This causes effects similar to those caused by mating an expression with itself. It allows for sub-expressions to duplicate themselves within the overall expression. 80 - 100 20 2 40

(round (log (+ y (color-grad (round (+ (abs (round (log (+ y (color-grad (round (+ y (log (invert y) 15.5)) x) 3.1 1.86 #(0.95 0.7 0.59) 1.35)) 0.19) x)) (log (invert y) 15.5)) x) 3.1 1.9 #(0.95 0.7 0.35) 1.35)) 0.19) x)

Pyevolve Bad Practice def gp_log(a): return log(a)

def gp_add(a, b): return a+b

def gp_sub(a, b): return a-b

def gp_mul(a, b): return a*b

def gp_sqrt(a): return sqrt(abs(a)) gp_mul ( gp_sqrt ( gp_makeartg ( gp_sub ( gp_makeart3 ( gp_add ( gp_makeart3 ( gp_log ( b ) )gp_invert ( gp_makeartg ( c ) ) ) )gp_add ( gp_makeartc ( gp_sub ( gp_invert ( a )gp_abssin ( c ) ) )gp_makeartd ( gp_makeart2 ( gp_makeart2 ( a ) ) ) ) ) ) )gp_cos ( gp_makeartb ( gp_makeartc ( gp_makeartc ( gp_makeartf ( gp_makeart3 ( gp_abssin ( a ) ) ) ) ) ) ) ) Judge each image Mutation + Mating Haven't make interface PIL