Skip to content
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

Improve fog shader parity to match vanilla #2097

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

embeddedt
Copy link
Contributor

This PR fixes a parity issue between the Sodium and vanilla fog shaders in the (admittedly undefined) case that fogEnd < fogStart. In this scenario, the original Sodium shader appears to produce fog filling the screen, while vanilla simply renders no fog at all. This appears to be caused by the conditional checks which were present in the vanilla function being removed.

I fixed this issue by restoring the conditionals, and also took the opportunity to fix the alpha component of the fog color being multiplied in the wrong place, as pointed out by a user on Discord, and verbally endorsed by JellySquid at the time.

The new function appears to give identical results to vanilla.

* Handle the case where end < start the same way vanilla does (by re-adding the comparison checks)
* Multiply fog alpha in the correct place
@IMS212 IMS212 merged commit dff676d into CaffeineMC:dev Oct 6, 2023
@embeddedt embeddedt deleted the fog-fix branch October 13, 2023 23:42
IMS212 added a commit to IMS212/sodium-fabric that referenced this pull request Aug 6, 2024
Improve fog shader parity to match vanilla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants