Welcome, Guest. Please login or register.

Author Topic: Subpixel-corrected lines and polygons on Amiga  (Read 8394 times)

Description:

0 Members and 3 Guests are viewing this topic.

Offline bbond007

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show all replies
Re: Subpixel-corrected lines and polygons on Amiga
« on: January 14, 2012, 04:01:30 AM »
Quote from: Piru;675648
I have to agree. Some of the Atari stuff is just mind-boggling, especially considering the limitations. I've had many very interesting chats with Wiztom of Aggression (he's a game developer at Housemarque btw) about Atari and how the custom HW differ from Amiga.


I read somewhere that Atari ST emulation requires more precise CPU emulation that is necessary for Amiga and MAC emulation. I don't believe I have ever seen an actual Atari ST in action.

I remember seeing Ultraforce Vector demo back when I had a 286 with Tsing et4000 VGA and that demo was the first demo I had seen on the PC that impressed me. I also had an A500 at the time. Most everything else up to that was just some fake raster bars and scrolling text done with pure CPU brute force. the other impressive thing to consider about the Vector demo is that the PC's SandBlaster card of that day had one grainy 8 bit channel so they are doing some CPU sound mixing there too.

VGA was not really bad hardware at all. The bigger issue was the brain-dead CPU it was attached to with the 64K segmented architecture. Still, I loved the Borland Turbo C and Turbo Pascal IDE. That is what really got me into programming. One really good source for banging the VGA (and other) hardware in Turbo Pascal was SWAG. Unfortunately I can't find the archive with the nice original DOS based reader.

Sadly I never programmed on the Amiga in anything other than basic.
 

Offline bbond007

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show all replies
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #1 on: February 19, 2012, 09:25:09 PM »
Quote from: Mrs Beanbag;678754
One thing I might try next is to use the HAM screen mode as a polygon filler.  You'd only need HAM5 as well, not full HAM6.

The theory is, fill the whole screen with $10 which copies the pixel to the left but changes the blue component, then you can fill any shape instantly by using the paletted colours $0-$F (as long as these colours only use red and green components), simply plot the colour you want down the left hand edge and make sure to set it back again on the other edge.  One could render something like a tunnel fairly easily.


I have been struggling with OpenGL ES programming and I have also recently decided to finally learn c programming on the Amiga. I thought maybe it would help me in both areas to try and implement the HAM5 mode polygon filler. I think maybe I struggle with OpenGL because I don't understand basic old school 3D. That and I suck at math...

Anyway, here are the results so far. As you can see its not perfect. I have also found that HAM5 mode does seem to work correctly on my Amiga 1200, however does work on my WinUAE and my Minimig 1.1.

On all of the downward winding lines of each polygon I'm looking at the pixel (actually 4 because I don't know how to find the exact pixel) at the midpoint of the line I'm about to draw to determine if I should draw the line. I guess its either that or I would have to sort the polygons so they draw left to right. I'm sure there must be a better way to do this.

Sorry for the iPhone screen shots. I don't have any program on the Minimig ATM to capture HAM screens.

Thanks

nate
 

Offline bbond007

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show all replies
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #2 on: February 19, 2012, 11:39:20 PM »
Here is the test program, I'm still trying to figure out why it likes to crash on my a1200...

also, I think subpixel correctness could really help this out, the problem with the bleeding in the HAM mode is somewhat related to the routing of the lines... oh, I'm lost...

EDIT:
I just removed the bad language from the source and included it...
« Last Edit: February 20, 2012, 12:12:31 AM by bbond007 »
 

Offline bbond007

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show all replies
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #3 on: February 22, 2012, 12:12:48 AM »
Quote from: Scali;681084
I briefly cover this in my blogs, also pointing out that ordering your edges is reasonably simple when you go with strictly clockwise or strictly counter-clockwise order. The polygon can be seen as a circular linked list, which you can just rotate around until you have the top vertex first. Then moving from begin-to-end in the list gives you one side of the polygon top-down, and moving from end-to-begin in the list gives you the other side top-down.
 
I hope that makes some sense.

A little. At least I think I understand now why I seem to have two lines to the exact same points taking different routes. Same line, just drawn in different directions. I understand how to fix that now from reading your blog - "we sort the points of each line on their y-coordinates, so they are always rendered top-down"

I know I have the ordering of my edges done consistently as the surface removal scheme relies on that.

I guess where I'm getting lost is for the application of the HAM mode renderer.

I would probably just like to eliminate redundant lines(draw them once in the correct color) because I'm not trying to make a mask for a filling operation. Is there any sort of trick to doing that?

I hope I can get this working. I was initially kind of discouraged that HAM5 did not work on the 1200, but I just remembered it has HAM7 :)  
Thanks

nate