• fullscreen
  • bubblegum.pde
  • particle.pde
  • //testing ToxiclibsSupport(:))
    //echoechonoisenoise 2010
    import toxi.processing.*;
    import toxi.geom.mesh.*;
    import peasy.org.apache.commons.math.*;
    import peasy.*;
    import peasy.org.apache.commons.math.geometry.*;
    import toxi.geom.*;
    import toxi.volume.*;
    int DIM=100;//dimensions of the voxel space: 100x100x100 voxels
    float ISO_THRESHOLD = 3;//higher values smoothen the result, lower uncover spherical characteristics of volumebrush
    Vec3D SCALE=new Vec3D(1,1,1).scaleSelf(1000);//proportions and scale of voxel space
    VolumetricSpace volume;
    IsoSurface surface;
    VolumetricBrush brush;
    TriangleMesh mesh;
    ToxiclibsSupport gfx;
    PeasyCam cam;
    ArrayList ptc;//particles list
    float i=random(100);//position in noise space, randomized, so each time different form comes out
    float sc=0.007;//step size while moving thru noise space
    float brushDensity=1;
    PVector l[];
    float str;
    int fCount=0;
    int pAmount=500;
    void setup() {
      cam = new PeasyCam(this,1300);
      gfx=new ToxiclibsSupport(this);
      volume=new VolumetricSpace(SCALE,DIM,DIM,DIM);
      surface=new IsoSurface(volume);
      brush=new RoundBrush(volume,10);
      ptc=new ArrayList();
      for(int i=0;i<pAmount;i++) {
        ptc.add(new Particle());
    void draw() {
      for(int i=0; i<l.length; i++) {
        directionalLight(str,str,str, l[i].x,l[i].y,l[i].z);//all the lights
      if(fCount<50) {//record 50 steps as a shape, each time updating the isosurface
        mesh=new TriangleMesh();
        for(int i=0;i<ptc.size();i++) {
          Particle c=(Particle)ptc.get(i);
      gfx.mesh(mesh,true);//draw nice, shaded mesh
    void keyPressed() {//reset all the stuff, and create a new shape
      volume=new VolumetricSpace(SCALE,DIM,DIM,DIM);  
      surface=new IsoSurface(volume); 
      brush=new RoundBrush(volume,10);
      ptc=new ArrayList();
      for(int i=0;i<pAmount;i++) {
        ptc.add(new Particle());
    void initLight() {//by Marius Watz
      l=new PVector[7];
      for(int i=0; i<l.length; i++) {
        l[i]=new PVector(cos(str)*10,0.3,sin(str)*10);
    class Particle{
      PVector pos;
      float speed;
      int spread=150;
        pos=new PVector(random(-spread,spread),random(-spread,spread),0);
      void behave(){    
      void display(){
      Vec3D Pos=new Vec3D(pos.x,pos.y,pos.z);
      brush.drawAtAbsolutePos(Pos,brushDensity);//drawing particle paths with volumetric brush


    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.



    Report Sketch

    Report for inappropriate content

    Please provide details if possible:

    Your have successfully reported the sketch. Thank you very much for helping to keep OpenProcessing clean and tidy :)

    Make a Copyright Infringement claim

    hey, I get a java heap space error right away. My computer's java don't handle this sketch, but I really wonder how it looks like..
    that's interesting. is it only this or my other 3d stuff as well? ii don't know much about how to handle that problem... maybe i can update it to new volumeutils...
    13 May 2011
    Hey! I get this error: 'the package 'toxi' does not exist. You might be missing a library'. I'm very new at this. How can I make it work? Thanks =) !
    hey. that means you are missing a library. here is a list of some available libs: http://www.processing.org/reference/libraries/
    more specificaly, you are missing toxiclibs: http://toxiclibs.org/2011/01/toxiclibs-0020/
    you might want to check Jose's tutorial on that matter: http://vimeo.com/17242182 as well.
    unfortunately that is not all :) this sketch uses an old version of toxiclibs, so if you will have the new one (0020) installed, it will not run...
    but there is http://www.openprocessing.org/visuals/?visualID=16833 working on very similar principles, so maybe you can find your way...
    13 May 2011
    okay, I'll try that =) . Thanks for the help!
    just found great animation and renderings of these structures: http://nonstandardstudio.wordpress.com/2011/10/03/noisy-agents-003-nss/
    made by daniel bolojan!
    Ruben Hussong
    23 Jun 2014
    hey echoechonoisenoise,
    do you still check openprocessing?
    I wondered if it were possible to build your fancy bubble gum out of vertex? I tried because I'd like to print it. but my programming skills are just not good enough.
    thanks in advance
    hey Ruben,
    im not so much using it these days for various reasons. maybe better times come soon :D
    im not sure what you mean - it's a mesh already. you could use mesh.saveAsSTL() command from toxiclibs (check examples) to generate output suitable for printing.
    good luck! im curious how it comes out - could you link a photo once you are done?
    You need to login/register to comment.