This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
(Moderators: fry, REAS)
   additive blending and 3D
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: additive blending and 3D  (Read 430 times)

WWW Email
additive blending and 3D
« on: Feb 16th, 2005, 10:53pm »

i'm trying to use additive blending to blur motion in 3D space.
in the code below, there's a red rect floating in space, and a black rect behind it.  the red rect can be moved back and forth with the 'w' and 's' keys, and the black rect can be moved back and forth with the 'q' and 'a' keys.
for the purposes of this example, it might be helpful to think of the black rect as a pool into which the red rect is being submerged.
however, as soon as the red rect 'gets wet', it stays wet - if the black rect is moved over the red rect and then pulled back, the red rect doesn't redraw as red but remains black.
i get the feeling this is just due to a lack of understanding on my part, in terms of the way processing draws 3D.  any suggestions would be much apurshiated...thanks!

int camX;
int camY;
int rectZ = -200;
int planeZ = -400;
void setup () {
  size(400, 400);
  camX = int(width * .52);
  camY = int(height * .52);
void loop () {
    translate(0, 0, planeZ);
    fill(0, 10);
    rect(0, 0, width, height);
  if (keyPressed) {
    if (key == 'w') { rectZ -= 5; }   //move rect back
    else if (key == 's') { rectZ += 5; }   //move rect forward
    else if (key == 'q') { planeZ -= 5; }   //move fade plane back
    else if (key == 'a') { planeZ += 5; }   //move fade plane forward
    translate(camX, camY, rectZ);
    fill(255, 0, 0);
    rect(0, 0, 100, 100);

WWW Email
Re: additive blending and 3D
« Reply #1 on: Feb 16th, 2005, 11:06pm »

i get similar results when trying to blend using pixels[].  and i get similar results when just drawing in 3D with no background() calls - it's like once pixels are in place at a certain depth, they're there period, until something else moves in front of them.
is there any way to, um, draw over pixels without drawing in front of pixels?  like i said in the last post, the ultimate goal is a blur/blend effect in 3D space...
thanks a bazillion.
Pages: 1 

« Previous topic | Next topic »