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 / Sprite edge seems to be missing a pixel

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 12th Mar 2019 14:36 Edited at: 12th Mar 2019 14:37
Hello I've recently tried that my computer ran out of GPU memory because I used very large images. I have now split those images into smaller images, but now it seems a bit off at the sprites edges. I have attached an image, it can be a little tricky to spot but if you look closely you can see that it is a little bit off right where the sprites line up. I create a large memblock where I draw all tiles into, then I create smaller memblocks which each is a region of the large memblock which then is turned into images. I have tried SetSpriteSnap set to 1, SetImageMinFilter and SetImageMagFilter, SetBorderUV, turned off mipmapping and turned off antialiasing. Am I doing something wrong in my code or is there an obvious thing with images/sprites aligning that I am missing?

13/0

Attachments

Login to view attachments
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 12th Mar 2019 14:45
That's a really nice Hotline Miama looking game there.

In terms of its problem, I'm afraid I'm not seeing the issue from that picture. Can you upload the original large image so it's clearer what's not working?
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 12th Mar 2019 17:55 Edited at: 12th Mar 2019 18:02
i suspect it's to do with virtual resolution which is something i stumbled into here. have you tested in native resolution? does the "offset" persist?

if not, consider rendering all of your tiles to a single image where you can define precisely where they begin/end (thus taking control away from the virtual resolution pipeline/scaling) before sending it to the screen?

hope that makes sense

ack!: i just re-read your OP and i think you're already doing what i suggested

when you said "a region of the large memblock which then is turned into images", do you mean 1 final image at a time/per frame or are you (still) sending multiple images to the screen at once?

Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 12th Mar 2019 21:12
Random thought......youre not working position using float values are you?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Mar 2019 21:25
Saw this in another thread. From Mr Gizmo
Quote: "
SetSpriteUVBorder(spriteID,0) <- the documentation covers that atlas's have different borders set

Annoyingly when using atlas's the UV border of 0.5 all the way round where as its 0 for a sprite on its own image. You can manually change it so you shouldn't have the issue.

Also take a look at setting the sprite snap so that it cant be located between two pixels. SetSpriteSnap()
"
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 13th Mar 2019 11:14
Quote: "Can you upload the original large image so it's clearer what's not working?"

There is, unfortunately, no original image as the map is created from tiles during loading of map.

Quote: "have you tested in native resolution?"

Native resolution actually removes the problem. Is there anything I can do so that the artefact doesn't appear on systems not running the games native resolution?

Quote: "when you said "a region of the large memblock which then is turned into images", do you mean 1 final image at a time/per frame or are you (still) sending multiple images to the screen at once?"

I create one large memblock where I "draw" all the tiles to, then I create smaller memblocks where I read each corresponding region of the large memblock into the smaller memblocks, then the smaller memblocks are turned into image that are applied to sprites. I create the entire map of these smaller images. I had to do this as I've tried that my 4GB GPU ran out of memory when the map images were large, single images for each layer.

Quote: "youre not working position using float values are you?"

No, I have tried floats though.

Quote: "Quote: "
SetSpriteUVBorder(spriteID,0) <- the documentation covers that atlas's have different borders set

Annoyingly when using atlas's the UV border of 0.5 all the way round where as its 0 for a sprite on its own image. You can manually change it so you shouldn't have the issue.

Also take a look at setting the sprite snap so that it cant be located between two pixels. SetSpriteSnap()"

I have tried SetSpriteUVBorder(), but each sprite use their own image.
I have also tried SetSpriteSnap().
Setting the system to the same resolution as the game does remove the artefact, but I can't expect users to change their system resolution, so I am hoping there is a way to work around this.


13/0
puzzler2018
User Banned
Posted: 13th Mar 2019 15:01
Is each image a Power of 2
Tier 1 Developer
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 13th Mar 2019 18:32
They are 400x400.
13/0

Login to post a reply

Server time is: 2024-11-23 02:59:30
Your offset time is: 2024-11-23 02:59:30