|
Author |
Topic: additive blending and 3D (Read 430 times) |
|
depth
|
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! -depth Code: 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 () { push(); translate(0, 0, planeZ); stroke(150); fill(0, 10); rect(0, 0, width, height); pop(); 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 } push(); translate(camX, camY, rectZ); rotateX(PI/3); rotateZ(PI/3); stroke(255); fill(255, 0, 0); rect(0, 0, 100, 100); pop(); } |
|
|
|
|
|
depth
|
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. -d
|
|
|
|
|