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 › soap bubbles...any advice
Page Index Toggle Pages: 1
soap bubbles...any advice? (Read 3182 times)
soap bubbles...any advice?
Aug 24th, 2007, 11:40am
 
Hi, I'm a student and I'm looking for help to create an animation, maybe interactive, of soap bubbles with processing...does anyone have any suggestion for me? Or have you already seen some examples, even made with action script or something else? Thanks..
Re: soap bubbles...any advice?
Reply #1 - Aug 24th, 2007, 1:07pm
 
A few months ago, i made this for a project.
It is using Processing and Quartz Composer.

http://www.youtube.com/watch?v=Oq6jyv2a_pI

Re: soap bubbles...any advice?
Reply #2 - Aug 24th, 2007, 1:47pm
 
robert has an old example:
http://www.flight404.com/p5/soap_tube/

F
Re: soap bubbles...any advice?
Reply #3 - Aug 24th, 2007, 1:49pm
 
instant player (avalon) has shaders, maybe ask there (forum) about how to make soap bubbles:
http://www.instantreality.org/home/

F
Re: soap bubbles...any advice?
Reply #4 - Aug 24th, 2007, 3:59pm
 
Thank you for your aswers...I was thinking about create bubbles that can combine to each other according to reality....I mean, soap bubbles have precise geometric rules when they combine, always the same angles..so my idea was to use those rules and create a model of a real bubble...but maybe it's too difficult..I don't know.
Thanks however
Re: soap bubbles...any advice?
Reply #5 - Sep 20th, 2007, 12:15am
 
It's a very interesting idea!

Do you mean like when soap bubbles are foam (made from shampoo), and when individual bubbles are 2-20 mm in diameter, and they are floating on water? I also noticed how they tend to stay in regular shapes. I think it has something to do with air pressure. Have you given it any more thought since August 24th?
Re: soap bubbles...any advice?
Reply #6 - Sep 20th, 2007, 10:28pm
 
From http://en.wikipedia.org/wiki/Soap_bubbles :

Quote:
Soap bubbles are also physical illustrations of the problem of minimal surfaces, a complex mathematical problem. For example, while it has been known since 1884 that a spherical soap bubble is the least-area way of enclosing a given volume of air (a theorem of H. A. Schwarz), it was not until 2000 that it was proven that two merged soap bubbles provide the optimum way of enclosing two given volumes of air with the least surface area. This has been termed the double bubble theorem.


That should give you a place to start, though a programmatic implementation of the concept might be tricky to get running quickly.

First off: are you thinking of doing this in 3d or 2d?  That could make quite a difference to the ultimate result and the methods used to get there.
Re: soap bubbles...any advice?
Reply #7 - Sep 21st, 2007, 12:52am
 
For 2d I can imagine quite easily just detecting overlap between two circles (sum of the square of x and y distances vs the sum of the square of both radii (that how you spell it?)) and then creating a line at that overlap. The line could be calculated on the principle I guess that the line and the center point of the bubbles create an isoceles triangle.

You could then generate a spring or attraction between the centers of the bubbles to get the behaviour.
Re: soap bubbles...any advice?
Reply #8 - Dec 14th, 2008, 9:21pm
 
Did you found a sollution? We are planing a project and we maybe will use soap bubbles. If you have a code allready, I would be very interessted in it Smiley

cheers

Stefan*
Re: soap bubbles...any advice?
Reply #9 - Dec 16th, 2008, 9:33am
 
Here are some soap bubbles with see-through lens deformation and side-to-side swaying motion.

Bubbly Version:
http://luis.net/projects/processing/bubble/

Interactive Version:
http://luis.net/projects/processing/bubble/mouse.html

Plain Version (no deformation):
http://luis.net/projects/processing/bubble/plain.html


It was slopped together based off of this example:
http://processing.org/learning/topics/lens.html

You will need the following files:

Transparent soap overlay
http://luis.net/projects/processing/bubble/data/bubble.png

Background (640 x 480)
http://luis.net/projects/processing/bubble/data/coke.png

Enjoy
Re: soap bubbles...any advice?
Reply #10 - Dec 16th, 2008, 12:34pm
 
Thank you for the fast reply. Very interesting this examples Smiley
Re: soap bubbles...any advice?
Reply #11 - Mar 7th, 2009, 1:47am
 
hey is there any way of placing an image/video inside the bubble and have it animated instead of creating the lens effect on the background image?

Any help would be much appriciated
Re: soap bubbles...any advice?
Reply #12 - Mar 7th, 2009, 5:57am
 
Use a transparent cirkular faded png mask for the video / image inside the bubble, and draw that.
Then, draw the transparent png bubble on top of that, and voila. A picture/video inside a bubble Smiley
Re: soap bubbles...any advice?
Reply #13 - Mar 7th, 2009, 1:53pm
 
hey am relatively new to processing and although that sounds simple enough i've been having difficulty rezizing a mask to fit over the video not masking the full size of the appplet and i want to try and keep the lens efffect similar to the coke example on the video. What i have at the moment is i can change the bg image but the bubble is acting like a mask itself as it rises up it uncovers part of the coke image.

Any help would be much appriciated
Re: soap bubbles...any advice?
Reply #14 - Mar 7th, 2009, 3:25pm
 
hey heres the code i have at the moment sorry its a bit messy -i can put the mask image in with the bubble class but if i try to mask the bubble it gives me an error that the mask has to be the same size as the applet.

Bubble mybubble;
PImage bubble;
PImage Imgmask;

void setup() {
  mybubble = new Bubble();
  size (600, 600);
  bubble = loadImage( "bubble.png");
  Imgmask =loadImage("bubble-mask1.png");
}

void draw (){
  background(255);
  mybubble.move();
  mybubble.display ();
}


 
 class Bubble { //define class
 float xpos;  // variables
 float ypos;
 float xspeed;
 
 Bubble() {  //constuctor
 
 xpos = width/2;
 ypos = height/2;
 xspeed = 1;
 }
 
 void display() {   //function
 image(bubble,xpos,ypos); // Draw image
 image(Imgmask, xpos, ypos,140,140);
 bubble.mask(Imgmask);
 
// bubblemask.resize(157,157);
 }
 
 void move() {  //function
 if(keyPressed) {
   if(key == 'z'){
   mybubble.xpos--;
   }
 }

   if(keyPressed) {
   if(key == 'x'){
   mybubble.xpos++;
   }
 }
 
 if(keyPressed) {
   if(key == 'w'){
   mybubble.ypos--;
   }
 }

   if(keyPressed) {
   if(key == 's'){
   mybubble.ypos++;
   }
 }
 
 
 }
 }

Will be working on it today so might be able to figure it out but anyone got any ideas, i'm sure its probably something stupid.

cheers
Page Index Toggle Pages: 1