anti aliasing

Didjynn

Member
Hello everyone,

I was trying to understand all the anti aliasing we have in Gamemaker but it seems tricky to me.

gpu_set_texfilter(true)
This one is quite good already

display_reset(aa, vsync);
I never really saw any difference with it on or off even at 8 (maximum level)

gpu_set_tex_mip_filter(tf_anisotropic)
It seems to go the exact same than gpu_set_texfilter(true)
I really compared the 2 in real time and if I activate texfilter and deactivate tex_mip then it is exactly the same, pixel perfect.
I'm trying to improve the aliasing as much as possible in my game and I'm trying to not activate everything to keep performances as good as possible, any help about that and anti aliasing understanding (of these 3 lines of code and more if possible ? I do know how anti aliasing normally work, my problem is only to understand gamemaker about that)

Thanks for your time,

Cheers
 
M

Misu

Guest
I'd like to see some answers to this too because from all I know, Ive experimented with anti-alias before and I too have never noticed any difference at all with display_aa. Its almost as if it does not work at all.

What I normally do to recreate anti-alias is by downsampling the application_surface to create super smooth pixels just like the ones in films but they can cost a lot on performance depending on the size and destination size. It may work best for powerful devices like gaming computers and game consoles but I wouldn't recommend it for mobile (Even though I did manage to run it on mobile at decent rate once).
 
I guess a simple way of putting it is that aa will blend the edges of your polygons with the background, rather than affecting the textures in any way.

MIP mapping is basically for making textures look better at a distance. It basically uses smaller sized textures at times when sampling a larger texture would cause sparkling. I really wish MIP mapping was built into GMS1! Also if yoyo is reading, it'd be great to be able to change culling direction and z testing function!
 

Smiechu

Member
If you want a to have full screen aa you need to set the camera and application surface resulution to x times of screen resolution and manually draw and rescale the application surface.
Bulit in aa works only for some bulit in primitive functions and has no bigger influance on drawing of sprites...
 
M

Misu

Guest
If you want a to have full screen aa you need to set the camera and application surface resulution to x times of screen resolution and manually draw and rescale the application surface.
Thats called downscaling. Thats what I normally do. Trick simple but heavy on gpu.
Code:
///draw gui event
if (!surface_exists(screen)){
     surface_create(screen,width,height);}
surface_set_target(screen);
draw_clear(0);
draw_surface_ext(application_surface,0,0,0.5,0.5,0,-1,1);
surface_reset_target();

draw_surface_ext(screen,0,0,0.5,0.5,0,-1,1);
 
L

Lonewolff

Guest
I'd like to see some answers to this too because from all I know, Ive experimented with anti-alias before and I too have never noticed any difference at all with display_aa. Its almost as if it does not work at all.
I use display_reset(aa_level, true) all the time It works great!

It wont affect textures one bit though, so you won't notice it at all in normal 2D games. But if your sprites go right to the edge of their image, you will notice the difference on rotations.



Again, doesn't have a huge place in 2D, but really shines when you move in to 3D as all of the geometry benefits from the AA.
 
M

Misu

Guest
@The Sorcerer It goes to show that display_aa only helps geometry. If thats the case than its useless if there are better techniques that help more than the edges of your drawing structure. Im happy with the results of downscaling since it smoothen every pixel on screen (both edges and texture). Also not to mention that display_aa only works for some devices. I know there may be a better way (and efficient) with shaders but display_aa is not the best option in my opinion.
 
L

Lonewolff

Guest
@The Sorcerer It goes to show that display_aa only helps geometry. If thats the case than its useless if there are better techniques that help more than the edges of your drawing structure. Im happy with the results of downscaling since it smoothen every pixel on screen (both edges and texture). Also not to mention that display_aa only works for some devices. I know there may be a better way (and efficient) with shaders but display_aa is not the best option in my opinion.
Seems that you don't fully understand what display_aa is or when you would use it.

Agreed, in normal 2D mainstream games. You will not notice one pixel of difference in normal operation. But display_aa isn't designed to be a texture filter, it is a geometry filter.

Below is display_aa in action. Sure you could say I blurred it in Photoshop or something, but then closer inspection will reveal that there is no difference in texture inside the geometry. That is what AA is and what AA is designed to do.



This rule applies to any engine in existence and is not a GM bug or oversight.


Also not to mention that display_aa only works for some devices.
I have never met a device that doesn't support it. ;)
 
Last edited by a moderator:

Smiechu

Member
Thats called downscaling. Thats what I normally do. Trick simple but heavy on gpu.
You've totally missed what I've said...

Example...
Your target screen resolution is 800x600...
You set the application surface to i.e. 1600x1200 and you draw your camera or whatever you use on this surface.
Then you downscale (with resampling) the application surface to fit the screen resolution - 800x1600.
This is the FSAA 2x - Full Screen Anti Aliasing with oversampling factor 2 - the most basic approach to aa
 

Didjynn

Member
If you want a to have full screen aa you need to set the camera and application surface resulution to x times of screen resolution and manually draw and rescale the application surface.
Bulit in aa works only for some bulit in primitive functions and has no bigger influance on drawing of sprites...
if I understand well, you need for example a 4096x4096 camera with a 1280x720 viewport, then make an application surface of 1280x720 ?
 
Top