The MASM Forum

Projects => Game Development => Topic started by: HSE on September 07, 2024, 09:06:40 AM

Title: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 07, 2024, 09:06:40 AM
Hi all!

Just revisiting projects (Have somebody implemented thick line algorithm? (https://masm32.com/board/index.php?topic=7241.0)) from some time ago, and searching a little, I found and interesting algorithm: a thick-xiaolin-wu line  :eusa_clap: 

Very interesting itself, and a useful idea to advance in those old projects  :biggrin:

The fast translation can be added to Pixelmap extension (https://masm32.com/board/index.php?topic=8232.0).

Uploaded the method and a binary test.

Regards, HSE.
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: NoCforMe on September 07, 2024, 09:35:55 AM
Downloaded it, looks good. But why do I get this message box? (Works fine after I dismiss it.)

(https://i.postimg.cc/p9pDTZrj/Debug-Error.jpg) (https://postimg.cc/p9pDTZrj)
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 07, 2024, 09:44:52 AM
Quote from: NoCforMe on September 07, 2024, 09:35:55 AMBut why do I get this message box?

Apparently you don't have DebugCenter.

Updated a release version in first post.

Thanks, HSE
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: NoCforMe on September 07, 2024, 11:28:09 AM
What is DebugCenter? Is it something so cool I must have it?
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 07, 2024, 11:55:41 AM
Quote from: NoCforMe on September 07, 2024, 11:28:09 AMWhat is DebugCenter? Is it something so cool I must have it?

Active forum people know very well DebugCenter (https://masm32.com/board/index.php?topic=10610.0) from a live time.

It's not recommended to people who enjoy to suffer programming  :biggrin:
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: NoCforMe on September 07, 2024, 12:39:51 PM
Says ObjAsm. I don't use ObjAsm.
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: Biterider on September 07, 2024, 03:57:16 PM
Hi HSE
It works absolutely fine.
It comes in very handy. It is one of the features I have been looking for for some time.  :thumbsup:

Regards, Biterider
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: Biterider on September 07, 2024, 04:06:50 PM
Hi NoCforMe
DebugCenter is a harmless debugging tool written using ObjAsm, but can be used in any other programming environment.
It is open source so you can check it out.
You do not need the framework it was written with, nor any knowledge of it.

I added a separate link in the ObjAsm section some time ago for quick access if anyone wants to try it out.
https://masm32.com/board/index.php?topic=10610.0 (https://masm32.com/board/index.php?topic=10610.0)

Biterider



Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 07, 2024, 11:39:22 PM
Quote from: NoCforMe on September 07, 2024, 12:39:51 PMI don't use ObjAsm.

To build an application that show results in DebugCenter are used a couple of includes and a library, like for any debug system.

But to see results from that applications only DebugCenter.exe is needed.

This is not the case. I just was checking some internal values.
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 07, 2024, 11:48:01 PM
Hi Biterider!

Quote from: Biterider on September 07, 2024, 03:57:16 PMIt comes in very handy

:thumbsup: At least an additional graphic option.

HSE
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: NoCforMe on September 08, 2024, 03:59:47 AM
Quote from: HSE on September 07, 2024, 11:39:22 PMTo build an application that show results in DebugCenter are used a couple of includes and a library, like for any debug system.

My own debugger, LogBuddy, uses a couple of includes and a DLL; no need to link in anything special. Except for a little stub in the debugee, all the code is in the DLL. Is that how DebugCenter works too?
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: Biterider on September 08, 2024, 08:47:09 PM
Hi HSE
I noticed that the line endpoints are always cut vertically.
Perhaps a more flexible approach would be to make both ends configurable: vertical, horizontal or perpendicular to the line direction, so that we can better adjust the line connections.

I had another thought about performance. Maybe we can save some cycles on really thick lines by treating the boundaries and the interior separately. What do you think?

Biterider
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 09, 2024, 04:42:59 AM
Hi Biterider!

Quote from: Biterider on September 08, 2024, 08:47:09 PMI noticed that the line endpoints are always cut vertically.

:biggrin:  :biggrin:  Not really. "steep" lines ends horizontally (magenta line in the test)

Quote from: Biterider on September 08, 2024, 08:47:09 PMPerhaps a more flexible approach...
Maybe we can save some cycles ...

Line ends are a problem. Connections can look with "bites" when ends change between vertical and horizontal  :biggrin:

In the program from 2018, a trick (or "balls"  :biggrin: ) was enough:
 
(https://masm32.com/board/index.php?action=dlattach;attach=15510;image)

Now I have to solve "bites" without "balls". This Thick Xiaolin-Wu will not solve connections, then I'm thinking in a different approach, probably very slow.

HSE
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 26, 2024, 03:36:09 AM
Hi all,

The proof of concept for connections is working.

That is, the connection between connections. Process is more complex than direct drawing because need an screen buffer to store maximum brightness in each point from line.

(https://i.postimg.cc/grQbR4w3/proof1.png) (https://postimg.cc/grQbR4w3)

Obviously test is not for plain thick lines but for the pipeline.

Regards, HSE.

Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: Biterider on September 26, 2024, 03:38:52 AM
Quote from: HSE on September 26, 2024, 03:36:09 AMThe proof of concept for connections is working.
I'm eagerly awaiting the code  :biggrin:

Biterider
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 26, 2024, 03:57:52 AM
Hi Biterider,

Quote from: Biterider on September 26, 2024, 03:38:52 AMI'm eagerly awaiting the code  :biggrin:

:biggrin: Just is beginning to work, not so fast because the pipeline is a little more complex than plain line.

HSE
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: NoCforMe on September 27, 2024, 04:26:55 AM
Wow, that looks just like an out-of-focus trace on my oscilloscope ...
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: zedd151 on September 27, 2024, 04:29:17 AM
 :winking:
Quote from: NoCforMe on September 27, 2024, 04:26:55 AMWow, that looks just like an out-of-focus trace on my oscilloscope ...
:biggrin:  or an oscillating sinewave.
But on the bright side, the display of the curves is much smoother now.   :thumbsup:
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: NoCforMe on September 27, 2024, 04:39:20 AM
Well, yeah, I meant an out-of-focus sine wave, obviously.
('scope is a Tek 475.)
It does look good.
Title: Re: Thick Anti-Aliased Lines of arbitrary width
Post by: HSE on September 27, 2024, 08:59:32 AM
Quote from: zedd151 on September 27, 2024, 04:29:17 AMsinewave

 :thumbsup: Exactly