Search code examples
processinggraphical-logogenerative-art

Processing blendMode issue


I've written a simple script that generates three lines in random positions on a grid. Each line is specific colour - it's for a logo. I want to use the multiply blend mode, but it creates jagged imagery. Any ideas on how to fix this issue?

// open_lab_logo

size (900, 900); smooth(); 
background (255); 
blendMode(MULTIPLY); 
strokeWeight(100);

float x1 = random(1, 8) * 100; 
float y1 = random(1, 8) * 100; 
float x2 = random(1, 8) * 100; 
float y2 = random(1, 8) * 100; 
float x3 = random(1, 8) * 100; 
float y3 = random(1, 8) * 100; 
float x4 = random(1, 8) * 100; 
float y4 = random(1, 8) * 100;

stroke(#FFDB23); line(x1, y1, x2, y2);

stroke(#E41F7B); line(x2, y2, x3, y3);

stroke(#00A8E4); line(x3, y3, x4, y4);

image example


Solution

  • This is a known bug in Processing 2. Here is the bug, and here is the fix. This fix was first included in Processing 3.0a1 (source).

    I tried this on Processing 2.2.1, and I got the same artifacts as you. I tried this on Processing 3.0a5, and it worked fine.

    The solution is to switch to Processing 3. If you really, really, really need to stick with Processing 2, then you'll have to build from source and include this specific fix. But you probably shouldn't be using Processing 2 anyway.