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
Fix render pipeline lighting issue with small cubes #8158
Fix render pipeline lighting issue with small cubes #8158
Conversation
This will also allow other mods which need to calculate small normalised vectors to be able to use the default classes without needing to write their own, while not effecting any side effects created by how the base game uses this function.
So I know that this fixes it, since this is how I fixed this in C&B. |
I'm don't know if it creates a problem in vanilla. So far I've only found it only causes a problem in the experimental forge render pipeline. I'm not sure how quick or if mojang would fix it unless a vanilla problem is found. |
If the bug is in vanilla code we request that the issues are reported to mojang. Even if it's unlikely they will fix them, we want them to be reported. We can then mark forge's fix as |
I'll report it when I'm back later then. Though I'll take a quick look at where this function is used in vanilla to see if I can find anything it might break. |
I've created the issue https://bugs.mojang.com/browse/MC-239212 I will also change the code to just avoid it when the length is 0 rather than avoiding it entirely, seeing as normalising doesn't work in that case anyway. |
Allows to still check for a 0 length vector. After checking what its used for, nowhere uses the return boolean it seems and its its only ever large vectors or rendering.
I'm wondering if it would be worth doing instead, |
At that point shouldn't it be |
float f = this.f_122228_ * this.f_122228_ + this.f_122229_ * this.f_122229_ + this.f_122230_ * this.f_122230_; | ||
- if ((double)f < 1.0E-5D) { | ||
+ if (!force && (double)f < 1.0E-5D) { | ||
+ if ((double)f == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end of this line you should include a comment like: //Forge: Fix MC-239212
Forgot that existed, that would probably be the best |
82a5973
to
ad35ef7
Compare
After taking a deeper look into the code, the only time Mojang ever calls it, they actually perform another function on it which doesn't seem to matter if it's normalised or not. Other than that they normalise some vectors which are pre-defined. I hope they fix it but with that in mind, altering this and making it part of forge should not cause any problems in mc and should only benefit any mods using these classes rather than implementing their own. |
This will also allow other mods which need to calculate small normalised vectors to be able to use the default classes without needing to write their own, while not affecting any side effects created by how the base game uses this function.
It fixes the bug shown above and is useful for other mods where any problems with the resulting vector are probably not as bad as it not being calculated in the first place.
After changes