Subviewport Blurry

Godot Version

4.6

Question

Why does everything under my SubViewport node become blurry? If you see the image below everything on the left sprite is slightly fuzzy. These are identical Sprites where I’ve copied one under the sub viewport and one not. The text is really where you can see it’s blurry but all of the sprite is.

This is a super basic scene to test this issue. I only have the node out of the subview port and the node in it. The SubViewport settings are all default except transparent bg is enabled (toggling this does nothing).

I’ve tried many different sizes and settings for my SubViewport but no luck. I tried with and without Camera2D (despite it being blurry in the editor). Helpppp

The Godot editor applies oversampling to fonts and DPITextures automatically when you zoom.

When you use a SubViewport it can’t be applied automatically inside that viewport as it’s not managed by the editor.

If you want to scale your SubViewport and apply oversampling you’ll need to enable oversampling to that viewport with Viewport.oversampling apply the zoom scale to Viewport.global_canvas_transform, and set Viewport.oversampling_override to the zoom value.

Example:

@tool
extends SubViewport


@export_range(0.1, 10.0, 0.1) var zoom: float = 1.0:
	set(value):
		zoom = value
		if not is_node_ready():
			await ready

		var t = Transform2D()
		t = t.scaled(Vector2(zoom, zoom))

		global_canvas_transform = t
		oversampling = true
		oversampling_override = zoom

You may want to change the SubViewport.size too.