We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › P5 Sunflow large printing
Page Index Toggle Pages: 1
P5 Sunflow large printing (Read 4428 times)
P5 Sunflow large printing
Oct 30th, 2008, 5:27am
 
Hey guys, I have been creating some still 3D images based on Conway's Game of Life using Sunflow.  I'm getting some nice results http://antipasto.union.edu/~goldenbr/codeart/life/main.html , but would like to eventually print them very large (20-30 inches).  Any thoughts on how to achieve a really hi-res image that is quite large? Thanks.

Russell
Re: P5 Sunflow large printing
Reply #1 - Oct 30th, 2008, 11:15am
 
those look great.

i know nothing about sunflow but i'm guessing the problem is just the image size / memory requirements. 30 inches at 150dpi (which is a bit low but presentable) is only 4500 pixels which i know something like povray can handle easily enough.

render it in slices?
Re: P5 Sunflow large printing
Reply #2 - Oct 30th, 2008, 8:16pm
 
I feel like that might bypass the the Sunflow rayracer.  Is it possible to render out the finished image to a file rather than displaying it on the screen, which restricts the size?  Here is the code if my explanation isn't great.

import hipstersinc.sunflow.*;
import hipstersinc.sunflow.shader.*;
import hipstersinc.*;

int sz = 20;
int zSize = 19;
int zLevel = -350;

int[][] data;
String[] lines;

void setup() {
 
 size(1400,600,"hipstersinc.P5Sunflow");
 background(255);
 noStroke();
 lines = loadStrings("data.txt");
 data = new int[lines.length][lines[0].length()/2+1];
 for(int i=0;i<lines.length;i++){
   int[] temp = int(split(lines[i], ","));
   
   for(int x=0; x<temp.length; x++){
      data[i][x]=temp[x];
   }
 }

 noLoop();

}

void draw(){
 background(255);
 setupCamera();

 
 //camera(-200, -200, 500, width/2, height/2, 100,-1, 1.0, 0.0);
camera(-700,-200, 700,800, 400,300 ,0, 1.0, 0.0);

 
 int[][] life= new int[20][20];
 for(int z = 0; z< 65; z++){
     int xpos = -1;
   for(int a =0; a<data[z].length; a++){
     
     if(a % 20 == 0){
       xpos+=1;
       
     }
     
     life[xpos][a%20] = data[z][a];
     
   }
   
   for(int i=0; i<life[0].length; i++){
     for(int j=0; j<life[0].length; j++){
       fill(30+z*2,z*3,210-z*2);
       
       if(life[i][j]==1){
         
         pushMatrix();
         
         translate(sz * i , sz * j, zLevel);
         box(sz,sz,zSize);
         
         popMatrix();
       }
     }
   }
   zLevel += zSize;
 
 }
 saveFrame("newBig3.tif");
}

void setupCamera() {
 P5Sunflow sunflow = (P5Sunflow) g;
 sunflow.camera.setType(SunflowCamera.PINHOLE);

}

Re: P5 Sunflow large printing
Reply #3 - Oct 30th, 2008, 8:55pm
 
like i say, i know nothing about sunflow but the page i was reading (which was a sunflow page and not a sunflow-for-processing page) seemed to let you specify the output size:

http://sunflow.sourceforge.net/docs/javadoc/org/sunflow/core/display/FileDisplay.html

i guess p5sunflow is different and restricted to screen size.
Re: P5 Sunflow large printing
Reply #4 - Oct 30th, 2008, 11:49pm
 
I just tried running your example and I get the following error:

java.lang.NoSuchMethodException: hipstersinc.P5Sunflow.<init>()

Any ideas why? I unzipped p5sunflow into my Sketchbook location, and I can import it via Sketch -> Import Library.

My setup:
Processing 0154
Mac OS X Leopard
Java 1.5.0_16
Re: P5 Sunflow large printing
Reply #5 - Oct 30th, 2008, 11:52pm
 
well, i tried just putting 4500x3000 in the size() call but i just got a java heap space exception. i think you can change this with java command line options (-Xms512m -Xmx1024m?)

