Line with 2px width rasterizes to 1px width

Hello!

I am working on a game that draws lines, and I noticed that some configurations of a line with width 2 rasterize to a 1px width:

rasterwoops

Does anyone know how I might be able to predict and avoid these configurations?

Thank you!

Shaun pointed out this problem (or one very similar) to me last week. I spent a while looking into it and wrote

So, this is a result of the code that tweaks the wide line's coordinates (drawn as a polygon) to make the width appear consistent. Without this, a rotating wide line would look like it was getting skinnier and fatter as it goes around.

I don't think there's any good way to make this do what you're expecting, unfortunately.

In his case he was trying to draw a 3-pixel-wide black line then a 1-pixel wide white line over it and have it line up perfectly in the middle. It didn't change apparent width but it did wiggle around a bit.

I'll take another look and see if we can do anything after all. Maybe using floating point all the way down to the core layer instead of rounding up top will help.

2 Likes