Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SpriteAnimation (or tile) : artefact

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 15th Feb 2017 16:04
Hi

I try to use some Tile, with SetSpriteAnimation() & SetSpriteFrame() which seems easy to manage.
But I have some artefacts, if I zoom or resize the window.
I have tried several ways like
SetImageMagFilter(img, 0)
SetImageMinFilter(img, 0)
Without success.

I know That I should probably use loadimage() and loadsubimage(), but I would like to know if there is a way to avoid those artefacts if I use SetSpriteAnimation() and setSpriteFrame()



AGK2 tier1 - http://www.dracaena-studio.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Feb 2017 20:20 Edited at: 15th Feb 2017 20:21
Try SetGenerateMipmaps(1). It's a global setting you need to set it before you load an image. I'm not sure but you might be able to set it on/off on a per image basis
AreCustomize
10
Years of Service
User Offline
Joined: 22nd Dec 2013
Location: Cyberspace
Posted: 15th Feb 2017 21:41
Hi!

Have you tried command SetSpriteSnap? (set to 1)

-AreCustomize
"Anyone who has never made a mistake has never tried anything new."
-Albert Einstein
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Feb 2017 02:15
You could try SetSpriteUVBorder( SpriteID, 0.5 ), or put a 1 pixel border around each tile so they don't directly touch each other on the image. The pixel border should be the same color as the pixels on the edge of the tile, so that if it ends up sampling from them then it won't be noticed.
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 16th Feb 2017 09:14
HI Paul,
Thanks, SetSpriteUVBorder( n, 0.5 ) works fine.

I have tried to put 1 pixel border around each tile, but it doesn't work and I don't know why :

Here is a test code :


The tileSet I have changed (I have added 1 pixel around each tile) is attached.

A screenshot of the artefact is attached too.

is there a way to avoid that , with the "1 pixel around the tiles - technic" ?





I have used the tileset found here :
http://opengameart.org/content/platform-tileset-nature

AGK2 tier1 - http://www.dracaena-studio.com

Attachments

Login to view attachments
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Feb 2017 14:44
Quote: "I have tried to put 1 pixel border around each tile, but it doesn't work and I don't know why"

The image you attached shows the border around each tile is white, it should match the colour of the nearest pixel in the image (which means there are actually two pixels between each tile, one pixel for each tile). You will also need to change the subimages.txt to make sure it only points to the tile image and not the pixel border. For example the tile in the top left corner would start at 1,1 instead of 0,0 if it had a 1 pixel border.

Quote: "is there a way to avoid that , with the "1 pixel around the tiles - technic" ?"

Yes, this is what SetSpriteUVBorder( n, 0.5 ) does.

Login to post a reply

Server time is: 2024-03-29 10:12:58
Your offset time is: 2024-03-29 10:12:58