Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline ScaliTopic starter

  • Newbie
  • *
  • Join Date: Jan 2012
  • Posts: 11
    • Show only replies by Scali
Subpixel-corrected lines and polygons on Amiga
« on: January 12, 2012, 01:46:01 PM »
Hello,
 
Some of you may already have seen my post on abime.net, but if not, I'd like to share it here as well:
 
I have recently picked up programming on the Amiga again, and decided to tackle the age-old problem of rendering polygons using the Amiga blitter.
I have kept a log of my progress, which you can find here (yes, it also includes some PC/DOS programming stuff, the Amiga stuff starts in part 2):
http://scalibq.wordpress.com/2011/11...d-skool-style/

But in particular I'd like to share parts 5 and 5.1, because after dissecting the blitter's capabilities, I realized that it was possible to apply subpixel-correction to the lines, at relatively low extra cost:
http://scalibq.wordpress.com/2011/12...t-real-part-5/
http://scalibq.wordpress.com/2012/01...real-part-5-1/

Hope you guys like this little trick.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #1 on: January 12, 2012, 02:27:58 PM »
Nice reading.
 

Offline ScaliTopic starter

  • Newbie
  • *
  • Join Date: Jan 2012
  • Posts: 11
    • Show only replies by Scali
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #2 on: January 13, 2012, 03:45:28 PM »
Thanks Piru!
Didn't we used to hang out together in #amycoders years ago?
In which case, ltns!
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #3 on: January 13, 2012, 03:47:43 PM »
Quote from: Scali;675614
Thanks Piru!
Didn't we used to hang out together in #amycoders years ago?
In which case, ltns!

Yes we did :)
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #4 on: January 13, 2012, 04:03:00 PM »
Awww! Get a room you two ;)

Seriously, fun read! I never knew the old PC gfx chips had so much hardware in them!

Offline commodorejohn

  • Hero Member
  • *****
  • Join Date: Mar 2010
  • Posts: 3165
    • Show only replies by commodorejohn
    • http://www.commodorejohn.com
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #5 on: January 13, 2012, 04:21:08 PM »
Quote from: bloodline;675625
Seriously, fun read! I never knew the old PC gfx chips had so much hardware in them!
Neither did I, until I started reading Michael Abrash's Black Book. EGA and VGA especially are just loaded with features you never hear about anywhere else, it's a shame so few games take advantage of them. (Dangerous Dave in the Haunted Mansion does, I think Jazz Jackrabbit probably uses them as well, but a whole lot of stuff just uses unadorned framebuffer graphics.)
Computers: Amiga 1200, DEC VAXStation 4000/60, DEC MicroPDP-11/73
Synthesizers: Roland JX-10/MT-32/D-10, Oberheim Matrix-6, Yamaha DX7/FB-01, Korg MS-20 Mini, Ensoniq Mirage/SQ-80, Sequential Circuits Prophet-600, Hohner String Performer

"\'Legacy code\' often differs from its suggested alternative by actually working and scaling." - Bjarne Stroustrup
 

Offline ScaliTopic starter

  • Newbie
  • *
  • Join Date: Jan 2012
  • Posts: 11
    • Show only replies by Scali
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #6 on: January 13, 2012, 05:26:02 PM »
Hum, am I on the right forum? :)
But yea, I guess part of why us Amigans weren't impressed much with the PC platform was that PC programmers didn't use the hardware to the fullest.
Sure, even though EGA and VGA have some trickery, they're not quite as advanced as the Amiga's blitter. On the other hand, they're not as bad as 'just a framebuffer'. Mind you, EGA has sort of a 'chunky2planar' mode built in, which the Amiga does not (with the exception of the Akiko chip in the CD32... and why didn't they put it in standard A1200 and A4000? They would have made wolf3d/doom clones easier and faster, and the Amiga may have survived as a gaming platform longer).
 
I guess the same can be said for Atari ST. Not as advanced as an Amiga, but you could do some clever tricks (and later models DID have a blitter, I only found that out much later. Again, not as good as the Amiga one, but nevertheless, better than nothing). There just weren't that many great games and demos that showcased them. In retrospect, I think some Atari ST demos may actually be even more impressive than Amiga demos.
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #7 on: January 13, 2012, 05:46:18 PM »
The c2p function provided by Akiko was of little real value... As soon as you have fastram, the CPU can outperform it. A true chunky mode would have been much more welcome :(

-edit- Though it should be noted that we did get the Akiko c2p free with the CDROM controller, where as fast ram would have added a few more cents to the cost of the machine and Commodore couldn't entertain that idea ;)
« Last Edit: January 13, 2012, 05:48:25 PM by bloodline »
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #8 on: January 13, 2012, 07:04:58 PM »
Quote from: Scali;675633
I guess the same can be said for Atari ST. Not as advanced as an Amiga, but you could do some clever tricks (and later models DID have a blitter, I only found that out much later. Again, not as good as the Amiga one, but nevertheless, better than nothing). There just weren't that many great games and demos that showcased them. In retrospect, I think some Atari ST demos may actually be even more impressive than Amiga demos.
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.
 

Offline Zac67

  • Hero Member
  • *****
  • Join Date: Nov 2004
  • Posts: 2890
    • Show only replies by Zac67
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #9 on: January 13, 2012, 09:22:16 PM »
@Scali

Pretty cool. Thinking that it took >25 years to find out what the Blitter really can do kinda scares me... ;)
 

