24 September 2018, 11:52 | #121 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
There have been so many changes that it's hard to remember them all, but I think the biggest change was to allow the algorithm that walks down the edges calculating the x1 and x2 values to draw lines between to alternate the order in which is calculates each side, like the difference between a single and a bidirectional dot matrix printer. This means that it has to swap out the contents of the registers holding all the edge information half as often as before.
I'm currently trying to build a system where the results of scanline converting an edge can be reused, taking advantage of the fact that every edge is shared between two faces. If I can get it to work it could result in a saving, at least for bigger polygons. But at the moment it doesn't work. It's been nothing but Gurus for days now... |
02 December 2018, 20:16 | #122 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,331
|
Any news. I was enjoying this thread
|
02 December 2018, 22:47 | #123 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I've spent the last few weeks experimenting with hidden surface removal algorithms, with a few detours around importing / converting .obj files. I've attached a couple of images of what it currently looks like - it's still a long way from anything that could be called a game.
I'm quite pleased with the hidden surface removal method I've settled on, as it can be almost entirely pre-calculated, just relying on face visibility calculations that need to be done in any case. I want to create at least one more model to display before moving on to my next step, which will be to calculate the horizon so that I can draw the sky and ground correctly as the camera moves. I'm not yet 100% sure how to do that efficiently. Last edited by deimos; 21 November 2021 at 12:00. |
03 December 2018, 17:25 | #124 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
I do like the model for the plane, looks quite good
|
03 December 2018, 18:43 | #125 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
|
Nice plane, indeed..
Also looking forward to updates in this thread... |
03 December 2018, 21:36 | #126 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Thank you, it wasn’t easy to create as I need to know which polygon is which so that I can draw them in order, I couldn’t get good results with the data imported directly from Blender and had to do a lot of work by hand.
|
26 December 2018, 14:58 | #127 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I've been working on this a bit more (see attached image), and I'm having a hard time trying to correctly draw the horizon / sky and ground, and can't find any help online.
At the moment I'm trying to find the intersections of the rectangle of the screen with the ground plane which has the equation ax + by + cz = 0 (i.e. a plane going through the origin with a normal of (a, b, c), where a, b, c is the middle row of my camera rotation matrix. I can get the intersection points for the top, right, bottom and left edges of the screen, which gives me a horizon line, but I need to handle the special cases of no intersection (all sky or all ground) and I need to work out which side of the line is ground and which is sky, which doesn't seem to be as simple as looking at the Y part of the normal. Does anyone know of any off the shelf solution to this? Otherwise, my next best idea is to define the screen as a polygon and find some code to clip a polygon to a plane, but I'm not sure what that will look like and whether it will solve my sky vs ground issue. Last edited by deimos; 21 November 2021 at 12:00. |
26 December 2018, 17:59 | #128 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
This is what I'm currently thinking and will try and code up tomorrow unless there's a better answer out there:
The screen is a polygon, a rectangle from xmin, ymin to xmax, ymax and is located at the viewing distance (256) from the origin: Code:
(-160, 127, 256), (-160, -128, 256), ( 159, -128, 256), ( 159, 127, 256) The ground plane is defined by ax + by + cz = 0, where a, b, c is determined by the orientation of the camera. Each point in the screen polygon is above or below the ground plane, which can be determined by plugging in the x, y, z values into the plane equation. Positive numbers mean above the plane, negative means below and zero means exactly on the plane which I'll treat as below. Assuming the screen in sky colour (not wasted if there's only a single bit to change between sky and ground): Code:
if all the points are above the plane then it's all sky, exit. if all the points are below the plane then it's all ground, draw that and exit. otherwise we have a mix of above and below, so there must be intersection points. set c (number of points in result) to zero. for each input point p let q be next point in input, wrapping around at the end if p is behind the plane copy it to result array increment c if p is behind and q is in front or visa versa calculate intersection between line pq and ground plane copy it to result array increment c draw ground as polygon in result array |
27 December 2018, 13:22 | #129 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Something like this:
Code:
static void drawGround(struct RastPort * rastPort, const Camera * camera) { WORD poly[5][2]; LONG a = ((Entity *) camera)->transformation.rotation.value[1][0]; LONG b = ((Entity *) camera)->transformation.rotation.value[1][1]; LONG cz = ((Entity *) camera)->transformation.rotation.value[1][2] << 8; // 2^8 = 256 = viewing distance WORD s[4]; s[0] = a * (DISPLAY_MIN_X - DISPLAY_MID_X) + b * (DISPLAY_MAX_Y - DISPLAY_MID_Y) + cz >= 0; s[1] = a * (DISPLAY_MIN_X - DISPLAY_MID_X) + b * (DISPLAY_MIN_Y - DISPLAY_MID_Y) + cz >= 0; s[2] = a * (DISPLAY_MAX_X - DISPLAY_MID_X) + b * (DISPLAY_MIN_Y - DISPLAY_MID_Y) + cz >= 0; s[3] = a * (DISPLAY_MAX_X - DISPLAY_MID_X) + b * (DISPLAY_MAX_Y - DISPLAY_MID_Y) + cz >= 0; WORD c = 0; if (s[0]) { poly[c][X] = DISPLAY_MIN_X; poly[c][Y] = DISPLAY_MAX_Y; c++; } if (s[0] != s[1]) { poly[c][X] = DISPLAY_MIN_X; poly[c][Y] = DISPLAY_MID_Y - (a * (DISPLAY_MIN_X - DISPLAY_MID_X) + cz) / b; c++; } if (s[1]) { poly[c][X] = DISPLAY_MIN_X; poly[c][Y] = DISPLAY_MIN_Y; c++; } if (s[1] != s[2]) { poly[c][X] = DISPLAY_MID_X - (b * (DISPLAY_MIN_Y - DISPLAY_MID_Y) + cz) / a; poly[c][Y] = DISPLAY_MIN_Y; c++; } if (s[2]) { poly[c][X] = DISPLAY_MAX_X; poly[c][Y] = DISPLAY_MIN_Y; c++; } if (s[2] != s[3]) { poly[c][X] = DISPLAY_MAX_X; poly[c][Y] = DISPLAY_MID_Y - (a * (DISPLAY_MAX_X - DISPLAY_MID_X) + cz) / b; c++; } if (s[3]) { poly[c][X] = DISPLAY_MAX_X; poly[c][Y] = DISPLAY_MAX_Y; c++; } if (s[3] != s[0]) { poly[c][X] = DISPLAY_MID_X - (b * (DISPLAY_MAX_Y - DISPLAY_MID_Y) + cz) / a; poly[c][Y] = DISPLAY_MAX_Y; c++; } if (c) { SetAPen(rastPort, FOREST_GREEN); AreaMove(rastPort, poly[0][X], poly[0][Y]); for (WORD i = 1; i < c; i++) { AreaDraw(rastPort, poly[i][X], poly[i][Y]); } AreaDraw(rastPort, poly[0][X], poly[0][Y]); AreaEnd(rastPort); } } But, it seems to work. Could it be better? |
23 January 2019, 14:38 | #130 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
|
@Deimos: Thanks for keeping on. This is really one of the most interesting topics here for me at EAB currently...
I loved Starglider and Elite, and though I am not keen on coding stuff like this myself, it#s interesting to see your progress... |
23 January 2019, 21:15 | #131 | |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Quote:
But, life, huh, gets in the way. It will be a few weeks at least before I get more time to work on it. |
|
28 March 2019, 14:58 | #132 |
Registered User
Join Date: Jun 2016
Location: UK
Posts: 428
|
I came across this blog post today: https://jix.one/pushing-polygons-on-the-mega-drive/
It's about doing 3D on the Megadrive but some of the techniques could be used on the Amiga. For example, their engine renders left to right, so you only need to accurately draw the left edge of every polygon and the right edge can just be rounded up to the nearest 16 pixels, because it will be overdrawn anyway. |
28 March 2019, 16:28 | #133 | |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
Quote:
|
|
28 March 2019, 18:19 | #134 |
Registered User
Join Date: Jun 2016
Location: UK
Posts: 428
|
I'm interested in how they did the rotozoomer but there isn't any real info available.
|
19 December 2019, 11:49 | #135 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
I just watched the YT vid of StarGlider 2 and didn't notice super high framerates. Very often it fell below 5 fps (possibly 2-3). Few things I noticed:
- ~60% of screen is covered in HUD - of remaining ~40%, half is empty horizon, leaving ~20% for 3D objects - of the ~20%, about half is mostly empty due to view distance - leaving about ~25 scanlines where most of 3D object's scanlines are drawn - and of those 25 scanlines, majority is a checkerboard that only needs 4 vertices transformed, the rest is merely interpolated via bitshifting resulting in an opportunity to write a specialized checkerboard function that gives an illusion of ~64 polygons, when in reality it's just one. Since most of the time the objects are thin, couple pixels wide, there's no point in spinning Blitter up, just simple SW rasterizing for each scanline (1-6 pixels in distance) Highly likely, there's several object-specific drawing routines. Noticed several candidates right in first viewing. |
19 December 2019, 12:08 | #136 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
|
What I noticed with SGII is, that there are usually not more than around 30 polygons displayed, without the floor.
I'd love to see a game with SGIIs aesthetics, but for a bit a faster machine, like a 68060 or even a vampire. Would look splendid. |
19 December 2019, 12:34 | #137 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Yeah, unfortunately, flatshaded look has not really been pushed anywhere its limits outside of some obscure arcades (but those games look absolutely marvelous - sharp, detailed, super high contrast (no bilinear filter) - very unique look).
I'm actually doing just that on Jaguar - pushing HiRes (640x240), HiColor (65,536) at 60 fps with flatshading. It's quite fun. 68060 should achieve same/better framerate but with lightmapped textures and roughly ~4x polycount I believe. If we ditched the textures, then it's very hard to estimate what kind of scene complexity is possible. I'd guess ~10-50x ? You could get floating point transformations done in parallel to integer unit execution - a cleverly written routine could be in parallel feeding floating point pipeline while it's traversing scanlines... What kind of config is a vampire ? |
19 December 2019, 12:48 | #138 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
|
Some guys took the 68040, built some stuff on top of it and called it the "68080". They use it within an FPGA.
Those cards with this FPGA are called "Vampire" cards. See here for a short tour of the standalone Vampire card (others are available for plugging into an Amiga600, and Amiga 500 (works also in a 1000, though). [ Show youtube player ] |
19 December 2019, 13:15 | #139 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Nice! A rough estimate of 250 MHz 68060 !
That should easily drive HiPoly flatshaded scenes in 640x480. Wonder how Blitter works there ? Is it blitting at the full RAM bandwidth of 670 MB/s? That would be sweet ! |
19 December 2019, 16:37 | #140 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,918
|
The 080 CPU allows 64 bit mem accesses while the blitter does only 16 bit. Since the blitter and CPU memory accesses are serialised in the V4 due to long mem bursts, the blitter always loses when compared with a CPU-only routine regardless of the memory bandwidth.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Games that are Full Frame Rate or Slower - Limitations or Choice? | Foebane | Retrogaming General Discussion | 35 | 08 April 2018 13:22 |
F1 grand prix frame rate | universale | support.Games | 18 | 13 July 2015 21:45 |
The First Person Shooter frame rate tolerance poll... | DDNI | Retrogaming General Discussion | 41 | 30 June 2011 03:32 |
Vsync Fullscreen and Double Buffer, incorrect frame rate? | rsn8887 | support.WinUAE | 1 | 07 April 2011 20:43 |
Propper speed request when recording with "Disable frame rate" turned on. | Ironclaw | request.UAE Wishlist | 9 | 02 August 2006 07:21 |
|
|