ac.tomo Posted July 13, 2020 Share Posted July 13, 2020 (edited) I'm looking to see if anyone can give me a routine or method (doesn't matter in BASIC or M/C; preferably in BASIC, no matter how slow it runs, once I understand it then I can transfer it to M/C if I desire) that colour fills 3D wire frames. I do have a routine to do the 3d wire-graphics, but trying to fill in particular segments (for solid 3d graphics) is bemusing me. If you want me to give you the routine I use, I can, I was just hoping to see if someone has a routine thats a bit simpler than mine. Edited July 13, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
dmsc Posted July 14, 2020 Share Posted July 14, 2020 Hi! 4 hours ago, ac.tomo said: I'm looking to see if anyone can give me a routine or method (doesn't matter in BASIC or M/C; preferably in BASIC, no matter how slow it runs, once I understand it then I can transfer it to M/C if I desire) that colour fills 3D wire frames. I do have a routine to do the 3d wire-graphics, but trying to fill in particular segments (for solid 3d graphics) is bemusing me. If you want me to give you the routine I use, I can, I was just hoping to see if someone has a routine thats a bit simpler than mine. The idea is to split the 3D object in triangles, then draw each (filled) triangle in turn. - If you draw triangles from the farthest to the nearest, you must paint each new triangle over the ones that are behind, removing them from view - this is the https://en.wikipedia.org/wiki/Painter's_algorithm - If you draw triangles from nearest to farthest, you must only paint over background and avoid painting over the ones already painted - this is the "reverse painter's algorithm" The first method is usually the faster, as you don't need to test each pixel before painting it. After you made it work, a common optimization is to only paint triangles in which the normal (the direction which the triangle is facing) points toward you, as you can assume that triangles pointing away from you are not visible. So, you only nee three algorithms: - An algorithm to project all triangles in the scene, converting the coordinates to screen coordinates - this is called the Geometry Pipeline in modern graphics, and it is done by the "geometry shaders". - An algorithm to sort all triangles by the distance to the observer. - An algorithm to paint a triangle given its three points (in 2D, as those are already projected) - this is called the Rasterization Pipeline in modern graphics, and it is done by the "pixel shaders". Modern 3D hardware you don't sort triangles, instead a buffer holds the distance from the observer for each point (the z-buffer), and the rasterization performs a test on each pixel before painting it. Note that if you are only drawing a convex object, you don't need to paint the triangles, if you only draw the triangles with the normal pointing towards the camera the object will appear ok. But convex objects are not fun . Have Fun. 4 Quote Link to comment Share on other sites More sharing options...
+gnusto Posted July 14, 2020 Share Posted July 14, 2020 The technique you want to read up on is rasterization/rasterfill, which used to all be done in software via CPU programs, but nowadays is usually done by a 3D card or a specialized CPU instructions. https://www.golombeck.eu/index.php?id=34&L=1 This a machine language version for the Apple II, so in terms of output it has to go through weird Apple memory striping, but the principles of rasterizing a polygon are there. 1 Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 6, 2020 Author Share Posted October 6, 2020 Sorry for the time its taken, but thankyou both for the information. I know there are several ways of getting 3d wire graphics, but if one of you can confirm that this apple program is the way to progress to 'solid' graphics then i'll go further and delve into this link. I presume this apple method uses points and lines. Any further help much appreciated. Quote Link to comment Share on other sites More sharing options...
+gnusto Posted October 7, 2020 Share Posted October 7, 2020 The Golombeck demo has filled rasterization in version 2.42 (apple dsk image is linked on the page above), but I don't think he's released the source code for that version yet. Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted October 7, 2020 Share Posted October 7, 2020 20 hours ago, ac.tomo said: Sorry for the time its taken, but thankyou both for the information. I know there are several ways of getting 3d wire graphics, but if one of you can confirm that this apple program is the way to progress to 'solid' graphics then i'll go further and delve into this link. I presume this apple method uses points and lines. Any further help much appreciated. Depending on the type of graphics, there are a couple of tricks you can play. "Rescue of Fractalus" is such an example. It draws the wireframe of the mountains first, and then performs a "fill" by a series of "OR" (or "AND") instructions that combine the color of the row above with the color of the row below. Thus, one starts with A = 0 (for the "OR" example), then takes the OR of that with the current position on the screen, then write the result into the cell, and continue that way from top to bottom. Once a line is hit, the value in A receives a 1 bit that is, by the above algorithm, replicated into all lines below the current line. With this trick, one can fill quickly large areas as you can fill 4 (for Gr.15) or 8 (Gr.8) pixels at once by a single operation. For games like Rescue, this works as the bottom of the screen contains always solid areas (the mountains) and the top is always light (the sky). Another trick is played by "Capture the flag". Essentially, the algorithm is the same, though only the upper half of the maze is drawn. The lower half is not drawn at all, the contents is just replicated by ANTIC by a specially prepared display list that just reflects the upper part into the lower part. Quote Link to comment Share on other sites More sharing options...
emkay Posted October 7, 2020 Share Posted October 7, 2020 Antic Mode D is the most relevant part for "solid 3D" in games like RoF and Ctf. Fastest CPU speed for calculations and drawing on the screen. Ctf uses parts of the screen in Mode E to have a less symmetric view. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 8, 2020 Author Share Posted October 8, 2020 Yes, that's an excellent way to do tasks like that in Rescue o F, but I'm looking to, say, rotate a 3d solid cube for example. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 8, 2020 Share Posted October 8, 2020 (edited) Maybe read these Page 6 / Atari User articles and as an exercise combine the two, e.g. take the wireframe area but call to draw a polyfill instead? https://archive.org/details/Atari-User-035-Mar88-Create-Stunning-3D-Wire-Graphics-GB https://www.atariarchives.org/c2ba/page085.php (I've attached listing as pasting into Altirra from the original had errors (spaces between YY) Another approach is to use the XIO fill: http://www.page6.org/archive/issue_08/page_28.htm (listing & Basic Rev C file attached) polygon.lst fire.bas fire.lst Edited October 8, 2020 by Wrathchild May->Maybe Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 9, 2020 Share Posted October 9, 2020 (edited) On 10/7/2020 at 6:31 PM, thorfdbg said: Depending on the type of graphics, there are a couple of tricks you can play. "Rescue of Fractalus" is such an example. It draws the wireframe of the mountains first, and then performs a "fill" by a series of "OR" (or "AND") instructions that combine the color of the row above with the color of the row below. Thus, one starts with A = 0 (for the "OR" example), then takes the OR of that with the current position on the screen, then write the result into the cell, and continue that way from top to bottom. Once a line is hit, the value in A receives a 1 bit that is, by the above algorithm, replicated into all lines below the current line. With this trick, one can fill quickly large areas as you can fill 4 (for Gr.15) or 8 (Gr.8) pixels at once by a single operation. For games like Rescue, this works as the bottom of the screen contains always solid areas (the mountains) and the top is always light (the sky). Another trick is played by "Capture the flag". Essentially, the algorithm is the same, though only the upper half of the maze is drawn. The lower half is not drawn at all, the contents is just replicated by ANTIC by a specially prepared display list that just reflects the upper part into the lower part. RoF "ANDs" 00 as "pixels" of the mountains... uses a collum based "ORA" filler... the sky is filled "til" it hits a mountain edge. the colors are cleverly choosen. it uses unrolled code for filling one collum and jumps into it by Ypos... and one of the index registers of the 6502 holds the collum (0-47) Edited October 9, 2020 by Heaven/TQA 1 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 9, 2020 Share Posted October 9, 2020 7 hours ago, ac.tomo said: Yes, that's an excellent way to do tasks like that in Rescue o F, but I'm looking to, say, rotate a 3d solid cube for example. Cube is a special case similar to pyramid... as you always see just 3 faces of the cube... so a lot of optimisations can be done here... Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 13, 2020 Author Share Posted October 13, 2020 (edited) On 10/8/2020 at 11:23 PM, Wrathchild said: Maybe read these Page 6 / Atari User articles and as an exercise combine the two, e.g. take the wireframe area but call to draw a polyfill instead? https://archive.org/details/Atari-User-035-Mar88-Create-Stunning-3D-Wire-Graphics-GB https://www.atariarchives.org/c2ba/page085.php (I've attached listing as pasting into Altirra from the original had errors (spaces between YY) Another approach is to use the XIO fill: http://www.page6.org/archive/issue_08/page_28.htm (listing & Basic Rev C file attached) polygon.lst 4.13 kB · 2 downloads fire.bas 2.7 kB · 4 downloads fire.lst 2.49 kB · 2 downloads Thankyou for this, but I dont know how to transfer these attached files to my atari or load them on my atari emulator, I have 1 of those sdmax gadgets, will that help? Edited October 13, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 13, 2020 Share Posted October 13, 2020 The l(i)st files are the text versions of the listings, so viewable in any notepad type app. With Altirra booted to Basic, you can simply copy and paste this directly and Altirra 'types' it for you. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 13, 2020 Author Share Posted October 13, 2020 Oh, ofcourse, I forgot I could enter them into a word processor. As for Altirra, I don't have a copy of that on my laptop, any ideas where I can download from? Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 13, 2020 Share Posted October 13, 2020 Keep a watch on this thread for releases Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 21, 2020 Author Share Posted October 21, 2020 thankyou wrathchild. Done all the downloading now, just have to try the basic programs out. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 21, 2020 Author Share Posted October 21, 2020 On 10/8/2020 at 11:23 PM, Wrathchild said: Maybe read these Page 6 / Atari User articles and as an exercise combine the two, e.g. take the wireframe area but call to draw a polyfill instead? https://archive.org/details/Atari-User-035-Mar88-Create-Stunning-3D-Wire-Graphics-GB https://www.atariarchives.org/c2ba/page085.php (I've attached listing as pasting into Altirra from the original had errors (spaces between YY) Another approach is to use the XIO fill: http://www.page6.org/archive/issue_08/page_28.htm (listing & Basic Rev C file attached) polygon.lst 4.13 kB · 6 downloads fire.bas 2.7 kB · 8 downloads fire.lst 2.49 kB · 7 downloads That fire engine is cool, but how do I load the LiSTed files into Altirra? Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 21, 2020 Share Posted October 21, 2020 (edited) You should be able to open Altirra to the basic READY prompt and then simply right click and paste having copied it from notepad. I would recommend however setting up the H: drive. Use the menu 'System / Configure System' then select 'Peripherals / Devices'. Choose 'Add...' and from there select the "H:" device. Map the path to a convenient folder. By loading/saving anything to H1-4 will be the same as saving to an Atari drive. By loading/saving to H6-9 instead, any $9B (newline) characters are translated to CR/LF and so easier to edit in your editor of choice. So the ".lst" files I attached were saved via: LIST "H6:FIRE.LST" and can be loaded via: ENTER "H6:FIRE.LST" Edited October 21, 2020 by Wrathchild 2 Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 22, 2020 Author Share Posted October 22, 2020 Thankyou for that Wrathchild, very useful. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 23, 2020 Author Share Posted October 23, 2020 On 10/21/2020 at 5:38 PM, Wrathchild said: You should be able to open Altirra to the basic READY prompt and then simply right click and paste having copied it from notepad. I would recommend however setting up the H: drive. Use the menu 'System / Configure System' then select 'Peripherals / Devices'. Choose 'Add...' and from there select the "H:" device. Map the path to a convenient folder. By loading/saving anything to H1-4 will be the same as saving to an Atari drive. By loading/saving to H6-9 instead, any $9B (newline) characters are translated to CR/LF and so easier to edit in your editor of choice. So the ".lst" files I attached were saved via: LIST "H6:FIRE.LST" and can be loaded via: ENTER "H6:FIRE.LST" Can this also be accomplished on the Atari800win emulator? Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 26, 2020 Author Share Posted October 26, 2020 I recently lost my altirra 64 after a seize on my laptop[, and am now using just altirra. I know I can download it again, but can anyone tell me the difference between the two? Quote Link to comment Share on other sites More sharing options...
zbyti Posted October 26, 2020 Share Posted October 26, 2020 On 10/23/2020 at 8:58 PM, ac.tomo said: Can this also be accomplished on the Atari800win emulator? Yes Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 26, 2020 Share Posted October 26, 2020 44 minutes ago, ac.tomo said: the difference between the two 64 bits will be faster and more efficient as the processor handles more data in the cycle. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted October 26, 2020 Author Share Posted October 26, 2020 (edited) Thankyou Wrathchild. Edited October 26, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted November 3, 2020 Author Share Posted November 3, 2020 (edited) That Atari user program you (wrathchild) directed me to doesn't work properly, I did actually try this program several months ago and had problems with it, perhaps someone can work out what the problem is. I did put INT functions on lines 190 and 200 and that let me put 3 'faces' in instead of 2, but if I put, say, 15 faces the program errors. au35.lst Any help much appreciated. EDT: forgot to put the Atari user link in: http://www.atarimania.com/mags/pdf/Atari-User-Vol-3-No-11.pdf EDT: here's a slightly modified listing au35.lst Edited November 7, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.