Saturday, December 7, 2013

What's Next

I intend to create more images. The images will be used to create and falsify a fruit that I "like" and want to know more about. The images will be used to create a performance piece. I will keep track of the reaction that people have. I will most likely use Facebook as my method of delivery. It is the least odd and least suspicious way of getting people's reactions.

Generative Art Final Journal

Saturday 16 - I worked on using Python inside Maya to determine whether or not a point (location of a boid) was inside or out side a volume defined by geometry. This would allow for me to shape the flock by applying a "field" that they "instinctively" would rather be inside.

      import maya.cmds as cmd
import maya.OpenMaya as om cmd.polySphere() cmd.rename("pSphere1", "globe")
def test_if_inside_mesh(point=(0.0, 0.0, 0.0), dir=(0.0, 0.0, 1.0)): sel = om.MSelectionList() dag = om.MDagPath()
#replace torus with arbitrary shape name sel.add("globe") sel.getDagPath(0,dag)
mesh = om.MFnMesh(dag)
point = om.MFloatPoint(*point) dir = om.MFloatVector(*dir) farray = om.MFloatPointArray()
mesh.allIntersections( point, dir, None, None, False, om.MSpace.kWorld, 10000, False, None, # replace none with a mesh look up accelerator if needed False, farray, None, None, None, None, None ) return farray.length()%2 == 1
#test print test_if_inside_mesh() print test_if_inside_mesh((1,0,0))

Sunday 17 - continued work on my flocking code. I spent a lot of time searching for a method to update the system inside Maya rather than coding it outside and interacting with an external program. This would not work as the amount of information that Maya was trying to process was too great. Hitting this roadblock I explored ideas of alternatives to the Bird as a Boid model. One of the designs had a flock of black and red pens hunting a white piece of paper eventually succeeding in "capturing it" but by this point it is crumpled, wrinkled, torn and no longer usable. I began working on a model for the pen and textured and rigged it. It has 3 points of articulation .
Wednesday 27 - I hit a road block on the flocking system and decided to proceed with working on creating a procedural environment. I started b looking at fractal designs. I came across fractal flowers and decided that that would be a good starting point due to the large amount of them.  Along the way I remembered the multitude of plants that use the Fibonacci spiral that we discussed in class. After some research I came up with the following basis for a single spiral
 
PI = 22/7 spirals = 6 limit_radius = 144 theta = 0 theta_increase = 15 fib_a = 0 fib_b = 1 fib_c = 0
for fib_a in range(0, 15): fib_c=fib_a+fib_b; fib_a=fib_b fib_b=fib_c
sphere_radius = fib_c r = fib_c * 3 x = r * math.cos(math.radians(theta)) z = r * math.sin(math.radians(theta)) y = r cmd.duplicate( name = 'base') #r = sphere_radius, h = -r/2, sx = 10, sy = 10) cmd.move(x, y, z) cmd.rotate(45, (-theta - 90) , 0) cmd.scale(sphere_radius/2, sphere_radius/2, sphere_radius/2) theta += theta_increase


The code was changed from this however the basis is there. name 'base' refers to the object that is being called recursively. This base curve is repeated and rotated by 45 degrees for a total of 8 spirals. This new object is defined as base.

Friday 29 - started running into memory issues again I am going to focus on perfecting the plant creation for the final. This memory issue I understand when the code is run to the 3 power it creates approximately 3 million polygons. This is usable however I need to run the code to 4th power to get the detail level that I want maybe more. I will try to create a normal map for a 1st power base that has within it greater levels of detail that I can use to supplement the additional polygon count.




Saturday 30 - Today I worked on choosing an appropriate texture for the color of the plant I am currently going with a tone modulated version of subsurface scattering
Sunday 1 Set the final Render up with depth of field to emulate a macroscopic

Friday, November 15, 2013

Progress one

Today I worked on my flocking simulation implementation in Python

I also worked on testing each member of the flock's position relative to a no geometric/ non mathematical volume. In essence I cast rays from each member of the flock in the test function to determine the number of times it crosses the surface of the volume. If the total number of times the ray crosses the boundary is even. then the point exists outside of the volume if it exists inside the volume it will pass through the volume an odd number of times

Will update with reens

Wednesday, October 23, 2013

Chaotic Systems Project

I decided to make a rigid body system mimicking a double pendulum. The system uses a combination of rigid body physics and Spline IK's for easy control. My intended method of display is prints. I am currently trying to elaborate the system by introducing particle emission or size changes based on velocity. I used the basic relationship set forth in the Lagrangian definition of a double pendulum.

Wednesday, October 2, 2013

Project Re Proposal: genetic system

Walking into a display space a illuminated table-monitor lights up. The table is the only source
of light in the room. everything has a matte black surface. The screen starts moving. On it two swarms of red and blue lights swarm around , dancing through each other growing and blinking out.


My project uses netlogo to track the technological advancement of to rival militant factions.




It uses a multi agent flocking paradigm and predator prey relationship to force and evolutionary arms race weeding out weaker ship "designs" forcing them to become stronger and stronger.


(UPDATE) After receiving input from the class I have made shrunk the scenario some more. The relationship is now closer to a predator prey relationship. The blue side hunts the red side. The red side has shields the blue side has ramming strength. as either of these values goes up the speed of the ship goes down.  The ships get to a point where they find a semi stable balance between speed health and ramming strength. This replaces the massive arms race in the original system.

The point of the installation is to

Monday, September 23, 2013

Idea Genetic System









On the two side of the grand canyon there are two different species of squirl. The Kaibab and the Abert.  5 million years ago they had the same ancestor. After the river created a canyon, the species could no longer get across to mix genes. Speciation occurred as a result of differing environmental conditions. What this means is that the squirls are now two distinct species that are incapable of interbreeding.

I aim to create a genetic system for modifying a series of physical size attributes in a 3d theoretical origin species. After running a fitness function to cull the population the remaining "successful" organisms will breed refill the population and repeat.

The fitness function is based on proximity to an individual whose phenotypes are perfectly proportioned to the phenotypes displayed at other points on the body.

I want to introduce a component of the breeding function that will cause the population to diverge if breeding partners are too far apart. At that point there are then two separate species following divergent evolutionary paths producing drastically different phenotypes




Genetic Algorithm Manipulation in Maya

//Genetic Algorithm structure
/*main()
    AllocateMemory()
    DoRun()
        Spawn()
       
        Loop()
            PrintGeneration()
            FitnessFunction()
                KillOffLower50()
            Breed()
                SelectOrganism()
           
*/
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;

int main(){
    int finalGeneration;
   
    AllocateMemory();
    finalGeneration = DoRun();
    printf("The final generation was: %d\n", finalGeneration);
    phenoOut();
    }
#define GENE_POOL 100
#define GENE_COUNT 4

char **currentGen, **nextGen,; //globals
char *modelOrganism;
int *organismFitness;

void AllocateMemory(void){
    int organism;
   
    currentGen =
        (char**)malloc(sizeof(char*) * GENE_POOL);
    nextGen =
        (char**)malloc(sizeof(char*) * GENE_POOL);
    modelOrganism =
        (char*)malloc(sizeof(char) * gene_count);
    organismFitness =
        (int*)malloc(sizeof(int) * GENE_POOL);
       
    for(organism = 0; organism<GENE_POOL; ++organism){
        currentGen[organism] =
            (char*)malloc(sizeofchar) * GENE_COUNT);
        nextGen[organism] =
            (char*)malloc(sizeofchar) * GENE_COUNT);
        }
    }
