Product Chat / Game Guru downsampling is kinda naff

Author
Message
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 8th Jan 2020 09:00 Edited at: 8th Jan 2020 19:31
Why can't Game Guru downsample sprites correctly? Has anyone else noticed that scaling sprites often results in lots of jagged edges and artefacts? Take this image. This sprite is 3000 x 2000 px, and I'm drawing it on 1920 x 1080 monitor, scaling it to be 70% of the width and height of the screen. Basically, there's more than enough pixels here.



But look closer and you see horrible jagged edges on the lettering.



I've noticed this for years but let it slide. But now I'm trying to use AmenMoses' powerful sprite-based font library script, and I'm noticing the text looks horrible. I deliberately made each letter huge so it would render crisply on 4K monitors, that means each character has to be scaled pretty small for me on 1080. The results are...disgusting, frankly.



Why does GG do this, and can it be fixed?

AE
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 8th Jan 2020 10:15
This is something I have noticed too, I did post this on github a while back.... but as yet no update for this......
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth, Roland D05 Synth Module, Bluedio Victory V Headphones, AKG K141 Studio Headphones, Lenovo Ideapad, with Windows 10 64bit, 8Gb Ram and AMD A10 7th Gen Graphics. Acer Swift i3 Laptop with Intel Optane memory, Intel 620UHD GPU, Windows 10 64bit.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Jan 2020 11:15
As you scale sprites smaller you have less pixels so you will get more jagged edges, the only way to compensate for this is anti-aliasing on the fly which GG probably doesn't do.

Been there, done that, got all the T-Shirts!
PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 8th Jan 2020 18:04
GG uses FXAA in post processing, however it may be that sprites are rendered after the 3D pipeline executes so sprite images don't get the benefit (looks like this is the case from those screen shots and it does make sense that sprites don't get affected by most post processing).

Via lua you could query the desktop size and load different resolution images based on the result (like the title and menu screens do) - though I know it would be easier if it just auto scaled with re-sampling as you say.

Cheers.

GPU: GeForce RTX 2070 SUPER PassMark: 14817
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 8th Jan 2020 18:44
Can you do an experiment for us?

can you load your image in without scaling? And set its position so we can see the A up close at its native resolution?

This way we can see if any post-processing is affecting the 2D layer or if its the scaling process in general.
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Jan 2020 19:13
you could also try keeping the sprite in the same aspect ratio to see if that makes it less stretched compared to the original... your sprite aspect is more square compared to your display so it'll stretch across more than it does vertical.
i.e. something like
3840x2160
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 8th Jan 2020 19:28 Edited at: 8th Jan 2020 19:32
Quote: "Can you do an experiment for us? can you load your image in without scaling? And set its position so we can see the A up close at its native resolution?"


Certainly.



Go here to download this image so you can scrutinise it in more detail. It looks perfect to me, exactly as it should, it's only scaling it that causes issues.

Quote: "you could also try keeping the sprite in the same aspect ratio to see if that makes it less stretched compared to the original"


In the images in my first post, I was only specifying a scale on the X axis, I pretty much always set Y to -1 to keep the sprite's native aspect ratio.
SetSpriteSize(colorchecker_spr,70,-1)

AE
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 8th Jan 2020 21:28
I've quickly added FXAA to the sprite shader .... it will need an engine change to work for everyone as the display view size is not passed from the engine to that shader now, so for the moment it is hard coded to 1920x1080 (won't work for any other screen size). If anyone has this screen size and wants to test I will post it. I wasn't sure it would work but it looks like Lee has already added a sprite batcher for performance reasons, so that all sprites are batched together then rendered as one each frame.

