• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Fuzzy Pixel Graphics [SOLVED]

samspade

Member
I've got a problem with a game I'm working on. I have pixel art which has fuzzy graphics. It seems to be a result of the scaling. However, I've used this same scaling in a different project and had no issues.

Here's a representative picture of a building sprite. This is an 8x magnification I think. The little square windows are 1 x 1 pixels.


Here's a picture of the city in-game:

You can see the windows (and some of the other pixels) are fuzzy and there's also weird outline colors to some of the buildings.

Here's my resolution code:

Code:
/// @description Sets the resolution


//set global vars relating to resulotion
globalvar IDEAL_WIDTH, IDEAL_HEIGHT, ASPECT_RATIO, GUI_WIDTH, GUI_HEIGHT, HALF_GUI_WIDTH, HALF_GUI_HEIGHT, SCALE;

SCALE = 3;


//get display height and width and set ratio
display_height = display_get_height()
display_width = display_get_width()

IDEAL_WIDTH = 1024;                                        //set ideal width
ASPECT_RATIO = display_width/display_height                //get the aspect ratio
IDEAL_HEIGHT = IDEAL_WIDTH/ASPECT_RATIO;                //scale the height to match the aspect ratio
 

//set the size of the GUI to match the proper width and height
GUI_WIDTH = IDEAL_WIDTH;
HALF_GUI_WIDTH = GUI_WIDTH / 2;                            //very useful variable to save
GUI_HEIGHT = IDEAL_HEIGHT
HALF_GUI_HEIGHT = GUI_HEIGHT / 2;                        //very useful variable to save
display_set_gui_size(GUI_WIDTH, GUI_HEIGHT)


//Scaling and Centering the Window
window_set_size(IDEAL_WIDTH, IDEAL_HEIGHT);
if (window_get_fullscreen() == false) {
    window_set_position((display_width - GUI_WIDTH) / 2, (display_height - GUI_HEIGHT) / 2);
}

surface_resize(application_surface, GUI_WIDTH, GUI_HEIGHT);
instance_create_layer(x, y, layer, obj_camera);

Here's the Camera. Only code (besides camera_destroy in clean up event) is in room start event:

Code:
/// @description Camera


//globals
globalvar CAMERA;


//camera variables
camera_width = 340;
camera_height = camera_width/ASPECT_RATIO;
xx = camera_width/2;
yy = room_height - camera_height/2;
if (room != rm_level) {
    yy = camera_height/2;
}


//create camera
CAMERA = camera_create();
var view_mat = matrix_build_lookat(xx, yy, -10, xx, yy, 0, 0, 1, 0);
var proj_mat = matrix_build_projection_ortho(camera_width, camera_height, 1, 10000);
camera_set_view_mat(CAMERA, view_mat);
camera_set_proj_mat(CAMERA, proj_mat);


//view variables
view_camera[0] = CAMERA;

All code works exactly like I would expect except that the graphics are fuzzy. Any idea what is going on?

Other notes, all room sizes are 340 x 256. My monitor is 1920 x 1080. I checked view enabled and view visible in the room IDEs. And again, the camera and everything work exactly as I expect except for the fuzzy pixels.

Edit: It also has fuzzy pixels if I remove the camera and the views and the aspect ratio portion and just resize the window and application surface by a constant multiplier in all directions. It also does it if I remove all scaling and then make it full screen. I put the code into a new project and some of the sprites and there appeared to be no distortion at all even when I zoomed in.

Are there other things than can cause pixel fuzziness?
 
Last edited:

RangerX

Member
In your screenshot there THERE IS interpolation. There's no "grey" color outlining your original building sprite. There's interpolation eveywhere, the icons at the bottom too.
I would check that option again or better yet, turn it off in code when the game starts.
 

Yal

šŸ§ *penguin noises*
GMC Elder
QUESTIONS ANSWERED INSTANTANEOUSLY! SAY "FUZZY PIXELS"! (that was an Earthbound reference)

Anyway, is your viewport the same size as your view? If it's not, the image drawn to the screen won't be drawn at its actual size, and that could make it blurry.
 

samspade

Member
In your screenshot there THERE IS interpolation. There's no "grey" color outlining your original building sprite. There's interpolation eveywhere, the icons at the bottom too.
I would check that option again or better yet, turn it off in code when the game starts.
Thank you. That solved it. It was checked as off. However, what I didn't realize was that one of the assets I was using had a script which turned it on. Your comment reminded me that you can change the setting in code and so I did a search, found the problem and turned it off.
 
Top