#define FALSE 0
#define TRUE 1

int DoRun(void){
    int generations=1;
    int perfectGen = FALSE;
   
    InitialOrganisms();
   
    while(TRUE){
        perfectGen = EvaluateOrganism();
        if (perfectGen==TRUE ) return generations;
        ProduceNextGen();
        ++generations;
        }
    }
   
   
#include <stdlib.h>

#define GENO 4

void InitializeOrganism(void){
    int organism;
    int gene;
   
    //initialize the base organisms
    for (organism=0; organism<GENE_POOL; ++organism){
        for(gene=0 gene<GENE_COUNT; ++gene){
            currentGen[organism][gene] = rand()%GENO;
        }
    }
    //initialize the model organism
    for(gene=0; gene<GENE_COUNT; ++gene){
        modelOrganism[gene] = rand()%GENO
    }
}


//FITNESS FUNCTION NEEDS TO BE DEFINED AS A COMPARISON OF GENES TO EACH OTHER: GENE1 +(-) GENE2 < 3 then ++genefitness
#define MAXIMUM_FITNESS NUMBER_GENES

int totalOfFitness;

int EvaluateOrganism(void){
    int organism;
    int gene;
    int currentOrganismFitnessTally;
   
    totalOfFitness = 0;
   
    for (organism=0; organism<GENE_POOL; ++organism){
       
        //tally up the organism's fitness
        for (gene=0; gene<GENE_COUNT; ++gene){
            if( currentGen[organism][gene] ==modelOrganism[gene]){
                ++currentOrganismFitnessTally;
            }
        }
        //Save out the tally data
        //add the tally score to generation score
        organismFitness[organism] = currentOrganismFitnessTally;
        totalOfFitness +=currentOrgansimFitnessTally;
       
        //check if generation is perfect
        if (currentOrganismsFitnessTally ==MAXIMUM_FITNESS){
            return TRUE;
        }
    return FALSE;
    }
}

