Smoothing Algorithm?

I have textures that I create and would like to smooth them out. I have access to every pixel color, given this, how can I smooth out the entire texture?

thanks

+4
source share
4 answers

The main smoothing method is: for pixel P, a sample of pixels around it. P the new color is its average initial color than that of the samples.

You can select more or less pixels, resize the area around the pixel to a pattern, or randomly select which pixels will be displayed.

As others said, though: anti-aliasing is not what is done for an image that is already a pixel bitmap. This is a technology that is implemented in a 2D / 3D rendering.

+4
source

"Smoothing" can refer to a wide range of different methods. None of them, as a rule, would be what you would do before the texture.

Maybe you mean mip-mapping? http://en.wikipedia.org/wiki/Mipmap

+5
source

Sorry, but true anti-aliasing is not to get the average color from your neighbors as mentioned above. This will undoubtedly soften the edges, but does not smooth, but blurs. True anti-aliasing is simply not possible to do correctly on a bitmap, as it must be calculated during drawing to determine which pixels and / or edges should be “softened” and which are not. For example: imagine that you draw a horizontal line that should be exactly 1 pixel (say, "high") and should be placed exactly in the line coordinate of the integer screen. Obviously, you want it to not be softened, and the correct anti-aliasing algorithm will do this, drawing your line as a perfect row of solid pixels, surrounded by perfect color pixels of the background, without any tone mixing. But if you take the same line after drawing it (i.e. the Bitmap image) and apply the middle method, you will get blur above and below the line, the result is a horizontal line 3 pixels wide, which is not the goal. Of course, everything can be achieved with the right coding, but with a completely different and much more complex approach.

+5
source

It is not very important to ask about smoothing in terms of this vague. It all depends on the nature of the textures and how they will be used.

In general, if you do not have control over the display environment, and your textures can be scaled, rotated, or combined with other elements that you have no control over, you should use transparency to indicate where your image ends and where it only partially fills the pixel.

It is also good to avoid sharp edges and functions that are small relative to the amount of scaling that can be performed.

0
source

Source: https://habr.com/ru/post/1312392/


All Articles