How to adjust subviewport to work with pixel art assets?

Godot Version

4.3.dev4

Question

I want to implement a minimap for a prototype that I am working on.
I want to show this icon on the minimap to highlight the position of the player but I can’t get this icon by HeartBeast to show properly in the SubViewPort. I have to crank the scale of the sprite way up but even then there are some weird artefacts. How can I get this to work properly?

I have the default texture filter of the Camera2D in the SubViewPort set to Nearest.

grafik

Godot_v4.3-dev4_win64_Lh6LoQdKCA

1 Like

When you imported the sprite did you keep filtering turned on by any chance?

I think you can change the default settings in the project as well:

image

1 Like

I had my Default Texture Filter set to Nearest so that’s not the issue

Have you tried setting the sprite rendering mode to ‘Pixel Perfect’ in the inspector? That might help with the artifacts when scaling the player icon in the minimap

Have you tried setting the sprite rendering mode to ‘Pixel Perfect’ in the inspector? That might help with the artifacts when scaling the player icon in the minimap. For a more polished look, you might also consider using pre-made pixel art specifically designed for UI elements at different scales. There’s a good variety of pixel art for sale available if you’re interested!

I can’t find this property in in the inspector of any node that I’m using in the scene…

You have to go into the SubViewport, NOT SubviewportContainer, and turn on “snap_2d_transforms_to_pixel”, if that doesn’t work try with “snap_2d_vertices_to_pixel”.

I have it set up like that but it’s still jiterry.

[node name="SubViewport" type="SubViewport" parent="SubViewportContainer"]
handle_input_locally = false
snap_2d_transforms_to_pixel = true
snap_2d_vertices_to_pixel = true
canvas_item_default_texture_filter = 0
size = Vector2i(64, 64)
render_target_update_mode = 4