-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
HW rounding fix for all scales #1732
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Erik Abair <[email protected]>
Since screen_pos (and therefore also pixel) are multiplied by the scale factor but the correct subpixel offset is always the same, it was fair to assume that the final subpixel value had to be divided by the scale factor for it to be corrected. Tested on pgraph tests, Fable: TLC and Halo: CE (weapon zoom in).
I ran the pgraph tests against this and it doesn't look like the output is correct at or above 3x. Testing on BFBB has shadows clipping at or above 2x. If I understand the approach correctly (and I need to spend some more time thinking about it either way), this is essentially flooring the vertex coordinate, applying the scale and then attempting to correct rounding using the unscaled subpixel. At 10x a subpixel offset of 0.5 will expand to 5 pixels error after scaling, which I think is the artifacting I'm seeing. In any case, I think the more pressing issue to be resolved before any of these approaches can be landed is passing the |
@antangelo Thanks for the quick testing. Oh, shame...yeah, I noticed some weird wavy things at high scales. I implemented this while working on #1707 because depth testing messes something up and the W-param tests also suffer from rounding issues. I thought maybe the z-fighting/flickering could be solved like this, but nope. Still, this fixes the top and left margins issue in games like Fable and Halo CE. |
In case it might be of help, setting the lessThan operator to lessThanEqual in the vsh code breaks the other 0.5625 tests, but I get this output for this particular case: |
I've tried some alternate methods to alter the shift in the shader function and I've not found a happy balance that makes 1x look good or not break at higher res scales... just wondering if anyone else here has made any further progress |
@abaire @antangelo I continued the work from #735 and #1362 by adding the scale factor to the shader function. From the tests I've done, the behavior is the same for all scales.