-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ViewportContainer not properly scaling rendering with STRETCH_MODE_2D #61301
Comments
The description makes the issue look more specific and hard to encounter than I see it is. I'd describe it differently - as the viewport internal resolution is set from ViewportContainer's own logical dimensions, any time logical dimensions do not match pixel dimensions the viewport content becomes over or undersized. That would be the case for any stretch mode other than "Disable", creating more or less noticeable artefacts on every vport that is not root. |
This is intended behavior. SubViewports do not resize automatically regardless of stretch mode. If this is added, this shouldn't be done by default to avoid breaking compatibility with existing projects. What's strange is that godotengine/godot-proposals#7974 mentions the exact opposite issue… |
The root one does resize. The sub viewports too do match the pixel resolution until scaled. It just does not make much sense to have viewport resolution be set from the logical dimensions, this sounds arbitrary more than anyhing. What proposal 7974 seem to talk about is the lack of respect for the size override when it is set explicitly. This needs to be fixed for the 50% scale override to produce pixel-perfect output as being requested. |
SubViewports aren't always used to render them directly to the screen. They can be used as textures in 3D scenes, or as temporary buffers for shaders (e.g. a shader that "digs" inside snow or creates water waves). These should generally not resize with the viewport resolution to avoid performance issues or avoid breaking the expected art direction (for pixel art games). |
Not always, but when vport is placed into container, it is expected to render as many pixels as it covers in the parent viewport. It needs to have the controls to be configured otherwise, but it is weird that by default it renders pixel-to-pixel and then breaks whenever the game is scaled. |
Godot version
3.x, 4.x
System information
Windows 10
Issue description
The 2 sprites in this scene
should be displayed the same when Control and ViewportContainer are laid out with Full Rect.
For now, when the Window stretch mode is set to STRETCH_MODE_2D, SpriteOut is correctly displayed upscaled:
while SpriteIn is displayed at a low resolution:
Steps to reproduce
See project below.
The size of the window has to be low, for example (128, 128), and the test size higher, for example (1024, 1024).
Minimal reproduction project
ViewportContainer.zip
The text was updated successfully, but these errors were encountered: