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 / Blurry sprites problem! (v2)

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 24th Oct 2014 17:42
The problem:
My current game is basically for Windows (base money from this platform). So, it's very important to make an ideal graphics for that platform!
I use the 1024x768 screen resolution (SetVirtualResolution(1024,768)) in the game, so all sprites are drawing 1:1 ratio if I set the windowed mode with the same resolution. And all sprites are very clean and sharp!

BUT! When I change the window mode to the full screen mode on my full HD monitor (1920x1080), I got the blurry sprites (all game is blurry)!!! And it's a big problem for me!

When I used the DarkGDK, that engine really changed the screen resolution on fullscreen mode, on whole Windows! And with it all sprites were looked sharp!

Maybe one of you guys can help me?
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 24th Oct 2014 17:54
The problem is you have to decide from the options you have...

* Leave it as it is and live with the blurry sprites, they'll probably look ok on a tablet anyway.

* Redraw your sprites so they are twice the resolution that they need to be - then the scaling and blurring will be much nicer. The problem is that there's nothing extra for the render to use to improve the look of sprites. If you use double resolution sprites, then rotating and scaling can avoid the uglies.

* Disable blurring - this is done per image, you set the MAG and MIN filter to 0... SetImageMinFilter(Img,0) and SetImageMagFilter(Img,0) - this will stop the blurring, but it will make sprites look jagged sometimes, assuming you aren't using double resolution images.

Really, the best option is to use sprites images that are bigger than you need them to be, typically double sized is the best bet to retain power-of-2 sizes. If you have a sprite that is 32x32 and displayed at 32x32, it will look horrible when displayed at 41x41, or 42x42 - you need more resolution in the sprite to stop the blurring. If you made that sprite 64x64 and displayed it at 32x32, then it would still blur, but it would be at a level that actually helps the appearance - like anti-alias, and especially with rotation - rotating with native resolution will always be ugly... at double res it'll look twelfty times better. You'd be able to rotate and scale the sprite however you want and it would look nice no matter what - unless you start trying to display it at >64 resolution of course.

Doing this will future-proof your game too - because you never know what device your game might end up running on - perhaps it's safer to aim at the Ipad3 resolution of 2560 wide.

Doubling up on sprite resolution (not size) should do the trick, I am sure you'd see an instant improvement.

I am the one who knocks...
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 24th Oct 2014 18:07 Edited at: 24th Oct 2014 18:13
Thank you Van B for the answer. Do you mean to redraw all my image-files to do this? But it means that I have to redraw all my game. I already have a hundreds of images - it's just my death. And it also will eat much more memory.
Will try to Disable blurring and report here.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 24th Oct 2014 18:19 Edited at: 24th Oct 2014 18:19
No Disable blurring - doesn't work good.

Can you explain please - what do you mean: "Doubling up on sprite resolution (not size) should do the trick, I am sure you'd see an instant improvement." ?
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 24th Oct 2014 23:40
Setting the min and mag filters for each image texture to 0 will result in sharp edges no matter what the scale of the sprite. The default is to blur them when resized.

In your case it seems more of the fact that you are taking a 1024x768 application (4:3) and forcing fullscreen which then stretches the 1024x768 buffer to 1920x1080 (16:9). The better option would be to always use the user's full resolution when setting the virtual resolution, and then scale and position the graphics relative to the screen resolution.

SetVirtualResolution(GetDeviceWidth(), GetDeviceHeight())

This way the canvas will be able to utilize the full 1920x1080 rather than just stretching 1024x768 across whatever resolution the user has.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 26th Oct 2014 20:19
Thanks xCept, but it's not for my situation.

Did you hear guys about the opengl sharpen shaders? Maybe this will help...
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 26th Oct 2014 23:06
Can you post screenshots showing off the issue (one at 1024x768 windowed and the other fullscreen)? Pictures in this case help much more than just trying to describe the issue.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 27th Oct 2014 17:28 Edited at: 27th Oct 2014 17:28
To Van B,
I've tried all your advices and non of this works good.

The only thing I can do with this - is redraw all sprites with new resolution and leave the Virtual Resolution as it was x768.
New sprite resolution must be in ~1.4 times bigger, not in twice! Twice resolution will take 4 times more memory and the sprites still blurry with it!

After I just make the sprites little bit smaller:


To xCept, thanks a lot, but it's the only way for me to save a memory and make good quality!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Oct 2014 17:55
Yeah, there isn't a whole lot of control over the screen with AGKv1 - I'm not sure if AGKv2 is any better at setting resolutions. I mean, having the sprites scale the way they do isn't a bad idea, but sometimes it would be handy to be able to disable that. Some of the issues aren't even to do with image resolution, we have to take extra measures to stop black lines between sprites that are positioned exactly for example... like there's some floating point issues when scaling to the device resolution.

I think this is why so many AppGameKit projects are based on pixel art - it just works more efficiently than using high res graphics, it's easier to avoid the issues when the games pixelated by default I think.

Maybe it's worth looking into the DDS image format - I'm sure AppGameKit supports it, but anyway it might let the engine select the appropriate image for the resolution. Often a DDS image will have power-2 scaled copies, to make rendering faster when the scale varies. Maybe you could have some set sprite sizes stored in that and see if the engine can effectively use the DDS image instead of the standard filters. You can get a DDS plugin for photoshop, and there are standalone converters out there, but it's been a while I'm afraid so I don't have any links. I think it's worth a try at least, like a 32x, 48x, and 64x sprite stored as 1 image, then the engine (insert hope here) might just take the one that suits the resolution best. It affords much more control, and also can be a very effective way to compress media.

I am the one who knocks...

Login to post a reply

Server time is: 2024-11-25 09:35:50
Your offset time is: 2024-11-25 09:35:50