Stroke Effect with Anti-Aliasing

Hello guys,

I just published my code in GitHub/NuGet to create Stroke in Textures and Texts. (Border)
In this library you can create Outline and Inline strokes.

Regards,
Danilo Peres

2 Likes

I got a bit confused when I haven’t found any shaders. Then I’ve looked closer and came to a horrifying realization.

There is no shader. It’s all done in C# on the CPU.

Boy.

Do you realize how abysmal the performance of that thing will be? Even if you only use it once and then cache the result, it can still lead to microstuttering and frame drops. This is just no good for games.

Didnt experience any microstuttering when caching the result and only updating when needed.
The performance got hit hard and got reduced by about 90%

You need use wise :wink:
In my case, I need display the hits with a stroke, during the loading I process the numbers 0 to 9 (it takes no even 100 ms, but for loading it is fine), and use those texture during the game (combining the textures to make real numbers)

…or you can implement it properly with a shader and not overcomplicate everything.
( :

At the very least rename it so it would not use the word “Effect”. Cause right now it’s just misleading.

How can I use shaders? I cannot find any basic tutorial or example here.

Could you quick explain how shaders works?
I give a Texture2D input, and it gives me a Texture2D output?
In which language is write shaders? (It does not look like c#)

Regards,
Danilo

Just google outline shaders in HLSL lole.

Hi guys, I just have update the library, now I am using a shader to generate the outline, and it looks very nice fast…

What do you think?

MonoGame.StrokeEffect.Sample_Small

anti-Aliasing
MonoGame.StrokeEffect.Anti-Aliasing

Regards,
Danilo Peres

3 Likes

Looks good and looks heaps better on performance

1 Like