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 & HelpOpenGL and 3D Libraries › 3D Rendering - Export to Frames via analysis
Page Index Toggle Pages: 1
3D Rendering - Export to Frames via analysis (Read 2451 times)
3D Rendering - Export to Frames via analysis
Jun 2nd, 2010, 10:53am
 
Hi there Processing community!
I'm nudel and I'm using processing for about half a year now.

Recenty i wanted to put exported frames from a sketch (using the saveFrame(); method) into a video editing program, just to find out that the frames got really asynchronous to the music they have been set to in the sketch. (Different spheresizes where set to player.mix.level, to have the spheres reacting to the music). I think this happened because processing gives out the frames to slow. The framerate of the Sketch was 25 and so was the framerate of the video editing programm.

My suggestion would be to analyse the amplitude of the music via processing, frame by frame, 25 times a second, so that i could render my frames corresponding to that analysis afterwards.
But i have no idea how to do this.
Also, if i could get this done, it would be possible to use other render methods that are even more power consuming such as OPENGL or SUNFLOW.

Btw: This is the sketch I am talking about:
http://home.arcor.de/nudelsheep/sketch_apr29b.rar

Best regards,
nudel
Re: 3D Rendering - Export to Frames via analysis
Reply #1 - Jun 2nd, 2010, 3:24pm
 
Hey nudel, if were to speak for the community, welcome!

Pretty crisp analysis if you ask me. I think you're right. I also believe the solution you pose might just work.

How you'd save the values? I'd suggest you run the sketch pretty much like it is now, except for all the 3d drawing. Instead, you save the values that would set the sphere size to a file.

Without looking at your code, this would be something like this:
Code:
float[] sizes;

void setup() {
 sizes = new float[0];
}

void draw() {
float spheresize = random(100); //player.mix.level;
sizes = append(sizes, spheresize);
}

void keyReleased() {
 String[] strings = str(sizes);
 saveStrings("file.txt", strings);
}


You can then in another patch load this data, and have it render 3d imagery by looping through an array containing this data:

Code:
float[] sizes;
int iterant = 0;

void setup() {
 sizes = float(loadStrings("file.txt"));
}

void draw() {
 if(iterant < sizes.length) {
   background(255);
   
   ellipseMode(CENTER);
   ellipse(width/2, height/2, sizes[iterant], sizes[iterant]);

//saveFrame();    
   iterant++;
 }
}

Re: 3D Rendering - Export to Frames via analysis
Reply #2 - Jun 3rd, 2010, 11:35am
 
Thanks alot, this worked flawlessly!
I had to include frameRate(25) to sync it with my editing program.

Pass me a PM with your name&whatever, so i can credit you for the help in the video I am working on.
Re: 3D Rendering - Export to Frames via analysis
Reply #3 - Jun 3rd, 2010, 12:57pm
 
Haha no way! I'm happy it worked.
To be credited I expect to do more work Wink

Actually, I'll probably use this method too some time. Cheers
Page Index Toggle Pages: 1