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.

Newcomers AppGameKit Corner / [SOLVED] SetViewZoom with Atlas Image Artifacts

Author
Message
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 20th Feb 2020 04:00
Hey Guys,

Running into a problem that I could use some help with. I am making a Tile Map Editor and I ran into this issue when the setviewzoom is not a whole number. The tiles that are seamless in the draw space start to artifact. It uses an atlas image and the Min and Mag filters are set to 0. I can clear the issue if I convert the atlas image into individual images with the copy image command but that causes a 50% drop in performance if I do that so I would like to keep using the atlas images. I also tried creating a transparent pixel border but the same issue occurs. Any guidance would be much appreciated.

The author of this post has marked a post as an answer.

Go to answer

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 20th Feb 2020 08:13 Edited at: 20th Feb 2020 08:16
Can you describe exactly what the problem is. "Artifact" could be used to describe any issue.
Perhaps show an image of the artifacting taking place.
Maybe even a small snippet of code which demonstrates the problem. Anything you can give to help us to help you is better than just saying artifact.
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 20th Feb 2020 21:57 Edited at: 20th Feb 2020 21:58
Hmmm...

Not sure how best to describe it. The OP has a screenshot of the issue taking place (its the grid lines you see, it should not be there). I think I found out why it is doing it, not sure how to go about fixing it though. I looked up the LoadSubImage command text and found a note about pixel bleeding. I guess that is what I am experiencing. If I can't fix this with code, looks like my only recourse is "give your sub images a 1 pixel border of an appropriate color that it can safely steal from when filtering" which would be a bit of a pain to do as that is every asset in the project.

LoadSubImage
You can override this by setting SetSpriteUVBorder to 0 for sprites where you need pixel perfect results, but you will have to watch out for pixel bleeding around the edges, and may need to give your sub images a 1 pixel border of an appropriate color that it can safely steal from when filtering.

This loads the images


This creates the sprites
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2020 23:05 Edited at: 20th Feb 2020 23:06
I just tried a random example and don't get the problem your getting with the grid effect

no media required

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 21st Feb 2020 00:47 Edited at: 21st Feb 2020 00:48
Tried your code, It just produced a black screen for me. I recreated the problem with the code below. I also added code to allow the right mouse to pan the camera and the scroll wheel to zoom in. Zoom to 2.5000 and slowly pan the camera with your mouse and you will get the effect. I have also provided the media files.

Attachments

Login to view attachments
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 21st Feb 2020 10:46
This post has been marked by the post author as the answer.
I haven't tried your code because I'm not in an AppGameKit friendly environment at the moment.
However, looking at it, my first suggestion would be to change integers in your AGK_GLOBALS type to floats and the same with OffsetX and OffsetY
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 21st Feb 2020 22:09
Scraggle...

You got it! I would have never suspected the function that scrolls the viewpoint would have been the culprit. I thought it was being caused by something completely different. Thanks to you and everyone who helped me solve this conundrum!

Login to post a reply

Server time is: 2024-04-19 07:21:11
Your offset time is: 2024-04-19 07:21:11