Transparancy issues in linux.

edited October 2014 in Using Processing

Under windows I've never had any problems using this trick to create motion blur in animations, no matter what format I output to:

fill(gray, alpha);
rect(0, 0, width, height);

I've just moved over to ubuntu the other day and everything works just fine, except that this trick now causes the whole output to be transparent. Worst is .gif, where any area of the image that has transparancy just becomes invisible. Since the rect in this code covers the whole image, it results in completely blank output. Everything look just fine while running the sketch. Am I doing something wrong or is this a known issue?

Answers

  • edited October 2014

    Never heard about any blur effect w/ fill() + rect() before! :@)
    I'm on Linux here. I've got some "blur" tracks in this code I had after including your lines: ~:>

    studio.processingtogether.com/sp/pad/export/ro.98wJk9FLLhbUE/latest

    /**
     * Falling Balloons (v2.0)
     * by  aimee12345 & DCRaven (2014/Mar)
     * mod GoToLoop
     *
     * forum.processing.org/two/discussion/3945/arrays-loops-processing
     *
     * studio.processingtogether.com/sp/pad/export/ro.98wJk9FLLhbUE/latest
     */
    
    static final color BG = #3232FA, FG = #20FC35;
    static final int NUM_BALLOONS = 10, MIN_SIZE = 75, MAX_SIZE = 125;
    final PVector[] balloons = new PVector[NUM_BALLOONS];
    
    void setup() {
      size(600, 600);
      frameRate(60);
      smooth(4);
      ellipseMode(CENTER);
    
      stroke(0);
      strokeWeight(2);
      fill(FG);
    
      for (int i = 0; i != NUM_BALLOONS; balloons[i++] = new PVector(
      random(width), random(height), random(MIN_SIZE, MAX_SIZE)));
    }
    
    void draw() {
      //background(BG);
    
      noStroke();
      fill(BG, 10);
      rect(0,0,width,height);
      stroke(0);
    
      for (PVector b: balloons) {
        ellipse(b.x, b.y, b.z, b.z);
        if (++b.y > height + b.z)  b.y = -b.z;
      }
    }
    
  • edited October 2014

    The vocabulary of the OP is imprecise, he meant actually a fading effect, not a blur one.

    Would be interesting to have an example sketch showing the problem.
    In particular, are you using the default mode or one of the OpenGL modes (P2D, P3D, OPENGL)?

  • Thanks PhiLho for clearing up the misunderstanding/misnomer. Here's an example:

    ArrayList<PVector> vectors;
    PImage src;
    
    void setup() {
      src = loadImage("srcimage.jpg");
      size(src.width, src.height, P3D);
      src.resize(src.width/8, src.height/8);
    
      vectors = new ArrayList<PVector>();
    
      src.loadPixels();
      int threshold = 150;
      for (int y = 0; y < src.height; y++) {
        for (int x = 0; x < src.width; x++) {
          if (green(src.pixels[y * src.width + x]) > threshold) {
            float saturation = map(saturation(src.pixels[y * src.width + x]), 0, 255, -100, 100);
            vectors.add(new PVector(x*8, y*8, saturation));
          }
        }
      }
      println(vectors.size());
      translate(0, height/2);
      rotateX(PI/2);
      background(0);
      blendMode(ADD);
      stroke(50, 50);
      float connectionDistance = 100;
      int numVectors = vectors.size();
      for (int a = 0; a < numVectors; a++) {
        PVector vA = vectors.get(a);
        for (int b = a+1; b < numVectors; b++) {
           PVector vB = vectors.get(b);
           float distance = vA.dist(vB);
           if(distance <= connectionDistance){
            line(vA.x, vA.y, vA.z, vB.x, vB.y, vB.z); 
           }
        }
      }
      save("output"+hour()+minute()+second()+".png");
    }
    

    And here's two screenshots of the output: http://imgur.com/a/kzJ3t

    The one that's completely transparent aside from the background was done without a specified blendMode(), the one that looks ok was done with blendMode(ADD); Both were done with P3D.

  • Please, avoid to reject answers unless you really mean it, you can ignore the bugging prompt.

    I don't do much 3D, and I have a Windows computer, but I know issues with transparency in 3D has been mentioned in the past in the forums. Have you tried a search? (from main site, not from here)

Sign In or Register to comment.