Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Friday, 25 March 2011

Pushing the limits with my povwriter library (A load of balls!)

Here is another processing sketch featuring my processing povwriter library. Owing to the nature of the way the exporter works (exports mesh triangles, rather than sphere primitives) the following test which is based on the processing DXF export examples, pushes the limit of my export library. Even with my degenerate triangle filter povray complains about these when rendering the output.pov.

Here is the processing sketch:-

import povexport.*;
import povexport.povwriter.*;

boolean record = false;

void setup() {
  size(400, 400, P3D);
  noStroke();
  sphereDetail(18);
}

void draw()
{ 
  lights();        // this needs to be outside the record loop
  if (record) {    
    translate(0, height/4, 0);
    noLights();    // let PovRAY do the lighting
    noLoop();      // don't loop while recording sketch
    beginRaw(RawPovray.POV, "balls.pov");
  }
  render();
  if (record) {
    endRaw();
    record = false;
    loop();
  }
}

void render() {  
  background(0);
  translate(width / 3, height / 3, -200);
  rotateZ(map(mouseY, 0, height, 0, PI));
  rotateY(map(mouseX, 0, width, 0, HALF_PI));
  for (int y = -2; y < 2; y++) {
    for (int x = -2; x < 2; x++) {
      for (int z = -2; z < 2; z++) {
        pushMatrix();
        translate(120*x, 120*y, -120*z);
        sphere(30);
        popMatrix();
      }
    }
  }
}

void keyPressed() {
  switch(key) {
  case 'r': 
    record = true;
  }
}



Cornell_Box template


















Here is the same processing scene using a simpler povray template:-

Here are the changes I made to the output.pov file to create golden balls:-

//#declare Colour0 = rgb<1, 1, 1>;             // White
#declare Colour0 = color Gold;             // Post production edit of color

simple_scene.pov template

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2