Jump to content
IGNORED

Known fast line algorithms ?


R0ger

Recommended Posts

basically it is midline displacement but the agorithm is working with so called nodes... so you have starting point+end point plus what Carpenter calls nodes... this nodes (0-255) for start and end point will produce 256 different "line types"... our researches show that they have different shapes for 0-63,64-127,128-191,192-255.... (sometimes like clouds, sometimes like canyons etc). maybe one level uses only few types... but our algorithm can produce all variants...

 

basically what you can do is precalc several type of lines and with different lengths...

 

check out the 65816 20Mhz accelerated video of RoF A8 on youtube and you see the "rounding errors" and the other short cuts...

 

btw... I can not run your PC demo... got the DLL missing error even I downloaded

 

http://www.microsoft.com/en-us/download/details.aspx?id=5555

 

on Win7 Pro 64bit?

Edited by Heaven/TQA
Link to comment
Share on other sites

So XXL sent me source code for old tests. I modified it to use my new line, and here are all 3 benchmarks (and zip with sources for the last one):

 

So while old two lines did both around 300 lines per second, this new one does about 400.

 

Also note that my old line (drsid15) uses only ORA to draw pixels, so it's not actually any much faster then Eru's line.

eru15.xex

drsid15.xex

drsid2.xex

drsid2.zip

Edited by Dr.Sid
  • Like 2
Link to comment
Share on other sites

Could you do changes that make all benchmarks doing the same?

Also in Antic D /Gr.7?

To make them draw the same lines I would have to use some predefined data. I don't thing it would differ much. As for Antic D I think that would be fairly easy, but what would be the point ?

Link to comment
Share on other sites

Ok, I modified drsid15 to replace the color, and I added color 0 to drsid2.

I still don't see why D mode would be better then E mode. Like this I don't have to modify original benchmark, which uses E mode.

True, I should have slightly less edge in D mode, as lines would be shorter on average, and my patterns are better for long lines.

drsid2b.xex

drsid15b.xex

Link to comment
Share on other sites

  • 2 weeks later...

http://atariage.com/forums/topic/211628-fast-line-drawing

 

Hello Dr. Sid. I am glad to see someone else working on this fast line drawing thing. I also do the table thing. I did not do the 4 direction thing because I want to keep things a little more compact. You never know how much space you need for the rest of your game or graphics program. My approach was to use self-modifying code to change dec/inc instructions to go left or right with the line and always draw top to bottom. Not sure you did this, but I have a table for the low and high address for each row on the screen, mine is geared to a 40 column screen. I had each of my tables start at a top of a new page, so when changing color, you just have to set the high byte. Another trick was to process 2 or 4 points within the loops, but only one process for slope math.

 

Maybe we can combine the techniques and make something that goes super fast.

 

For anyone else reading this keep in mind this is not for any specific game.

 

 

WarpLine4X.zip

  • Like 1
Link to comment
Share on other sites

One problem with anti-aliasing is that it would take up much more CPU and some suggested it will make the lines look fat giving the Atari 8-bit palette layout. The ideal is to create some super fast line drawing algorithms so we can probably make some games that are not normally possible on the Atari.

Link to comment
Share on other sites

  • 3 weeks later...

http://atariage.com/forums/topic/211628-fast-line-drawing

 

Hello Dr. Sid. I am glad to see someone else working on this fast line drawing thing. I also do the table thing. I did not do the 4 direction thing because I want to keep things a little more compact. You never know how much space you need for the rest of your game or graphics program. My approach was to use self-modifying code to change dec/inc instructions to go left or right with the line and always draw top to bottom. Not sure you did this, but I have a table for the low and high address for each row on the screen, mine is geared to a 40 column screen. I had each of my tables start at a top of a new page, so when changing color, you just have to set the high byte. Another trick was to process 2 or 4 points within the loops, but only one process for slope math.

 

Maybe we can combine the techniques and make something that goes super fast.

 

For anyone else reading this keep in mind this is not for any specific game.

 

 

 

Sorry for late reaction. I just didn't notice there is something new here. Anyway ..

 

I took this Warp4x routine and placed it inside our old test. And it is basically same speed as my best version ! Now I have to really understand, how it works ..

warp4x.xex

Link to comment
Share on other sites

The slope math inside the tall or wide loops....

 

 

LDA M1 ;99 ;3
AW_WIDE_DELTA_RI=*+1
SBC #$FF ;101 ;7
STA M1 ;104 ;10
BCS AW_WIDE_SKIP ;107 ;13
AW_WIDE_DELTA_CI=*+1
ADC #$FF
STA M1

....

....

AW_WIDE_SKIP

Replace with

DEC M1

BNE AW_WIDE_SKIP

LDA [new countdown value]

STA M1

AW_WIDE_SKIP

 

Problem is trying to figure out how much to count down from might take as much CPU or adding more tables that take up more memory. It is a theory I had been trying to work out, but I need to find a fast table division routine to make something like that work.

Edited by peteym5
Link to comment
Share on other sites

Well .. that is exactly the part of the code I don't understand at all. I think I understand most of the rest, like the division into 4 shorter lines.

It's hard to read when combined with self-modifying approach. What kind of algorithm is it ? Do you have some simpler code of the algorithm ?

The division into 4 lines seems to be the trick behind the speed. On the other hand it produces some minor inacuracies along the line. At the moment corectness of the algorithm is important for my application (still secret, sorry ;-D), but I have to experiment with it a bit.

Link to comment
Share on other sites

Its a thought, maybe someone can get us a fast table division routine.

 

Slope Math on the horizontal (Long Slope) is how many pixels it has to go before changing the row. On Vertical (Tall Slope), it would be how long it goes before changing column. Been trying to figure out a less CPU clock cycle alternative to do this.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...