But it does seem to make a difference (subtle, but it's there) - this is a 4k image scaled to 50% on a 1920x1080 display:

without AA:


with AA:


Cheers




GPU: GeForce RTX 2070 SUPER PassMark: 14817

Attachments

Login to view attachments
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 8th Jan 2020 21:36
Excellent work cybernescence! I'm working at 1920 x 1080 so would be happy to try it out, you can reach me on the GG Discord if you want to send it privately.

Presumably this would work fine for me at 1920 x 1080 but people playing my game won't see the difference unless they too are running it at 1920 x 1080?

AE
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 8th Jan 2020 22:16
Yep, it's worse than that, if not running 1920x1080 it will pretty much destroy the rendering of sprites/images I would imagine.

There could well be a better way, I'm just experimenting

I'll post it here as it will be of no use to anyone outside of the GG user community, and is only really useful to test to see if it's of any value pursuing it.

Take a back-up of sprite_basic.fx in effectbank\reloaded folder and delete the sprite_basic.blob file in the same folder, then place the attached in there. If GG doesn't start or the loading screens look odd, things have gone horribly wrong, so replace with the back-up you've taken

Cheers.

GPU: GeForce RTX 2070 SUPER PassMark: 14817

Attachments

Login to view attachments
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 8th Jan 2020 22:39
awesome! Amazing work @cybernescence !

I would love seing this feature for all resolutions and in a public gg build! Maybe a github post would help?

I am running at 1920x1080 but I know some customers dont have a 1080p monitor.
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 8th Jan 2020 23:57 Edited at: 8th Jan 2020 23:59
Well that was an improvement in some areas, notably when the sprite in question is scaled. Here's a before and after comparing that color checker sprite scaled to 70% screen width.


Link to image

When viewed up close, you can see the A is noticeable less jagged, although does take on a somewhat softer look overall.



When the sprite is not scaled at all (i.e. is displayed at its proper resolution), the FXAA is still working to anti-alias what's on screen, so actually produces a softer result than before.



Link to image

Lastly, it didn't seem to have any effect on the font sprites I made for Amen's script. Considering I'm scaling them to around 14% of their native size, maybe I'm just asking too much of Game Guru.



Interesting tests so far though - thanks for looking into this, cyber

AE
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 15th Jan 2020 18:56
Not sure why you are scaling them down so much?
You would get far better results by having your images at the correct scale to begin with. If you need to scale down so far, probably best to use multiple images for different sized text. It's also a bit of a waste of memory having text size oversized and then scaling it down to almost a tenth of it's size (unless you are using the high res ones at full detail somewhere also).
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 15th Jan 2020 19:46 Edited at: 15th Jan 2020 19:50
Quote: "It's also a bit of a waste of memory having text size oversized and then scaling it down to almost a tenth of it's size (unless you are using the high res ones at full detail somewhere also)."

yes the idea is that you just use 1 image for all resolutions... depends which memory we're talking about, hard drive = it's more of a waste of memory to have to have separate images for all the different resolutions (including the large image used here) but RAM = more of a waste to use the large image scaled down.
personally i would agree for the smaller text it's not a good idea to use an image so much bigger than needed but as a test it is ok.

i'd be curious to see how AGK handles such a scale difference, if i remember i'll have to give it a try
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 16th Jan 2020 07:33 Edited at: 16th Jan 2020 07:35
Quote: "Not sure why you are scaling them down so much?
You would get far better results by having your images at the correct scale to begin with."

There is no correct size though; some players will be running at 4K, some at 1024 x 768. Game Guru is always going to be required to do some form of sprite scaling because I cannot possibly provide a version of said sprite suitable for every resolution a game is played in.

Amen's sprite-based font library requires every character to be its own separate sprite; that's 93 images that need making each time. Do you really expect developers to provide 20x that to accommodate all the playing resolutions out there?

And, without wishing to sound petulant, if other software can do this, why can't Game Guru?
(image shows Adobe After Effects - entirely different type of software, I know, I know - with the same piece of text scaled at 100%, 14% and 2%...all without pixelation!)


https://postimg.cc/QFymLCV0

AE
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jan 2020 12:32 Edited at: 16th Jan 2020 12:41
here's the AGK version, its the same sprite scaled down from 3000x2000 by 50% each time (i'm only displaying on a 1920x1080 display but still doesn't look half as distorted as AE's GG test

edit, won't let me attach it so i'll have to find a host
https://imgur.com/a/PgkSgWC
this is as small as the text could go without becoming unreadable
https://imgur.com/a/83ELLnr
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 16th Jan 2020 17:14
Quote: "Amen's sprite-based font library requires every character to be its own separate sprite; that's 93 images that need making each time. Do you really expect developers to provide 20x that to accommodate all the playing resolutions out there?"


No, not at all. I haven't used it personally, I just thought going down to 14% seemed extreme. I would try to keep the scale reduction to a minimum. I did do a sprite routine for a score system in an old 2D shooter I made in GG years ago. One thing I noticed even back then was the lack of sprite sheets, which would make this sort of thing easier and also be faster than using separate images. An ability to grab images from a single sprite sheet would be pretty useful for many things and should keep draw calls to a minimum as a bonus

To be fair on GG when comparing it to AGK; it was originally 2D only and so is pretty good at it GG's 2D stuff in comparison is more of an add on. I did get several commands added in that area though So it's a lot better than it used to be.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jan 2020 18:03
Quote: "To be fair on GG when comparing it to AGK; it was originally 2D only and so is pretty good at it GG's 2D stuff in comparison is more of an add on. I did get several commands added in that area though So it's a lot better than it used to be."

yes but AGK is TGC tech and they have full access to it so it's a perfectly fine comparison, there's no reason GG should be any worse than AGK... in honesty i would expect GG to be better because it knows it will have access to a gaming PC by default (GG assumes 60fps) while AGK has to contend with running on mobiles or even slower PCs that can be restricted to any frame rate (AGK is not just for making games).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 16th Jan 2020 19:25 Edited at: 16th Jan 2020 19:26
Quote: "One thing I noticed even back then was the lack of sprite sheets, which would make this sort of thing easier and also be faster than using separate images. An ability to grab images from a single sprite sheet would be pretty useful for many things and should keep draw calls to a minimum as a bonus"


Yeah that's how the current font system works, there's a .png spritesheet and a .fnt file which is basically just character IDs and co-ordinates separated by colons. The downside is the current font system doesn't have any provision to scale those fonts, you have to pick a point size (e.g. 36px) and stick to it at all resolutions. AFAIK Game Guru doesn't scale this based on screen resolution so a 36px font on my 1080p monitor will take up the same amount of pixels as on a 4K monitor and will therefore appear significantly smaller on the 4K monitor. Amen's system also has provision for fading text, and angled text.

In any case, even leaving fonts out of it, the sprite scaling in GG is disappointing when compared to AGK - thanks for the comparison, smallg, very interesting.

AE
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2020 20:08
To get best results with cybers shader make sure the original sprite is *not* antialiased already!

You can't scale an antialiased sprite and then anitialias it again!

Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 17th Jan 2020 13:56
App Game Kit... Yeah it can do other things, but it's aimed mainly at game creation Also uses Open Gl, so not really transferable (that I know of). I always thought GG should have been based on the AGK pipeline back when first released. It would gave been a good way to help develop both of them in concert.

Amen is quite right there as well. Rubbish in rubbish out. I had no issues using bitmaps for text myself, but I didn't run more than one resolution either. The sheer amount of resolutions these days is most annoying. I remember when we had 640x480, 800x600 or 1024x768 as the usual norm At least on a windows based PC. 320x200 was also around for some time Three or four res choices was quite enough to deal with!
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Jan 2020 14:09 Edited at: 17th Jan 2020 14:15
It's not so much the resolutions as the different ratios these days, wide skinny monitors for example.

In my sprite based font library thingy there are ways of tweaking the scaling to improve the look of them but if you want the text to always take up the same amount of screen space regardless of the aspect ratio then for anyone using a different ration to the one you have fine tuned it for there will be a reduction in quality, just one of things you can't really do much about.

I reckon these days most PC users will be using a standard HD aspect ratio so I would fine tune for that and then test it in a few others to see just how bad it looks, maybe even add a caveat to the game stating that it looks best in 16:9 (I've seen that in a few games btw).

The alternative would be to have two or three fonts and choose which one to use based on the aspect ratio.
Been there, done that, got all the T-Shirts!
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 17th Jan 2020 23:01
Quote: "maybe even add a caveat to the game stating that it looks best in 16:9 (I've seen that in a few games btw)."


That's actually really great advice. I noticed my custom UI and HUDs are all over the place on different resolutions.
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 21st Jan 2020 12:05
Quote: "Yeah that's how the current font system works, there's a .png spritesheet and a .fnt file which is basically just character IDs and co-ordinates separated by colons. The downside is the current font system doesn't have any provision to scale those fonts, you have to pick a point size (e.g. 36px) and stick to it at all resolutions. AFAIK Game Guru doesn't scale this based on screen resolution so a 36px font on my 1080p monitor will take up the same amount of pixels as on a 4K monitor and will therefore appear significantly smaller on the 4K monitor. Amen's system also has provision for fading text, and angled text."


This I know, I have added 4k resolution menu screens and buttons to Asset Manager 1.4, whilst the menu screens are fine the buttons look terrible simply because there is only one set of buttons 502 x 74px and a font size of 36px they look great on 1920x1080 but on 4k look lost I think I can do a work around but need Lee's input in the meantime 1.4 will be released without 4k
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Various Tutorials by me
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 22nd Jan 2020 16:45
Am I the only one that thinks we don't need 4k?!
Blarney we're down to 32% of our shields Spock!
(32bit)

If 64 bit AND VR *where* actually beamed to the Enterprise!
Then go for it...
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Jan 2020 16:43
I wonder how GG copes with 4K? I would imagine it may struggle a little, but I can only run at 2k as my monitor is towards 20 years old now. It was good at the time and still suits my needs well enough. 1080 is fine for me though at least for now
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Login to post a reply

Server time is: 2024-11-23 19:29:14
Your offset time is: 2024-11-23 19:29:14