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 / SPRITES - How to avoid blur effect?

Author
Message
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 13:29
Hello,
I'am developping a side-scrolling RPG and I've to display a scrolling background which is very much larger than the screen width.

The result is a blurry background sprite, behind a very sharp and clean character sprite.

The fact is, when a sprite is taller than the screen, the result on display is blurry.

How can I avoid this?

I used setImageMagFilter(0) but the result is still awful and pixelized.

Someone know how to avoid this?

The game is setup for 1280 x 800 devices and the virtual resolution is 480x300. Same ratio.

Thanks for helping me.

Cry "Havoc!" and let slip the dogs of war
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Dec 2012 15:55
What is the actual size of the image you are using for the background?

If you are stretching it, that might blur things.

Can you post the image and show the code you are using to set it up?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 20th Dec 2012 16:07
if the image is > 1024pixels and you are testing on mobiles, I think that agk will resize it down to 1024.

I think that eventually this limitation will have to be removed, or at least we could get a command to switch it on or off, cos most of today's mobiles and tablets have a much higher res than 1024
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Dec 2012 19:36
It may be a current OpenGL restriction.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 20:41
The image is 2560 x 300, so a 1,6 ratio, like the resolution.

Cry "Havoc!" and let slip the dogs of war
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Dec 2012 20:51
The ratio has nothing to do with it. It is the actual size. 2560 is too big.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 20th Dec 2012 21:59
Jim on ogl es 2.0 the maximum 2D or cubemap texture size is 2048 x 2048. This is also the maximum renderbuffer size and viewport size. at least on iOS.
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 22:05
When I load and display my 2560x300 pixels image:
- If I do not specify the sprite size, it is displayed entierely on the screen on a 1280x800 resolution.
- If I specify the sprite size, it is displayed correctly on the screen but the render of the background is blurry.

So it seems that AppGameKit can display a large sprite and do the scrolling but the result is blurry.

If I display a background of the screen size, it is good: no blur.

Cry "Havoc!" and let slip the dogs of war
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th Dec 2012 22:09
Maybe worth trying the min filter as well, maybe the virtual res is making AppGameKit think that the image is being scaled down.

I got a fever, and the only prescription, is more memes.
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 22:28
I just tried setImageMinFilter() and it's still blurry on the device.

See the code I used:
LoadBackdrop() is used once.
DrawBackdrop() is used when the player reach an extremity of the screen. The scrolling send him back to the center of the screen.



On the screenshot attached, you can see the screen on the windows simulator. Imagine that on the device, the background is blurry.

Cry "Havoc!" and let slip the dogs of war

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Dec 2012 22:36
Quote: "the render of the background is blurry"

Is this when you just display it or when you try to create a new image by copying a piece of the original?

Quote: "windows simulator."

What windows simulator?

Can you show the code where you load and resize the original background image? Sometimes the order of things has an effect.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 10:09
Okay, this seems to be solved:

AS SOON AS MY BACKGROUND SPRITE <= 1024, AppGameKit handles it correctly and display it with no blur.

So I must find a way to create a scrolling effect using background panels of 1024 pixels width.

This topic is solved.

THANKS FOR YOUR HELP!

Cry "Havoc!" and let slip the dogs of war
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 21st Dec 2012 10:21
The most obvious way would be to split it up into tiles.

LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 14:38
Quote: "The most obvious way would be to split it up into tiles.
"


