No but distant objects already take up less pixels so what you are thinking of likely already happens by default.
Godot Super Scaling, upscale or downscale your game for increased performance or visuals
No that wouldn't work because I am not changing the actual rendering code. But as @Megalomaniak says, far objects take less pixels, and the depth buffer is non-linear, so this already happens in OpenGL normally.
But what you are actually asking about is called Variable Rate Shading, which is an Nvidia DX12 feature but AMD also has the same thing called Variable Shading.
https://gpuopen.com/fidelityfx-variable-shading/
This is much more advanced and currently requires DirectX12. Though I guess we could make an open-source version for Vulkan in Godot 4.0, though it would need to be part of the core rendering code, not an add-on.
Yeah variable rate shading would help with the calculation cost of shading for things in peripheral view and distance at the inverse cost in visual fidelity.
- Edited
This is pretty much exactly what I was thinking of! I just didn't eealise A. It existed B. It required specific hardware
Edit: except the AMD equivalent is opensource and already merged for Godot 4.0!
https://github.com/godotengine/godot/pull/51679
:D
For Godot 4.0, it is FSR that they integrated (FidelityFX Super Resolution). Not Variable Shading. FidelityFX is the brand name of AMDs' open-source APIs, that include many different features, like upscaling, sharpening, this variable shading thing, ambient occlusion, a denoiser, and many other features. But they are all basically separate modules you need to integrate by themselves, not just one package. You can read more here: https://www.amd.com/en/technologies/radeon-software-fidelityfx
Also, my shader works in a similar way to FSR and shares a lot in common, though I am using a different algorithm. FSR is superior overall for sure, at least I think in terms of performance and quality at scales around 80%. But I did some tests, and it looks like my solution actually looks better at lower resolution, like 50% which is still acceptable with Godot Super Scaling but looks horrible with FSR. I would not go as far to say that my shader is better across the board, but depending on the situation it can look substantially better.
Hmm.. just tried to port my project to Godot 4.0 and it didn't go well. The pre-alpha is pretty rough.
But I did some tests, and it looks like my solution actually looks better at lower resolution, like 50% which is still acceptable with Godot Super Scaling but looks horrible with FSR.
FSR has many bugs in its current Godot implementation, including the fact that its sharpener seems to always be disabled and that it only works if FXAA is enabled and MSAA is disabled (otherwise, it does nothing).
That's good to know, @Calinou . I love FSR and it looks great in the games I've played (like Terminator and Godfall) but I watched a video of the FSR in Godot 4.0 and it didn't look that great. And when I tried myself I couldn't get it working (but to be fair, I tried to port an existing project, I will try again with a new project when I have time).
I've published this add-on on Itch.io, you can download on my profile.
Here is a deep dive into the technology behind Godot Super Scaling.
@cybereality This video was really informative and helped me actually get a grasp of what you've been up to. Knowing MSA and FXAA is cool but a real test of intelligence will be to see if you can figure out what my comment means. I hope I can use your tech later on a game! I also wish I could give you crap for saying Umm and uhh so much. (can't tho- too much respect)
- Edited
LOL. Yeah, I spent a lot of time on this shader and I don't think most people really understood what it does. So I figured I'd do a video so people can easily understand. Most of the time I script my videos and write the text beforehand, but this was longer and unscripted. There was just too much I needed to do on the computer that there was no way I could write it all. So I just started recording and did it in basically one take. Didn't really know what I was going to say, so it's just natural when you make a 25 minute video with no plan.
Umm... well I do seem to say umm quite a lot. Here is the game: when you watch the video, every time I say "umm" you have to take a shot of tequila!
So I went through several revisions before I landed on this solution. The whole thing was done in about 2 weeks while I was still working on the demo.
Originally it was only super sampling anti-aliasing, which is still in there, but ended up being too blurry by itself and also tanked performance when increasing resolution scaling too high.
I experimented with Lanczos, and had something sort of working, but it didn't have the quality I wanted and would have needed a sharpening pass like FSR does, but the code just got too complex and I didn't like it.
I also considered just porting FSR, since that is open source, but I read through the code and it is extremely complicated and long. It also uses features that require Vulkan/DirectX12 and I'm working in OpenGL so it would have made porting difficult. So I abandoned that idea.
Finally I discovered a method called directional averaging, which is fairly straight-forward and not complex. The idea is that instead of sampling in a fixed manner (for example, just grabbing the 4 nearest pixels) you scan the image and look for patterns in the diagonals.
So here I am sampling in a sort of star/cross kind of pattern (9 taps) which computes the color difference of each pair of pixels, and then finds the most relevant 2 pixels to blend (based on the pixels that are most visible in color and also closest in color so they likely come from the same object).
This actually works well, but results in a somewhat pixelated image (though still much better than nearest neighbor or bilinear interpolation). So to fix this I add a super sampling pass, which runs at any resolution (it helps above or below native).
The super sampling takes 4 taps, but in a rotated box formation, so the pixels do not coincide, which gives better results than standard sampling (which may just pick the 4 closest pixels).
I have sliders so you can blend between the upscaling and the super sampling, which allows you to tweak how sharp or soft the image is, though in my experiments, just leaving it at 50% almost always gives the best result.
@cybereality said: Umm... well I do seem to say umm quite a lot. Here is the game: when you watch the video, every time I say "umm" you have to take a shot of tequila!
*dies of alcohol poisoning 2 minutes in Expert explanation of directional averaging! Fascinating stuff
@cybereality I'm having trouble getting Super Scaling to work. I dropped the SuperScaling.tscn into my main scene and moved the whole game under a new spatial node (my game is 3d)
When I open the SuperScaling inspector I dont see the Game World property.
Any idea what I'm doing wrong?
Am I supposed to do something with SuperScaling.gd and SuperScaling.tres?
Thanks!
You have to attach the script SuperScaling.gd to the SuperScaling node in the scene tree. It should do this automatically, so I wonder why it is not working. How did you download/add the add-on to your project and what version of Godot are you using.
- Edited
@cybereality To install I searched for Super Scaling in the asset library then downloaded the file. I drag and dropped the SuperScaling.tscn file into godot. After I read your response I attached the script and was able to connect SuperScaling to my spatial node. But now I'm getting the white screen of death.
Which I assume means theres a problem with the shader? Here are my current settings:
Any ideas? My Godot is 3.3.2. Thank you again!
- Edited
So Godot 3.3.2 should work, I just tested it. However, you should not be able to download via the AssetLib as the add-on is marked for Godot 3.4. So that is weird it allowed you to download. In any case, I would delete the SuperScaling node and the SuperScaling folder first, and then download the latest release from my Github and manually copy the folder into your project. https://github.com/cybereality/godot-super-scaling/releases/tag/v1.0.3
@cybereality Oh, ok it works now. I didnt realize I had to copy the whole folder. First impressions are it looks simply amazing. I dont think I could be happier. Really awesome work. Thank you so so much.
Awesome! I'm so happy it worked.
Help me get Godot Super Scaling integrated into the next version of Godot 3.x. This is the scaling technology that enabled Decay and Ella to run smooth on older computers. Just give a thumbs up on my proposal. Thanks. https://github.com/godotengine/godot-proposals/issues/3825
- Edited
So I got a new update for Godot Super Scaling, which greatly improved the image clarity. This separates the upscaling from the super sampling in 2 passes, gaining quality and a better image. At normal settings (like 90% to 110%) it looks the same, but maybe slightly better. At higher scales (like 150%) it actually looks slightly worse, but I would recommend no one go that high anyway and most people don't have the rigs. However, at lower scales it looks substantially better.
This is the new version at 1080p native:
New version 540p upscaled to 1080p:
Old version 450p upscaled to 900p:
You can see the old version was very blurry in comparison, but that was the limitation of the original method I was using. With the new method, there are 3 viewports (the real screen viewport, then the upscaled viewport, and then the super sampling viewport). So it is a chain, kind of a hack since Godot does not have real multi pass support, but whatever, it works.
Release live on Github now. https://github.com/cybereality/godot-super-scaling/releases/tag/v1.1.0
And here is how it looks on the high end with Ella at 4K ultra settings.
4K native = 25 fps:
1080p upscaled to 4K = 70 fps:
Patch is live if you want to download and see for yourself. https://cybereality.itch.io/ella-a-study-in-realism
Godot Super Scaling has been updated to 1.2.0. This fixes some major bugs, and also allows for easy setup. https://github.com/cybereality/godot-super-scaling/releases/tag/v1.2.0
New video. I also pushed the latest version to the Godot Asset Library, it wasn't updated in a while.