output-0004

Little try with sunflow rendering.

 

hipstersinc.com/p5sunflow/

 

 

import noc.*;

import hipstersinc.sunflow.*;

import hipstersinc.sunflow.shader.*;

import hipstersinc.*;

 

 

void setup() {

size(800, 600, "hipstersinc.P5Sunflow");

noStroke();

}

 

 

void draw() {

setupCamera();

setupScene();

 

background(255);

 

 

translate(width/2, height/2, 0);

rotateX(QUARTER_PI);

rotateZ(QUARTER_PI);

fill(255);

 

Vector3D pos = new Vector3D(0,0,0);

Vector3D rot = new Vector3D(0,0,0);

float scl = 25.5;

float boxSize = 560;

// translate(boxSize, boxSize);

for(int i=0; i<300; i++) {

pushMatrix();

translate(pos.x,pos.y,pos.z);

rotateX(rot.x);

rotateY(rot.y);

rotateZ(rot.z);

scale(random(.1),random(.4),random(.1));

 

box(boxSize);

Vector3D add = new Vector3D(random(-1,1),random(-1,1),random(-1,1));

add.mult(scl);

pos.add(add);

add = new Vector3D(random(-1,1),random(-1,1),random(-1,1));

add.mult(.2);

rot.add(add);

popMatrix();

}

saveFrame("output-####.png");

//noLoop();

//redraw();

}

void mousePressed(){

redraw();

}

void setupCamera() {

P5Sunflow sunflow = (P5Sunflow) g;

sunflow.camera.setType(SunflowCamera.PINHOLE);

//sunflow.camera.setType(SunflowCamera.SPHERICAL);

//sunflow.camera.setType(SunflowCamera.FISHEYE);

/*sunflow.camera.setType(SunflowCamera.THINLENS);

sunflow.camera.setFocalDistance(450);

sunflow.camera.setLensRadius(12f);

sunflow.scene.setAaSamples(12);*/

}

void setupScene() {

P5Sunflow sunflow = (P5Sunflow) g;

/* sunflow.scene.setAaMin(0);

sunflow.scene.setAaMax(0);

sunflow.scene.setAaSamples(0);

sunflow.scene.setFilter(null);*/

sunflow.scene.setGlobalIllumination(false);

}

 

 

Built with Processing.

294 views
0 faves
0 comments
Uploaded on October 17, 2007