godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.29k stars 21.05k forks source link

Video scaler in the Project Settings Quality options #18661

Closed Linko-3D closed 4 years ago

Linko-3D commented 6 years ago

A video scaler can be very useful, for example we could have an internal resolution and a display resolution. The internal resolution could be high then scaled down to fit the screen to remove the aliasing. A very low internal resolution that is upscaled could allow to create pixelized games, the upscaling should have an option to keep the pixels sharp. This would allow to create a pixel art effect like this: https://youtu.be/1ShSYfo08Zs?t=7m

pixelate

This would be very useful for an orthographic 2.5D games like an old school RTS game with 3D assets.

See also reducing the number of colors: https://github.com/godotengine/godot/issues/18662

Calinou commented 6 years ago

This is already partly supported. You can set the project's scaling mode to viewport and the aspect scaling mode to keep, which will result in the viewport scaling to higher window resolutions using nearest-neighbor filtering (linear filtering isn't supported yet).

However, downscaling an upscaled viewport is not supported yet (as you said, it's required for good-looking fractional pixel art scaling).

bojidar-bg commented 6 years ago

This should be doable by manually managing a viewport. To do it, you would need a scene structure like this:

In project settings, configure scaling mode to "viewport", and aspect mode to "keep". Alternatively, you might setup a shader on the TextureRect similar to the pixelize shader from the shaders demo.

Calinou commented 4 years ago

Since we already have test_width and test_height to set a different window size when running from the editor (independently from its default width and height), I think we can close this.

There's also the stretch shrink setting which you can set to an integer value in the Project Settings. For instance, if you set it to 2, each pixel will be drawn over a 2×2 surface (while keeping the current window size). The stretch shrink setting is effective regardless of the stretch mode used.

Please open a proposal if you have further improvement requests.