|
Author |
Topic: lines and fills in 3d (Read 411 times) |
|
edwardgeorge
|
lines and fills in 3d
« on: May 29th, 2003, 4:11pm » |
|
This may have been mentioned before, i apologise if so... It seems that stroke based Shapes will alsways render above filled objects in 3d, as far as i know it's always done this with me, although previously i've quite liked the effect it's not really suitable for the thing i'm working on currently. Have a look at this quick bit of code... Code:void setup(){ size(360,240); background(255); //smooth(); //lights(); } void loop(){ translate(width/2,height/2); rotateY(radians(mouseX)); stroke(0); noFill(); for(int i=0;i<110;i+=20){ beginShape(LINE_STRIP); for(int ii=40;ii<120;ii++){ curveVertex(adj(adj(100,ii),i),opp(100,ii),opp(adj(100,ii),i)); } endShape(); } fill(255,0,0); noStroke(); box(40); } float opp(float hyp, float ang){ return sin(radians(ang-90))*hyp; } float adj(float hyp, float ang){ return cos(radians(ang-90))*hyp; } |
| Moving the mouse shows the lines are always visible even when behind the red box. Now in this example using points instead... Code:void setup(){ size(360,240); background(255); //smooth(); //lights(); } void loop(){ translate(width/2,height/2); rotateY(radians(mouseX)); stroke(0); noFill(); for(int i=0;i<110;i+=20){ for(int ii=40;ii<120;ii++){ point(adj(adj(100,ii),i),opp(100,ii),opp(adj(100,ii),i)); } } fill(255,0,0); noStroke(); box(40); } float opp(float hyp, float ang){ return sin(radians(ang-90))*hyp; } float adj(float hyp, float ang){ return cos(radians(ang-90))*hyp; } |
| The points don't show up when behind the box. Martin suggested i try using lights(), however (if you uncomment it) this doesn't resolve the issue, plus i prefer the flat visual style of not having lights for most of my stuff. Is this something i'm missing/doing wrong or is it a bug (or intential feature) of processing? Thanks for your help All the best
|
Ed, Suppose, Nottingham, UK http://www.suppose.co.uk http://ed.suppose.co.uk
|
|
|
fry
|
Re: lines and fills in 3d
« Reply #1 on: Jun 8th, 2003, 6:23pm » |
|
i think what you're seeing is a known bug--that single pixel lines (the stroke around shapes) have no z value, so they always show up on top of everything else. we hope to fix this one soon.
|
|
|
|
skloopy
|
Re: lines and fills in 3d
« Reply #2 on: Jun 8th, 2003, 9:44pm » |
|
It would be nice to have z-sorting as an option though. I mean so if you just want to draw on top of everything you just have to switch it off or on.
|
|
|
|
fry
|
Re: lines and fills in 3d
« Reply #3 on: Jun 9th, 2003, 2:40pm » |
|
do you mean you like the effect of the lines being drawn over everything? i've heard the same thing (nik who did alphabot for the 'software' page) so maybe we'll keep it as a hint() option.
|
|
|
|
arielm
|
Re: lines and fills in 3d
« Reply #4 on: Jun 9th, 2003, 3:40pm » |
|
add me please to the list of people who "like the effect of the lines being drawn over everything"!
|
Ariel Malka | www.chronotext.org
|
|
|
skloopy
|
Re: lines and fills in 3d
« Reply #5 on: Jun 9th, 2003, 6:49pm » |
|
Yeah I like the effect sometimes. It would be nice to have it as a per-draw hint for stroke and fill. so that if you wanted to draw a stroke in the background but with a z value of X you could. maybe if that Z value was 0 or whatever the right nimber is it would draw on top of everything and if that Z value was 1 or whatever it would draw in back of everything. It would be nice to have that kind of control over the z-drawing so you could mess with perspective a little.
|
|
|
|
benelek
|
Re: lines and fills in 3d
« Reply #6 on: Jun 11th, 2003, 4:23am » |
|
maybe we could use multiple instances of the perspective rendering output... ie, the ability to render shapes to other pixel layers. then we could combine the multiple pixel layers as we wish, for the final to-be-displayed set of pixels. that way, we could have lines as well as any other shapes, rendered on top of everything. i'm not at my home computer right now, but does this kind of thing work? Code: BImage theOtherPixels = loadimage("blank.gif"); //blank image file at same size as pixels array theOtherPixels.line(x1,y1,z1,x2,y2,z2); //do ur normal drawing here //combine theOtherPixels array with pixels array. |
|
|
|
|
|
fry
|
Re: lines and fills in 3d
« Reply #7 on: Sep 18th, 2003, 4:28am » |
|
the "lines drawing over things" bug has been fixed for rev 60. and the layering things on top and drawing into a new graphics object is coming soon..
|
|
|
|
|