It could be done if the copyImage() function was working on Android Device.
According to my test, it is not. (http://forum.thegamecreators.com/?m=forum_view&t=202367&b=46)

Cry "Havoc!" and let slip the dogs of war
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 21st Dec 2012 15:10
You could also do it in your art package.

LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 15:42
Quote: "You could also do it in your art package.
"


What do you mean?
Without CopyImage(), I can' load a tileset and copy/paste a tile on the screen or another image.

Cry "Havoc!" and let slip the dogs of war
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 21st Dec 2012 15:46 Edited at: 21st Dec 2012 15:49
LeGugusse,

I'm not going to give you any code in my reply.. because it seems to me that you should go over some of the simpler AppGameKit examples and when you've done that, the right solution will become obvious to you.

However, ask yourself, "Why do I need to use copyimage?" Ask yourself this question, until you realize that you don't need to use the copyimage-function to scroll the background. There are MANY other ways of doing it, which are all better than copyimage.

We have already told you (in the other thread) that CopyImage is a very slow command -- because, it involves copying a large amount of RGBA data from one memory location to another, and that's a no no.

So, take your hands off the mouse and keyboard... take a deep breath, and think.

Now here are a few suggestions:

1. If you have a very large backdrop image, but AppGameKit doesn't allow you to use images larger than 1024x1024 px... then, what if, you simply break your ONE LARGE BACKDROP IMAGE into MANY SMALLER BACKDROP IMAGES that are no wider than 1024px? Don't do this by copying images out of the larger image using copyimage! Just don't. Do it by actually breaking your large backdrop into smaller images in your drawing program, like Prof suggested. Ok?

2. Then, load each of those smaller images, and make code to position each of them next to each other to form a large (wider than 1024) background, and realize, that the sprites can be positioned off-screen. (You do not need to only use coordinates that are within the visible screen area.)

3. When you want to scroll the background (as in, when the player character moves), you reposition one of these two things:

A. The backdrop images (and anything else that needs to move).

or

B. The view offset! (I highly recommend this!)

With these tips you should get back on track... But if you feel that you do not, then please, please go over the simpler examples first. Your programming skills will catch up with what you are trying to do, and you will save yourself a lot of frustration.

Cheers,
AgentSam - The grumpy old software engineer
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 16:17
Thanks for the tips.
I'm already on a "plan B" to avoid using this function.

I'm using 1024 pix images that I dispose on several sprites like you suggested.
But, as I read more about the view offset option, it's seems to be interesting to. Thanks again.

Cry "Havoc!" and let slip the dogs of war
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 16:48
I confirm that the viewOffset fonctionnalities are just GREAT!

Cry "Havoc!" and let slip the dogs of war
7RS
12
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 22nd Dec 2012 16:33
iOS do not allow 2048x2048 texture except for iPad3 and iPhone5, all other devices has a maximum size of 1024x1024

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 22nd Dec 2012 23:24
We are already on ipad4 and in few months' time we will see a 5s so hardware is improving and moving really fast.

even on android, many devices that came out this year are 1280x800, even many chinese phones
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 23rd Dec 2012 10:22
It's a hardware dependent value. Useful information here and in its links:

http://stackoverflow.com/questions/8573178/limitation-on-texture-size-android-open-gl-es-2-0

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
nickele
12
Years of Service
User Offline
Joined: 3rd Jul 2012
Location:
Posted: 23rd Dec 2012 12:40
7RS, are you sure 2048 x 2048 max size is valid only for the devices you mentioned? Has Apple changed anything in its devices' specs?
According to the OpenGL ES Programming Guide for iOS, you can use a maximum texture size of 2048 x 2048 in PowerVR SGX -which is the processor used in iPhone 3GS, iPhone 4, 1st generation iPad etc.
I'm asking because I am planning my game for iPhone 3GS and later devices and I am using 2048 x 2048 sprite atlases. I wouldn't like to encounter any "surprises" when I test the code in actual devices.
Thank you for reading.
nickele
12
Years of Service
User Offline
Joined: 3rd Jul 2012
Location:
Posted: 23rd Dec 2012 12:53
Please ignore my previous post. I rushed to answer and didn't read JimHawkins answer, that covers the subject. My apologies.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 23rd Dec 2012 14:29
There's some fascinating stuff in the link which is embedded on the above link if you want to see how some low-level GL stuff can be implemented:
http://code.google.com/p/gdc2011-android-opengl/wiki/TalkTranscript

Written by a Google employee, it points to a number of interesting low-level GL issues on Google.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-11-24 06:28:09
Your offset time is: 2024-11-24 06:28:09