| |
Cybernator
Registered: Jun 2002 Posts: 154 |
STr34kZ (aka. EOR lines)
Streaks, not freaks. :)
Does anyone have any idea how to _completely_ avoid the streaks in EOR fillers. SLJ in his tutorial mentioned that ---*--- intersections will fail. I wanted a complete 3D scene to be EOR filled at once. After some experimenting I came up with a technique to handle obscured objects, objects partially or wholly on the top of another, and it works ok (as long as the filling of a single object is successful). Pick up yer jaws, this doesn't work at realtime. :) Because of this, implementing of an algorithm to handle these intersections will not be a trouble, but I can't think of anything.
Lines are drawn from left to right and the last pixel is not drawn for horizontal lines (where dx>dy). For vertical lines, I don't draw the endpoints, and I only draw the last pixel of each vertical chunk (the way SLJ's routine works).
One interesting thing with the object where this happens is that if you watch it from the other side, there're no streaks.
Check out: http://www.geocities.com/lazeristoski/eor.zip
Use left/right arrows to change frames, F to toggle filling.
Btw, clipping against the upper border is handled as well, though you won't see that from the animations I have included.
Ah yes, make sure you have DirectX 7 or later installed. :P
(addon: just drag one of the .eor files onto the Exorizer.exe)
|
|
... 19 posts hidden. Click here to view all posts.... |
| |
Krill
Registered: Apr 2002 Posts: 2940 |
yes, i do that as well. |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
in my routines there is no such things as "lines drawn more than once" so i do not have to eliminate them. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
oldest trick in the book ;) |
| |
Oswald
Registered: Apr 2002 Posts: 5076 |
graham ?! how do you do that ? |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
1. Perform backface removal.
2. Set all edge colors to 0.
3. For each face take face-color and eor the color with the color of each corresponding edge.
4. Draw all the edges using EOR.
5. EOR-fill.
Kind of, sort of... :D
ps. only works for convex objects naturaly. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
guess the code could look something like this, if the facevisibles were either $00 or $ff for true/false...
lda #facecolor0
and facevisible0
sta tmp
lda #facecolor1
and facevisible1
eor tmp
sta linecolor
|
| |
Oswald
Registered: Apr 2002 Posts: 5076 |
Quote: in my routines there is no such things as "lines drawn more than once" so i do not have to eliminate them.
jackasser, cruzer: you write how to actually eliminite, but graham says he doesnt has to... (?!?!) |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
i guess you don't have to eliminate double lines in realtime if the lines are "born" knowing that they always have to consider two faces' colors and visibility to get their own line color. |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
@Oswald:
something like JackA said. i do not think of the lines as "edges of a polygon" but rather "polygons are neighbours of the lines". |
| |
Cybernator
Registered: Jun 2002 Posts: 154 |
Some blah-blah about Z-sorting now. :) The 3 boxes work perfectly, but look what happens with my aircraft. http://www.geocities.com/lazeristoski/aircraft.zip
The jpg screenshot shows you how the wings are connected to the fuselage. As you can see the sorter doesn't work as it's supposed to. The aircraft is divided into several objects: fuselage (the box), cockpit, left wing, and right wing. This is because an object is assumed to have no overlapping faces. (of course front faces overlap back faces, but I'm talking about overlapping of a front face with another front face).
I calculate the centers of each object like this:
center.x=center.y=center.z=0;
for (i=0; i<nr_vertices; i++)
{
...center.x+=vertex.x;
...center.y+=vertex.y;
...center.z+=vertex.z;
}
center.x/=nr_vertices;
center.y/=nr_vertices;
center.z/=nr_vertices;
Now I do the following:
- rotate the aircraft
- before I project the points, I sort the objects according to the Z coord of the rotated centers
This is what I read in a tutorial (the PXD series, I think). But obviously this is not correct. All the tutorials I've found about Z-sorting deal with different sorting algorithms (bubble vs radix vs quick), but none of them tells _what_ to sort.
Any tips?
|
Previous - 1 | 2 | 3 - Next |