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 Studio Chat / [SOLVED] [Linux] Disabling texture blurring

Author
Message
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 21st Oct 2021 20:49
When I use the following code, my textures appear blurry or antialiased on the faces of the mesh:
CreateObjectFromMeshMemblock(tbox,tMem)
SetImageMinFilter(imgAtlas,0)
SetImageMagFilter(imgAtlas,0)
SetObjectImage(tbox,imgAtlas,0)
SetObjectScale(tbox,MAPSCALE,MAPSCALE,MAPSCALE)
How do I get it to use blocky pixels instead of a linear filter, and why isn't min/mag filter working?

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

Go to answer

PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 21st Oct 2021 23:02 Edited at: 21st Oct 2021 23:03
Try with SetSpriteSnap()

Edit, oh for 3D, soz my bad, mag filters should do it yeah
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Oct 2021 23:42
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 22nd Oct 2021 13:38 Edited at: 22nd Oct 2021 13:44
I put in the following in the initialization:
SetGenerateMipmaps(1)
SetAntialiasMode(0)
SetDefaultMagFilter(0)
SetDefaultMinFilter(0)
But I see no change.
My textures are 16x16. Is there some arbitrary minimum for textures?
I tried it both as an individual 16x16 image, and as a 256x256 image using UV coords to select one or a couple. The result is like the attached image:


It looks like if I up my texture to 256x256, then it's sharp. But it seems silly to arbitrarily increase textures 16 times. Does AppGameKit do this internally and that's the issue? I have hundreds of textures I want to use and was trying to keep overall file size and memory usage low.

Attachments

Login to view attachments
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 22nd Oct 2021 14:39 Edited at: 22nd Oct 2021 14:52
16x16 on a 3D model .....

Yeah, your texture is way to small, what size is your model?

I found the very least you can get away with is at least 512x512 and even that looks naff with still some blurring, ok for mobile at a distance but get up close like in your screencap and you are not going to see anything nice

You could try reducing the texture scale that might help (SetObjectUVScale) set it to 0.1 on all axis and go from there to find an acceptable stretch value (it might help, not sure but worth a try)

Edit: I see you are setting object scale, try setting the UV scale the same as the object scale.
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 22nd Oct 2021 15:07 Edited at: 22nd Oct 2021 15:20
UV scaling didn't seem to affect it, but like you said probably too low of a resolution.
It's only a 3D model in the most basic sense, just 1x1 unit panes (scaled up) to make sides of a cube, each side with their own texture.
I'm seeing if I can produce an effect like an old raycasting game using hardware acceleration.
I understand the need for larger textures if I was doing something with more than 2 triangles.
I think I found an acceptable compromise at 64x64.
I don't know much about shaders, but maybe I can use one to turn off the linear filtering?
hendron
5
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 22nd Oct 2021 16:26
16x16 textures seem to work fine here with no blurring after a quick test. I don't know if this is the issue, but make sure you're calling SetDefaultMinFilter(0) and SetDefaultMagFilter(0) before loading the texture images, as it won't apply to images that have already been loaded.



Attachments

Login to view attachments
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 22nd Oct 2021 17:05
I just made a new project with just your code, and it's still blurry.

I just tried HTML5 export, and it appears properly.

I'm on Linux, maybe it's the AppGameKit virtual machine?
hendron
5
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 22nd Oct 2021 17:16
Hmm, could be, I'm on Windows. Out of curiosity, does it make any difference if you use the OpenGL renderer?

#renderer "Basic"
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 22nd Oct 2021 17:22
Yes! That removed the blur:
Raven
16
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 22nd Oct 2021 17:37
What Graphics Hardware do you have?
I ask because you might've changed (or it could be default behaviour) in the graphics drivers that are overriding what AppGameKit is setting.
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 22nd Oct 2021 19:26
It's a basic laptop with 3rd gen Intel embedded graphics (i915 chipset). Running debian/ubuntu.
I don't recall doing any special graphics settings (I've mostly left it vanilla), but I don't know if the distro itself has some presets.
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 22nd Oct 2021 22:17
This post has been marked by the post author as the answer.
Its the Vulcan renderer, I just browsed through a bunch of posts and it seems some games have this issue with Vulcan under Linux, something to do with the image compression from what I can gather
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 23rd Oct 2021 18:10
Aha, thanks for the info!
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 24th Oct 2021 02:17
No Problem, I wonder if this should get reported ..... Nomad??

Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Oct 2021 02:39 Edited at: 24th Oct 2021 02:57
i've just skimmed the above but THIS?

it still exists but only under Linux? if so, add it to the repo and include that fact.

what happens if you use SetImageMin/MagFilter individually vs default? nmd, going back and i see that's where you started.
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 24th Oct 2021 03:26
Not sure on that one, I cant test, I have no access to Linux and my GPU does not support Vulcan but it does appear that the issue still persists, I'll refrain from posting bug reports for things I can not test or verify

@Mysterydip, can you add your info the existing bug report, maybe link to this thread
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Oct 2021 03:41 Edited at: 24th Oct 2021 03:56
Quote: "can you add your info the existing bug report"

no. it needs a new one. ideally, the individual experiencing the issue reports it so there can be follow-up.
i know that closed issue is windows (the thread referenced was originally posted in Windows and fubarpk moved it)

@Mysterydip, if you could add it, please do. and, it wasn't mentioned above but making sure that you are using the most-current version of studio? drivers, etc?

if so, include all specs in the issue, if you would.
Mysterydip
4
Years of Service
User Offline
Joined: 7th Sep 2017
Location:
Posted: 25th Oct 2021 13:06
Just checked it with the latest (I was running the release from earlier this year) and the problem persists. I'll start a ticket, thanks!
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 25th Oct 2021 13:46 Edited at: 25th Oct 2021 14:23

Login to post a reply

Server time is: 2021-12-02 03:58:18
Your offset time is: 2021-12-02 03:58:18