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 & HelpPrograms › zoom feedback
Page Index Toggle Pages: 1
zoom feedback (Read 1550 times)
zoom feedback
Feb 25th, 2010, 6:40am
 
hi , how can i implement a zoom feedback in processing as the one in the video?
Do anybody have tried soemthing like this?  maybe somebody knows some example code somewhere

http://www.vimeo.com/9727363

thanks



Re: zoom feedback
Reply #1 - Feb 25th, 2010, 9:30am
 
that looks like a chain of 3D spheres rendered in OpenGL with few vertices, sprouting at the top of the Y axis, moving down along the Y axis, and disappearing at a certain point.

what do you want to do exactly?
Re: zoom feedback
Reply #2 - Feb 25th, 2010, 8:50pm
 
Id thought there was a popular game effect called rotozom feedback. ok sorry , ill explain you, ive made that video with puredata.  The idea is too have a few iterated balls say 10.
The idea of the code is to make the impresion that the balls are infinite. So make the impression we are zooming infinite.
For this the trick is to make that each ball moves towards, when the ball arrive to  some position we put the ball back again, so that create the illusion that the balls are infinite.

Ive did this, i need that when each ball is 0, 0 , 200 then it chan ge to 0, 0, -200

how can i do that?

thanks




position = position + 1;
for(int i = 0; i < 10 ; i++) {
translate(0,0,position);
sphere(5);
}
Re: zoom feedback
Reply #3 - Feb 26th, 2010, 12:50am
 
I can't be bothered to make this in 3D. Here's what you want in 2D.

Quote:
Square[] squares = new Square[20];
void setup(){
  size(200,200);
  for(int i=0; i<squares.length;i++){
    squares[i] = new Square( 10*i );
  }
  rectMode(CENTER);
  noStroke();
}
void draw(){
  background(0);
  for(int i=0; i<squares.length;i++){
    squares[i].simulate();
    squares[i].draw();
  }
  
}

class Square {
  float myCenter;
  float mySize;
  color myColor;
  Square(float startCenter){
    myCenter = startCenter;
    updateSize();
    newColor();
  }
  void draw(){
    fill( myColor );
   rect( myCenter, myCenter, mySize, mySize);
  }
  void simulate(){
    myCenter++;
    if(myCenter >= width ){
      myCenter = 0;
      newColor(); 
    }
    updateSize();
  }
  void updateSize(){
    mySize = 20-dist(myCenter, myCenter, width/2, height/2)/10;
  }
  void newColor(){
   myColor = color(random(255),random(255),random(255));
  }
}

Re: zoom feedback
Reply #4 - Feb 26th, 2010, 1:40am
 
here is my little piece of endlessness

Code:
void setup() {
size(400,400,P3D);
background(0);
sphereDetail(48);
}
float move = 100;
void draw() {
background(0);
pointLight(51, 102, 126, 200, 0, 10);
translate(width/2,height/2+120);
rotateX(radians(-15));
noStroke();
for(int i = 0;i<20;i++){
pushMatrix();
translate(0,0,-150*i+move);
sphere(100);
popMatrix();
}
move+=20;
if(move>=250)move=100;
}
Re: zoom feedback
Reply #5 - Feb 26th, 2010, 7:22am
 
hi Cedrid ive tried your piece of code, it looks nice but there is a problem with it. In your code you are handling your group of 20 spheres as a whole or as one block, when your block is more than 250 you put your group of 20 spheres back again
In the example i show you each sphere is handled independently, this means that not the group of 20 spheres are moved back all at the same time, instead of this each spheres is putted back independently, this allow for other interesting effects as making rotozoom fedbacks .

Any idea how can i handle each sphere independently?
Re: zoom feedback
Reply #6 - Feb 26th, 2010, 12:53pm
 
hmm k, couldnt tell how you made it and what you wanted just looking at your video...
in your case, create a sphere class, with an z coordinate, you can then place them in a row, changing th eposition of each one of them, and set them back to the start when they reach the end...
Re: zoom feedback
Reply #7 - Feb 26th, 2010, 1:45pm
 
... which is what my 2D squares example is doing...
Re: zoom feedback
Reply #8 - Feb 26th, 2010, 10:18pm
 
mateooo wrote on Feb 25th, 2010, 8:50pm:
So make the impression we are zooming infinite.

What do you mean by "zooming infinite" A rotozoom rotates and zooms a FLAT PLANE (usually repeating tiles if zooming out), not recursive layers of "feedback".

Quote:
For this the trick is to make that each ball moves towards, when the ball arrive to  some position we put the ball back again, so that create the illusion that the balls are infinite.


If you made the example video, perhaps you can tell us exactly how many balls are drawn for each frame. It looks to me like there are more than 10... the appearance of "infinite" is only because you can't make out the details once they get too small, and it is obvious you are not using some kind of feedback effect because the ball at the front disappears suddenly each time.
Re: zoom feedback
Reply #9 - Feb 28th, 2010, 12:15pm
 
hi subpixel, zooming infinite i mean creating the ilusion that the camare is moving forward. I mean rotozom because if you add a little rotationg you can create spiral structure, that also looks infinite. I think there is some feedback here, because the position of each sphere is defining the position of the next . I was thinking maybe this is the simple example of how simple iteration can create spiral and complex structures .
Ive made that example in pd, im gonna upload a picture of the patch.

I also made a better version , here it is:

Code:


import processing.opengl.*;


Square[] squares = new Square[11];


void setup(){
size(500,500, OPENGL);
for(int i=0; i<squares.length;i++){
squares[i] = new Square( 10*i );
}
rectMode(CENTER);
noStroke();
}
void draw(){
background(0);
translate( 340, 340 , -300 );
for(int i=0; i<squares.length;i++){
squares[i].simulate();
squares[i].draw();
}

}

class Square {
float myCenter;
float mySize;
float valor;

float aumenta;

color myColor;
Square(float startCenter){
myCenter = startCenter;
valor = startCenter * 1.3;
aumenta = 0;
updateSize();
newColor();
}

void draw(){
aumenta = aumenta + 0.001;

pushMatrix( );
fill( myColor );
translate( 0, 0 , myCenter * 14 );
box(40);
hi popMatrix( );
}
void simulate(){
myCenter = myCenter + 0.1;
if(myCenter * 1 >= 100 ){
myCenter = -10;
newColor();
}
updateSize();
}
void updateSize(){
mySize = 20-dist(myCenter, myCenter, width/2, height/2)/10;
}
void newColor(){
myColor = color(random(255),random(255),random(255));
}
}

Page Index Toggle Pages: 1