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:
Here's the Camera. Only code (besides camera_destroy in clean up event) is in room start event:
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?
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: