P
P
Pavel Shvedov2016-06-17 16:59:56
Java
Pavel Shvedov, 2016-06-17 16:59:56

How to remove black bars when rendering a circle in LibGdx?

Hi all. I wanted to play around with graphics even on Friday evening, stumbled upon the LibGdx library, sketched a "Halloween" using googled docks and examples, in which I draw circles with a slight glow, without sprites, simple lines, but the cant is this: black stripes-artifacts appeared (see screenshot ), I already googled black stripes artifacts, black lines artifacts, I really didn’t find anything, what is the correct name for such a defect in the graphics, and if there is, can I give a couple of tips on how to get rid of this?1d6364af543c4d41a3d535ca4c7c0036.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2016-06-17
@mmmaaak

This defect is called aliasing . I would venture to suggest that you draw this image using concentric circles. If this is so, then the defects arise due to the fact that the function that draws the circle rounds the values ​​of the coordinates of the points of the circle "in different directions" for different values ​​of the radii of the circle, and the result of drawing the circle for R=1.5 (conditionally) does not "consist" with the result of drawing a circle with radius R=1.6. Because of this, black unpainted dots remain.
You can get rid of this in different ways. For example, draw an image by passing ALL the pixels that claim to hit the circle, but for each of them calculate the color value from the distance to the center of the circle. Then you will not have unpainted points in the image.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question