Open petersvp opened 1 year ago
Thanks, I'll have a look at it. The code in question was "inspired" by some other upscaling tools and examples, and I didn't test the aspect ratio thing particularly thoroughly. So it's very well possible that it's not correct for all use cases.
I've looked into this and can confirm that your findings are correct. I wanted to double check too if it didn't break anything, and why that line was there in the first place. It seems to be a leftover from my first experiments with resolution scaling (simple bilinear resampling using render textures and two cameras) and I simply never questioned it. So there's no particular reason why it had to be added.
On the other hand, outputting the upscaled image to a render texture does appear to be broken at the moment. This seems to be unrelated to the aspect ratio line, as the same thing happens both when the line is there and when it isn't there, but it's peculiar as supporting render textures with varying aspect ratios was one of the reasons why I assumed the aspect ratio correction was necessary. I'll have to dig into this a bit further to figure out what's happening.
The latest code revision contains this fix now, though slightly differently: instead of removing the aspect ratio lines altogether, the aspect ratio is now calculated based on the display resolution only (so no more inclusion of the viewport rect size). Removing the lines completely caused the camera's aspect ratio to be determined by the lower render resolution, and because the render resolution uses rounded off integer values, you would get slight variations in aspect ratio when switching between FSR quality modes. Using the original display resolution to set the aspect ratio fixes this and maintains the correct aspect ratio regardless of which quality mode you select.
Hello. You are miscalculating the Aspect ratio while setting it in the helper and the main code. In fact I don't even think you need the aspect ratio changed at all.
Repro: 2 cameras set side-to-side for splitscreen with the helper and FSR. Start the game, observe that cameras are stretched weirdly.
My fix was commenting out the code that sets the aspect entirely, you only really ever need to set the rect. Too lazy to setup a proper PR for just oneliner