English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 19 June 2016, 14:38   #1
mekhall
 
Posts: n/a
Question Blitter fill problem

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)
Attached Thumbnails
Click image for larger version

Name:	fill-problem.png
Views:	177
Size:	3.5 KB
ID:	48907   Click image for larger version

Name:	fill-problem-zoom.png
Views:	172
Size:	4.3 KB
ID:	48908  
 
Old 19 June 2016, 17:42   #2
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
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.
Kalms is offline  
Old 19 June 2016, 18:03   #3
mekhall
 
Posts: n/a
Why didn't I think of that?
That was the problem. Switching to minterm $4a solved the problem.

Thanks a lot! (Tack så mycket)
 
Old 19 June 2016, 19:30   #4
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
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)
Mrs Beanbag is offline  
Old 19 June 2016, 23:05   #5
mekhall
 
Posts: n/a
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.
 
Old 19 June 2016, 23:12   #6
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
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.
Mrs Beanbag is offline  
Old 19 June 2016, 23:25   #7
mekhall
 
Posts: n/a
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?
 
Old 20 June 2016, 00:04   #8
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
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".

Last edited by Mrs Beanbag; 20 June 2016 at 00:18.
Mrs Beanbag is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitter Vertical Fill 71M Coders. Asm / Hardware 34 16 November 2017 22:31
Blitter fill timing leonard Coders. Asm / Hardware 42 01 September 2014 11:00
Blitter problem zeGouky Coders. Asm / Hardware 7 26 March 2014 14:12
Blitter Sweet oldskool intro problem! amilo3438 support.WinUAE 9 02 July 2013 11:44
Clipping line for blitter fill leonard Coders. Asm / Hardware 12 27 April 2013 12:03

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08073 seconds with 16 queries