Skip to content

Godot:PixelArt

Godot에서 픽셀아트 게임 만드는 법 및 주의사항 등

임포트한 이미지가 번지는 현상

Project Settings > Rendering > Textures > Canvas Textures > Default Texture Filter 의 값을 "Nearest" 로 바꾸면 된다.

픽셀아트 게임을 위한 윈도우 셋팅 방법

Pixelation Shader

// References to built-in functions
// https://docs.godotengine.org/en/stable/tutorials/shaders/shader_reference/spatial_shader.html
// Fragment shader affects pixel, it basically manipulate all pixels individually, at the same time
void fragment() {
    // a variaent of nearest neighbour fragment shader
    float x = float(int(FRAGCOORD.x) % pixel_size);
    float y = float(int(FRAGCOORD.y) % pixel_size);

    x = FRAGCOORD.x + floor(float(pixel_size) / 2.0) - x;
    y = FRAGCOORD.y + floor(float(pixel_size) / 2.0) - y;

    // set albedo value on the current coordinate based on vec2(x,y) / viewport_size
    ALBEDO = texture(SCREEN_TEXTURE, vec2(x, y) / VIEWPORT_SIZE).xyz;
}

Smooth Pixel Art Gameplay - Tips for Eliminating Jittering