Offline bbond007

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show only replies by bbond007
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #10 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 Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #11 on: January 14, 2012, 11:35:43 AM »
Welcome to the site. As intro posts go, that was pretty interesting stuff. I only read the last part so far, so I think I'll grab a quick brew and read the rest.


Quote from: Scali;675467
Hello,
 
Some of you may already have seen my post on abime.net, but if not, I'd like to share it here as well:
 
I have recently picked up programming on the Amiga again, and decided to tackle the age-old problem of rendering polygons using the Amiga blitter.
I have kept a log of my progress, which you can find here (yes, it also includes some PC/DOS programming stuff, the Amiga stuff starts in part 2):
http://scalibq.wordpress.com/2011/11...d-skool-style/

But in particular I'd like to share parts 5 and 5.1, because after dissecting the blitter's capabilities, I realized that it was possible to apply subpixel-correction to the lines, at relatively low extra cost:
http://scalibq.wordpress.com/2011/12...t-real-part-5/
http://scalibq.wordpress.com/2012/01...real-part-5-1/

Hope you guys like this little trick.
int p; // A
 

Offline ScaliTopic starter

  • Newbie
  • *
  • Join Date: Jan 2012
  • Posts: 11
    • Show only replies by Scali
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #12 on: January 14, 2012, 11:50:50 AM »
Quote from: bbond007;675715
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.

Sounds reasonable yes. On Amiga, most time-critical stuff is done with the copper, not the CPU. So the copper emulation needs to be very precise, but the CPU generally doesn't.
Atari is more like a C64, where you often craft code to run exactly X cycles, then you change some hardware registers at exactly the right pixel.
 
Perhaps this is not the best place to admit it... ;) But I have an Atari ST myself. I got it after its prime though, somewhere in 1997 or so I think. See, one of my other hobbies is music, and I wanted an Atari for Cubase. I've tried a few games and demos on it, but concluded they were not as good as the Amiga. Partly because I didn't 'get' them, I suppose. I mean, a lot of Atari demos use fullscreen parallax scrolling effects. To an Amiga guy that's a bit of a 'so what?'. But if you know what hoops the Atari guys had to jump through to make it possible on their machine, it's a different story.
There's not a lot of 3d stuff on Atari ST... But this one is pretty incredible: http://www.pouet.net/prod.php?which=109
And that's just software too, not even using the blitter found on the later models.
 
I have no excuse for the music though... even a C64 sounds better than the Atari ST, if you ask me.
 
Quote from: bbond007;675715
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.

Yea, that's when PC scene started to get serious. Around 1990/1991 the first modplayer routines appeared on PC, and soundcards started getting support.
3d was still mostly bruteforce, but that was exactly what the PC was good at. The 286 was already a much faster CPU than the 68000, with speeds up to 25 MHz.
And VGA was nicer for chunky effects, as it had a native chunky format.
 
Quote from: bbond007;675715
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.

I think the sad part is that the 386 had been around since 1985, but it took until about 1992 before 32-bit code became commonplace. DOS did not support the 32-bit mode, and there were no alternatives, until eventually the DOS extenders arrived.
But it makes the Vectordemo even more impressive I guess, because it just runs in 16-bit mode. I believe Triton's Crystal Dream is also purely 16-bit (Crystal Dream II is 32-bit though).
 
I'm still a bit in two minds about VGA. Some parts of it are nice... other parts are nasty. Chunky mode is nice, unchained mode is nice... But the latches being only 8-bit large is rather limited. Lack of proper blitting and shifting is also a shame. And the fact that you can only address 64k of memory at a time. That means that in chunky mode, you cannot use a backbuffer in videomem. In fact, having to use separate videomem in itself is nasty. Reading back videomem has always been a bottleneck. The only way to avoid that was to have a buffer in sysmem. But that meant you had to memcpy() it to videomem every frame. And with the slow ISA bus and no proper DMA to do that for you... it wasn't pretty. It wasn't really feasible until 486 and VLB arrived, and the copy speed was getting good enough.
 

Offline NovaCoder

Re: Subpixel-corrected lines and polygons on Amiga
« Reply #13 on: January 14, 2012, 12:19:53 PM »
Cool interesting stuff, maybe I'll put some of it to use one day :)
Life begins at 100 MIPS!


Nice Ports on AmiNet!
 

Offline Mrs Beanbag

  • Sr. Member
  • ****
  • Join Date: Sep 2011
  • Posts: 455
    • Show only replies by Mrs Beanbag
Re: Subpixel-corrected lines and polygons on Amiga
« Reply #14 on: February 01, 2012, 11:14:04 PM »
this is awesome, I am going to try this.

The planets on Damocles/Mercenary III are subpixel correct circles, which I remember thinking was rather neat.
Signature intentionally left blank