-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
VertexShaderGen: Move the sonic epsilon hack to the vertex shader. #4164
Conversation
0a09674
to
6019b11
Compare
There are issues in ogl-lin-intel / nfsu-reflections, ogl-lin-intel / fishing-resort-map, ogl-lin-intel / inverted-depth-range, and potentially others. |
The latest run should have resolved them. |
ogl-lin-intel / fishing-resort-map appears to be fixed but the other two still exhibit changes. |
the other two are broken fifologs and should be ignored |
Things look fine now, but I'd still like some comment on whether my |
6019b11
to
90a096e
Compare
Switched to an arbitrary small value after all. Note that simply using an epsilon value doesn't work, not even if I multiply it by z as would be implied by the projection matrix. |
90a096e
to
11f3c0d
Compare
In the vertex shader we have control over the depth clipping planes, so we don't have to offset every floating point value and lose accuracy.
11f3c0d
to
debaf63
Compare
I like to move those hacks to farer stages, so LGTM. But I have no clue about the impact on the z accuracy... |
FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:
automated-fifoci-reporter |
In the vertex shader we have control over the depth clipping planes, so we don't have to offset every floating point value and lose accuracy. This fixes z fighting in the Metroid Prime visor. It also make slow depth a lot more accurate.
It has also been confirmed that the only reason the SW backend rendered the Sonic Adventure/Unleashed UIs correctly was because of its own version of the epsilon hack: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoBackends/Software/TransformUnit.cpp#L60
We can't use the exact same hack as the SW backend because our depth comparison is done in floats instead of integers and is therefore sensitive to rounding errors introduced by adding an epsilon to all depth values.
This change is