oh, ok, despite the error it did eventually write a 4500x3000 image for me. camera's a bit wrong and i only had a noddy data.txt file but it did work.

> I feel like that might bypass the the Sunflow rayracer.

but you're already using processing (which is a rapid development tool for writing interactive visualisations) to call a ray tracer which is already a bit wacky 8)
Re: P5 Sunflow large printing
Reply #6 - Oct 30th, 2008, 11:54pm
 
addywaddy, i also got something like that but it was very misleading - you need a data.txt file in the data dir. must be 0s and 1s, comma separated, and at least 65 lines long (i think the original was 400x65 with a 20x20 grid per layer but...)
Re: P5 Sunflow large printing
Reply #7 - Oct 31st, 2008, 12:27am
 
Sorry guys, I forgot to tell you that the data file was used.  It was generated by another basic sketch which runs the game of life randomly each time and records the results.  I don't have it with me on this computer it's at school, but i'll throw it on tomorrow if you're still interested.  

Also, when you made the 4500 x 3000 image, what was the third parameter in the size method (size(4500,3500, OPENGL or P3D?).  Also, did you have to use the java command line argument, because if so, how do you implement that?  I appreciate you looking into this.
Re: P5 Sunflow large printing
Reply #8 - Oct 31st, 2008, 12:52am
 
it was the same as yours but with different numbers:

size(4500, 3000, "hipstersinc.P5Sunflow");

i didn't need to change the heap size in the end - it gave an error on the console but generated the image anyway 8) this laptop has 1G of memory, 2G of swap btw, 1.8GHz processor. image generation took about 3 minutes (for a single glider).

(although i think if you needed to do it you'd just need to modify the last line in the processing script file, which i guess is platform dependant - i'm on linux and it says

java processing.app.Base

and i'd add those two options i mentioned earlier after the 'java'. but i am guessing!)
Re: P5 Sunflow large printing
Reply #9 - Oct 31st, 2008, 9:50am
 
Thanks for the reply koogs. I'm still getting the error, but Processing informss me that hipsterinc.P5Sunflow needs to be updtated to work with my version (0154 Beta). Which version are you guys using?
Re: P5 Sunflow large printing
Reply #10 - Oct 31st, 2008, 10:54am
 
it was, i think, Processing 135 (couldn't get opengl working in 148 so i went back) and the newest Sunflow.
Re: P5 Sunflow large printing
Reply #11 - Oct 31st, 2008, 11:47am
 
ok, updated everything here at work (P154) and i get the same error:

Exception in thread "Animation Thread" java.lang.RuntimeException: hipstersinc.P5Sunflow needs to be updated for the current release of Processing.

that'll teach me 8)
Re: P5 Sunflow large printing
Reply #12 - Oct 31st, 2008, 11:48am
 
(i still think it might be better skipping Processing and doing this in plain old java and the sunflow library directly.

or, dare i say, php and povray!)
Re: P5 Sunflow large printing
Reply #13 - Jul 9th, 2009, 8:43pm
 
I just posted this in another thread (http://processing.org/discourse/yabb2/num_1243094814___but_thought_it_might_be_relevant_here_as_well_.html

Just wanted to point you to a fork of Mark Chadwick's p5sunflow library:

http://github.com/hryk/p5sunflow/tree/master

The original trunk of Mark Chadwick's p5sunflow library is here:

http://github.com/markchadwick/p5sunflow/tree/master

Haven't tried hryk's fork yet, but people have reported that it works with Processing 1.0.
Re: P5 Sunflow large printing
Reply #14 - Mar 18th, 2010, 5:48am
 
Great find Mike. Maybe this is a stupid question, but the fork doesn't look like normal packaged libraries. It looks like the eclipse template. What pieces do you take or how do you make the fork into a Processing library that you can dump into "Documents/Processing/libraries"?

=======
Scratch that I found one that works based on this thread
http://processing.org/discourse/yabb2/num_1257296697_15.html
http://www.punyblog.com/2009/10/sunflow-output-from-processing.html
Page Index Toggle Pages: 1