#define MUTATION_RATE 0.001

void ProduceNextGen(void){
    int organism;
    int gene;
    int parentOne;
    int parenttwo;
    int crossoverPoint;
    int mutateThisGene;
   
    //dill the nextGen data structure with the Children
    for (organism=0;organism<GENE_POOL;++organism){
        paretnOne = SelectOneOrganism();
        parentTwo = SelectOneOrganism();
        crossoverPoint = rand() %GENE_COUNT;
       
        for(gene=0; gene<GENE_COUNT; ++gene;){
            //copy over a single gene
            mutateThisGene = rand() %(int)(1.0/MUTATUIN_RATE);
            if(mutateThisGene == 0){
               
                //This is the gene mutation is true condition
                nextGen[organism][gene] = rand() %GENO;
            }else{
                //This is the true inheritance condition
                nextGen[organism][gene] = (currentGen[parentOne][gene] + currentGen[parentTwo][gene])/2;
            }
        }
    }
    //copy the children, nextGen into the new currentGen
    for (organism=0; organism<GENE_POOL; ++organism){
        for(gene=0; gene<GENE_COUNT; ++gene;){
            currentGen[organism][gene] = nextGen[organism][gene];
        }
    }
}

int SelectOneOrganism(void){
    int organism;
    int runningTotal;
    int randomSelectPoint;
   
    running Total = 0;
    randomSelectPoint = rand() % (totalOfFitness + 1);
   
    for(organism=0; organism<GENE_POOL; ++organism;){
        runningTotal += organismFitness[organism];
        if(runningTotal >= randomSelectPoint) return organism;
    }
}
void PhenoOut(int x){
    int organism;
    ofstream pheno_out;
   
    pheno_out.open ("pheno_out.txt");
    for(organism=0;organism<GENE_POOL;++organism){
        pheno_out << " Organism: ";
        pheno_out << organism;
        pheno_out << " Gene Head: ";
        pheno_out << gene;
        pheno_out << " Gene Body: ";
        pheno_out << gene;
        pheno_out << " Gene Front Legs: ";
        pheno_out << gene;
        pheno_out << " Gene Rear Legs: ";
    }
    pheno_close();
    return 0;
    }