Libgdx - What Graphic Settings can i expose?

Hello guys!
I have a question that i’ve been researching in google and in the openGl superbible.

I want to know, what kind of Filters and options i can make in code, to make it faster/bad graphic quality and slower?/Better Graphic Quality

 
TmxMapLoader.Parameters params = new TmxMapLoader.Parameters();
        params.textureMagFilter = Texture.TextureFilter.Nearest;
        params.textureMinFilter = Texture.TextureFilter.Nearest;

        map = new TmxMapLoader().load("levels/One/LevelOne.tmx", params);

  public ArcherMovement() {

        TextureAtlas atlas = AssetAccessor.getInstance().manager.get("packed/archerresources.atlas", TextureAtlas.class);

        //Walk Left
        walkingLeft = new Sprite[4];
        walkingLeft[0] = atlas.createSprite("archer/archer_walking_left", 1);
        walkingLeft[1] = atlas.createSprite("archer/archer_walking_left", 2);
        walkingLeft[2] = atlas.createSprite("archer/archer_walking_left", 3);
        walkingLeft[3] = atlas.createSprite("archer/archer_walking_left", 4);

        walkLeft = new Animation(0.20f, walkingLeft);

        //Walk Right
        walkingRight = new Sprite[4];

        walkingRight[0] = atlas.createSprite("archer/archer_walking_right", 1);
        walkingRight[1] = atlas.createSprite("archer/archer_walking_right", 2);
        walkingRight[2] = atlas.createSprite("archer/archer_walking_right", 3);
        walkingRight[3] = atlas.createSprite("archer/archer_walking_right", 4);

        walkRight = new Animation(0.20f, walkingRight);

        //Standing
        standing = new Sprite[3];
        standing[0] = atlas.createSprite("archer/archer_standing", 1);
        standing[1] = atlas.createSprite("archer/archer_standing", 2);
        standing[2] = atlas.createSprite("archer/archer_standing", 3);

        stand = new Animation(0.28f, standing);

        //Dead
        dying = new Sprite[2];
        dying[0] = atlas.createSprite("archer/archer_dying", 1);
        dying[1] = atlas.createSprite("archer/archer_dying", 2);

        dead = new Animation(0.28f, dying);

        winning = new Sprite[1];
        winning[0] = atlas.createSprite("archer_hooray");

        win = new Animation(0.30f, winning);

I know that,
"GL_LINEAR smooths those out, GL_NEAREST presents them in their full glory. "

I know also about mipMapping but i dont know how to generate them or if they must be pre-gen.

This is a new Area for me , so any tip is totally appreciated. :slight_smile:

Also this: Wrapping?

[quote]GL_CLAMP_TO_EDGE: The coordinate will simply be clamped between 0 and 1.
GL_CLAMP_TO_BORDER: The coordinates that fall outside the range will be given a specified border color.
GL_REPEAT: The integer part of the coordinate will be ignored and a repeating pattern is formed.
GL_MIRRORED_REPEAT: The texture will also be repeated, but it will be mirrored when the integer part of the coordinate is odd.
[/quote]
And This :

So, theres two things,

Filter Combinations / Filtering
Wrapping

In Filters, i can do like this :
Best : Linear/Linear
Worst :Nearest/Nearest

For Wrapping…
I have no idea.

.

So i guess i will work with filters now,


walkingRight[i].getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

Something like that.

And for the wrapping, idk.

I think this website have the correct order :
From worst to better.

For Mag_Filter :

GL_TEXTURE_MAG_FILTER:
GL_NEAREST
GL_LINEAR

///////////////////////////////////
///////////////////////////////////

For Min_Filter :

GL_TEXTURE_MIN_FILTER

GL_NEAREST
GL_LINEAR
GL_NEAREST_MIPMAP_NEAREST
GL_NEAREST_MIPMAP_LINEAR
GL_LINEAR_MIPMAP_NEAREST
GL_LINEAR_MIPMAP_LINEAR

Nearest (worst) -> GL_LINEAR_MIPMAP_LINEAR (Better)
?

Can Anyone confirm this for me?

http://www.felixgers.de/teaching/jogl/textureFiltering.html

Why don’t you just research it. There are so many resources out there that will tell you exactly what you want to know.

WTF
What you think that im doing ? Im researching all over but my knowledge of openGl is new, so im trying to find out.

Why do you think im posting all this? To help others newbies in openGl.

Instead,once again, you come here comment that.

If you want to help, either post a link or say something constructive you freaking troll.

“Age: 16”

There you go.

So how about you test it out in one of your programs and see for yourself instead of creating yet another topic about something that is easily found on the internet? You have all the different types of texture filtering right there, why not be proactive and test them out?

Firstly, I have sought a solution already and was hoping to find somebody with experience that might be able to put me on the right track. Secondly, my question and its hopeful solution on this board may help others in the future. Thirdly, your responses are still of little value to me. If you can help, I will be appreciative. If you cannot, then my appreciation will be there if you stop replying please

“…another topic about something that is easily found on the internet…”

If its so easily, then why dont you post the link?
Since you didnt, its clearly that you are here only to troll.
Grow up.

I don’t post anything about it because you need to learn to be a problem solver. Maybe its not my place to teach you, but if you ever want to make it as a programmer then you need to be able to solve issues like this by yourself.

Calling me a troll is immature when I am only trying to help you.

Maybe its not my place to teach you, but if you ever want to make it as a programmer then you need to be able to solve issues like this by yourself.

Its not an issue, its a problem to search a certain topic in a certain book , in a big library called internet, and you cant find it

I would also like to know the answer to this question.

Opiop, I thought you were supposed to be over 13 to use this forum?

Give this guy a break, isn’t this forum wonderful for asking for help?

I respect skill, not age :stuck_out_tongue: (I was 12 when I joined)

And yes.

nearest then linear. With min/mag options that is what type of filtering to use when reducing a texture are stretching a texture.

Mag is magnification filtering and min is the opposite. For some games you will not see textures up close so you can use a faster min filter.

Usually though, all graphics cards can do trilinear with ease.

The main options that speed things up or slow things down are polygon count, texture size, and shaders. Really shaders are the biggest thing as you completely control them. Of course there are logically things like physics and AI but they are not something that can be changed without effecting the game.

EDIT: Oh yeah resolution can greatly effect speed due to fill rate limits.

I see, its because im making a graphic quality settings so the user can select.

You can read about filtering and wrapping here:

Mipmapping is a little different. It basically exists to make textures look smoother when they are rendered really small. Here’s some brief info:

[]It’s only used on minification (making something smaller). And it’s only really useful if you plan to significantly scale down your textures – e.g. for distant objects in 3D games, or in a 2D game with, say, a very high zoom level.
[
]When mipmaps are generated (LibGDX has a boolean in Texture constructor for this), the GL Texture will be associated with a “mipmap chain.” This is just a series of images, each one halved from the last – e.g. 128x128, then 64x64, then 32x32, etc. Example here.
[]This increases texture memory by 33%, which isn’t too much. But no point in using mipmaps if you don’t need to down-scale your image.
[
]Often the driver uses a higher-quality filtering than bilinear, e.g. like bicubic instead. This is more expensive, but since you generally only do it once (when you create the texture), it’s no big deal.
[*]In the vast majority of applications, the choice of filtering or wrap modes will have zero impact on performance, so it should be a non-issue. There are some rare exceptions – like on Android with large images – that you might want to be weary of.

To describe the basic difference between the different mipmap parameters, first you need to know “nearest” vs. “linear.” NEAREST picks the single closest sample – so if you were to plot somewhere “in between” pixel A and B, it would choose whichever is closest to your given value. Whereas LINEAR will blend the two pixels using a weighted average, aka linear interpolation. It’s technically “bilinear interpolation” since we are interpolating in both directions (X and Y, or more specifically, the S and T tangents), leading to a weighted average of the four nearest colors.

The GL_MIPMAP parameters first describes the filtering between mipmap levels, and then the filtering on that particular mipmap texture.

GL_NEAREST_MIPMAP_LINEAR will use nearest-neighbour filtering to sample one mipmap, determined by the size at which you’re drawing your texture. Then it will use linear filtering between the samples from that mipmap texture. Whereas GL_NEAREST_MIPMAP_NEAREST will sample from a single mipmap level, and then sample a single pixel.

GL_LINEAR_MIPMAP_LINEAR on the other hand, will blend with a weighted average between the two closest mipmap levels, and then blend again the nearest sampled pixels from the resulting image. This is also known as trilinear filtering, and it leads to the smoothest result. (At the expense of performance, on low-end devices.)

Likewise, GL_LINEAR_MIPMAP_NEAREST first blends between two mipmap levels – but then samples from the result using nearest-neighbour sampling.

I came up with this :

        Mag ||  Min

Low Nearest,Nearest
Medium Nearest,Linear
High Linear,Linear
Highest Linear,GL_Linear_MIPMAP_LINEAR

What you guys think?

Im also reading about AA in libgdx so yeah :slight_smile:

I can’t speak for mobile, but on PC the filtering cost of all those is almost exactly the same thanks to dedicated hardware. Trilinear filtering (4 taps each from 2 layers = 8 taps) is used for every single texture in 3D game, so it’s obviously been a priority to optimize this. If you look at older specifications for ATI cards they brag about doing 128 tap filtering, which would be 16x anisotropic filtering samples, where each (trilinear) sample requires 8 reads. You’ll have to search hard for a game that doesn’t default to GL_LINEAR_MIPMAP_LINEAR today.

Mipmaps can actually improve performance as well. A smaller texture fits better in the texture cache, so if you render a huge 1024x1024 texture to a 16x16 pixel quad, you’re sampling very sparse points in the texture so they’ll all be cache misses, while with mipmaps the texture units would just cache the whole 16x16 mipmap level on the first read and the rest would be covered by the cache. There’s really no point in disabling mipmaps at all.

If you really want to, you could add an option for switching between GL_LINEAR_MIPMAP_NEAREST and GL_LINEAR_MIPMAP_LINEAR, AKA bilinear filtering (4 taps) and trilinear filtering (8 taps). The last time I saw such a setting was in Half Life 2, 9 years ago…

Its because its also going to run in Android.
So im just being cautious.

But ok!

Okay, in that case having a setting for switching between bilinear and trilinear filtering might be useful. Since mipmaps actually improve performance, using GL_LINEAR_MIPMAP_NEAREST is faster than GL_LINEAR since they both do the same thing except using mipmaps is more cache efficient. GL_LINEAR_MIPMAP_LINEAR may have a noticeable performance cost though.

GL_LINEAR_MIPMAP_LINEAR is better than GL_LINEAR_MIPMAP_NEAREST which is better and Faster than GL_LINEAR

Right?

I think i will just put android as :

Linear - GL_LINEAR_MIPMAP_NEAREST

And pc as

Linear - GL_LINEAR_MIPMAP_Linear

What you think?

//Thanks for the replies by the way!!!
I wont forget it :slight_smile: