English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   Blitter fill problem (http://eab.abime.net/showthread.php?t=83173)

mekhall 19 June 2016 14:38

Blitter fill problem
2 Attachment(s)
Hi all,

I have decided to do now what I was not able to in the beginning of 90:ies when I first tried out Amiga assembler - do some sort of simple demo.

For this I'm starting out with the "classic" rotating 3d graphics.

Right now I'm having some problems with the blitter area fill. I am drawing my lines with the one-dot bit set, I'm drawing them from top to bottom and I'm blitting the first pixel of the line Elsewhere. I thought that was all that was needed to get the polygon ripe for filling.

I fill after calculating a bounding box, and I fill in descending mode.

What happens is that sometimes I get horizontal lines. This is because for some line lengths and angles there is only one pixel per scanline. I guess the last pixel of the line coincides with the same pixel of the line it connects to.

I've tried to illustrate the problem in the images I'm attaching to this post.

So, what is the best way to deal with this? (I guess this is a common newbie problem)

Kalms 19 June 2016 17:42

Draw the lines using XOR mode (so if two edges attempt to draw the same pixel, they will cancel each other out). This makes narrow lines work correctly.

mekhall 19 June 2016 18:03

Why didn't I think of that?
That was the problem. Switching to minterm $4a solved the problem.

Thanks a lot! (Tack så mycket)

Mrs Beanbag 19 June 2016 19:30

weirdly, i've seen this "blit the first pixel elsewhere" trick mentioned a lot but i got polygon filling to work fine without knowing about it... it is simple enough just to use a "Height" value in BLTSIZE one less than you would usually, to omit plotting the final pixel. (without changing any of the other blitter registers, therefore not affecting the slope of the line)

mekhall 19 June 2016 23:05

Well, just blitting the first pixel elsewhere does not solve the problem completely.
Even without the first pixel I got problems with the last pixel so I needed XOR minterms as well.

Mrs Beanbag, are you saying that with the "Height" one less than usual you don't need XOR? In that case that is a more beautiful approach I would say.

Mrs Beanbag 19 June 2016 23:12

You still need XOR. You don't need to redirect the first pixel of the line elsewhere (which is kind of an undocumented blitter feature i think? and therefore a hack), like you said here: "blitting the first pixel of the line Elsewhere". It's instead of that, it omits the last pixel instead of the first. Which is equivalent if you just imagine the line going the other way.

mekhall 19 June 2016 23:25

I agree, it feels like a hack. It's strange that they did not explain why the first pixel has this special treatment within the blitter.
The blitter is obviously built for creating filled polygons so why not write down the entire process?
On the other hand, what would we do with all the spare time then? :)

Mrs Beanbag 20 June 2016 00:04

well as i just explained, you don't actually need to do it that way, as i wrote my own perfectly functional polygon filler without knowing the trick/hack and it baffles me everyone seems to insist on it.

btw if a feature is "undocumented" there is a good possibility it was unintended... but since there are not going to be any future revisions of the Amiga chipset, i wouldn't worry too much about this "bug" being "fixed".

All times are GMT +2. The time now is 16:19.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.04467 seconds with 11 queries