3D objects and blendMode(ADD) causes artifacts

edited June 2017 in GLSL / Shaders

Screen Shot 2017-06-04 at 7.15.03 PM

code is simple I update blendMode(ADD ) in setup and draw sphere() I am going to use shader later but with out shader there is this problem.

void setup() 
{
//....... other setup setup stuff
      blendMode(ADD);
}
int y=0;
void draw()
{
//  hint(ENABLE_DEPTH_TEST);
  noStroke();
  background(0);

  sh.set("mainPower",2.7);
  sh.set("eyePos",0.0, 0.0, 100.0);
  //shader(sh);

  translate(width/2,height/2+y,0);
  fill(250,100,0);
  sphere(90);
  //box(30);
  if(y>height/2)
  y=-height/2;
  else 
  y++;
}

Answers

  • edited June 2017

    @trailbalzer47

    I think you are good with your own shape
    also .disableStyle() processing.org/reference/PShape_disableStyle_.html

    The man page says: additive blending with -> white clip.

    Otherwise all devs are hiding here: github.com/processing/processing/issues

    I also have to re read this: //processing.org/tutorials/color/

    Limiting the Colorrage will do the trick for this scetch.
    I think the range gets remapped form OpengGL 0.0-1.0 to Processing RGB 255

    So what we are blending background(zero) against fill(orange), it seems we are more dealing with white

    void setup() {
      size(250,250,P3D);
    
      //processing.org/reference/colorMode_.html
      colorMode(RGB,104);
    
      //ADD - additive blending with white clip: C = min(A*factor + B, 255)
      blendMode(ADD);
    
      noStroke();
    }
    
    int y=0;
    void draw(){
      background(0,0,0);
    
      translate(width/2,(y>height)?(y=-height/2):(y+=1),0);
    
      fill(204, 102, 0);
    
      sphere(90);
    }
    
  • ok leave it .. I tried your sketch it still has that anomaly visible. also I think blending and having texture over sphere also makes it worst. I am abondaning blendMode(ADD) for this. I did not understand rest of your post. Thanks anyways. @nabr

  • edited June 2017 Answer ✓
    PImage img;
    void setup() {
      size(480,640,P3D);
      hint(DISABLE_DEPTH_TEST);
      blendMode(ADD);
      //image credit: pixabay.com/de/startrails-felsen-nacht-918551/ CC0
      img=loadImage("https://"+"cdn.pixabay.com/photo/2015/09/02/12/36/startrails-918551_640.jpg?attachment");
    }
    int y=0;
    void draw() {
      background(0);
      image(img,0,0);
      translate(width/2,(y>640)?y-=y:y++);
      fill(204,102,0,125);
      sphere(90);
    }
    

    @trailbalzer47 can't help you any further. Blend Modes is something on my to do list. I just try things out.

    Here is a nice PostFx Lib
    github.com/cansik/processing-postfx

    Good Luck.

Sign In or Register to comment.