Viewports get lower resolution when screen is scaled up

I’m having a weird issue where my subviewports get blurrier the more I scale the application. My application is a OS-like interface, it has stretch mode disabled.

In the video I have my subviewport fullscreened on a scale of 1, this works fine. If I scale the screen to something like 300%, the subviewport gets very blurry and runs at a low resolution.

Is there any way to force subviewports to ignore screen scaling? Any tips would be appreciated, thanks!

Try setting the CanvasItem.texture_filter to Nearest in whichever node you have the SubViewport attached or a SubViewportTexture attached

Well yeah this technically would fix the blurriness but the resolution of viewports is still really low. I would ideally want to keep the resolution of the subviewport regardless of screen scale.

You can query the DPI from the display server. Probably need to do some checks for each viewport to adjust their resolution based on physical size to screen.

That sounds like a great idea and I’ve thought of something similar but I can’t find a way to force a subviewport to render at a specific resolution. I can only change the size of the window itself.

Have you tried forcing the resolution to stay in integers?

This is expected, as viewports don’t automatically scale according to the 2D scale factor. Doing so would be undesired in some situations, and also lead to bad performance if you don’t actually need the increased resolution (not all viewports are displayed to screen in 2D space).

You need to multiply the size of the Viewport property according to the 2D scale factor, and ensure the Viewport is displayed via its ViewportTexture in a TextureRect so its physical size doesn’t change when the viewport texture size changes.

You can see an example of this in the 3D in 2D demo, where the 3D image is rendered as a viewport.