1
$\begingroup$

I'm currently making a game with Python's Ursina module, and everything runs well, except: the grass texture (size: 8192x8192px) looks pixelated at big distance (everything inside the red marker). How can I make it look smoother?

In the screenshot below, I'm standing on a hill and looking down to the grass. Pixelated grass texture from big distance (hill)

$\endgroup$

1 Answer 1

3
$\begingroup$

I think mip-mapping will help. This is the aliasing effect when the sampling frequency is lower than needed. When a large patch of texture projects only to one (or less than one) pixel, things like this could happen. Mip-mapping, to put it simply, can help you select a suitable texture resolution when the texture is viewed from different distance. For example, when viewed far away, we can use a smoother version (low resolution, prefiltered) texture, and otherwise we use a sharp version of texture (high resolution).

For specific implementations with Ursina, I am not familiar with this lib, but I took a look at the source code (ursina/texture.py) of this lib:

class Texture():
    default_filtering = None      # options: None / 'bilinear' / 'mipmap'
    """..."""
    def __init__(self, value):
        self.filtering = Texture.default_filtering      # None/'bilinear'/'mipmap' default: 'None'

I think this means that Ursina supports mip-mapping? You can just turn this on (use mipmap) and have a try.

$\endgroup$
1
  • $\begingroup$ It looks much better now, thx! $\endgroup$ Jul 17, 2023 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.