New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All textures within a spritelist are drawn blurry when scaled, expect for one #275
Comments
Hard to tell without a full working example. I would guess it is blurry because the pixels are not landing directly on the boundaries. That is, a pixel drawn at an x, y of (0.5, 0.5) will be blurry. It is easiest to get pixels to line up if sprites are sized in powers of 2 (16, 32, 64, 128, etc.) Can you check this? Or post GitHub or small working example? |
@pvcraven Thanks for your response, we are working together on this project here: https://gitlab.com/ByteCommander/code-jam-3/tree/assets - that branch should have the exact display as in the screenshots, though we see this blurring in all places where there are multiple sprites with the same texture. One instance of the texture is always sharp, all others blurry. |
I found a workaround: If we change the texture magnification filter from NEAREST to LINEAR in the
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER,
gl.GL_NEAREST) For now, we have to copy, change and monkeypatch the whole function in order to change this behaviour, which is not really cool. It would be great if you could add an optional keyword argument to |
Ok, nevermind. I removed the monkey-patch |
Try version the new 1.3.7 version of Arcade and see if it works better for you. |
Wow, thank you. That was quick. |
I'm having this issue as well with 2.2.1, but only when scaled above 1: LEFT IMAGE scaled with RIGHT IMAGE scaled directly with PIL example code import arcade
GAME_SCALING = 3
class TestWindow(arcade.Window):
def __init__(self, width=300, height=100, title='Image Scaling'):
super().__init__(width, height, title)
# setup sprites
self.sprite_list = None
self.sprite_arcade_scaled = None
self.sprite_PIL_scaled = None
arcade.set_background_color(arcade.color.BLACK_BEAN)
self.setup()
def setup(self):
""" Setup game sprites """
self.sprite_list = arcade.SpriteList()
self.sprite_arcade_scaled = arcade.Sprite('Images/canon.png', scale=3)
self.sprite_arcade_scaled.position = (50, 50)
self.sprite_PIL_scaled = arcade.Sprite('Images/canon2.png')
self.sprite_PIL_scaled.position = (100, 50)
self.sprite_list.append(self.sprite_arcade_scaled)
self.sprite_list.append(self.sprite_PIL_scaled)
def on_draw(self):
"""Draw sprites to screen """
arcade.start_render()
self.sprite_list.draw()
TestWindow()
arcade.run() |
Make sure the image's boundaries rest exactly on pixel boundaries. If a sprite isn't pixel-perfect it will blur. You might try scaling with 4, which would increase the likelyhood you are on boundaries? |
EDIT: Don't use this, use the comment below ( ORIGINAL:
|
It should be enough to pass |
thanks for that, way better API |
Bug Report
I load a list sprites from a tileset and then add them to a spritelist. When I increase the scale for these images over 1, they get drawn blurry except for one.
arcade version: 1.3.6
Actual behavior:
Notice how only the right tire is drawn sharp
Expected behavior:
They should the same as this screenshot taken from the Tiled
Steps to reproduce/example code:
How I load the texture
How I add them to the list
The text was updated successfully, but these errors were encountered: