
[Visual]: Request to fix vanilla bug
DarianLStephens opened this issue ยท 21 comments
OS
Windows
GPU
NVIDIA
Modpack (Optional)
No response
Game log
I don't think the log will help, considering it's a vanilla bug.
Description
Very hard lines between various bits of lighting along edges, especially noticeable in a white box.
Close look to make it easier to see:
It's only really noticeable in the dark, possibly entirely gone if in direct sunlight.
It IS still visible at night, though.
The bug is described in more detail, along with code examples and a fix, in this Mojang bug report:
https://bugs.mojang.com/browse/MC-43968
I know this isn't a bug with Triangulator, but I'm hoping it's something the mod might be able to fix given its fix of ambient occlusion.
So i've looked into this rendering issue a bit further, it looks like an side effect of how vanilla minecraft calculates the combination of AO and changing light levels.
Currently, i have absolutely no idea how this could be fixed without rewriting the entire AO calculation logic of Minecraft (about 1200 lines of code)
@FalsePattern Here's a fix I made for my private bugfix mod for MC-43968, not sure if it will fix this issue or not but you're welcome to use it/incorporate it if you'd like: https://gist.github.com/embeddedt/19e2c103841fac23145b0cf125268f73
It's essentially the fix described in the bug report but implemented using (very fragile) mixins instead.
@FalsePattern Here's a fix I made for my private bugfix mod for MC-43968, not sure if it will fix this issue or not but you're welcome to use it/incorporate it if you'd like: https://gist.github.com/embeddedt/19e2c103841fac23145b0cf125268f73
It's essentially the fix described in the bug report but implemented using (very fragile) mixins instead.
so i've added your patch to triangulator, and all i can say is: wow
without your patch:
YEAH!
I've wanted to see this thing fixed for literal years, and seeing it finally done is so awesome!
I am quite curious about that 'private bugfix mod', though. I wonder what else is in there?
so i did some more digging, apparently the staircase and the wall bugs are completely separate.
the staircase glitch was caused by the AO code, while the blocky light is caused by the brightness smoothing code
The main difference is that in the AO bug, it was caused by an actual programming error, while it looks like the reason for the non-perfect smooth lighting is the fact that it uses int
s instead of float
s while calculating the per-vertex brightness (computing the light level instead of actual brightness values)
I'll try reusing the stuff i learned from embeddedt's AO fix code and attempt to fix this limitation
That's definitely way better, but I wonder if there's anything you can do about the strange lines?
It's like the brightness isn't being done properly, even if it's smoothed now.
it's just an artifact from doing vertex-based lighting and the gpu doing linear interpolation. This is the best we can get without a full renderer overhaul.
It's practically not noticeable ingame thanks to the visual noise added by textures.
I just wanted to see how far back these issues ran, and...
I did not think they were present all the way back here!
I'll need to do a bit of survival to test it in earlier versions, but I could have sworn there was a point where it was okay, maybe even closer to the initial implementation of the Smooth Lighting mod?
Is it possible to disable that interpolation you mentioned, or is it a consequence of how GPUs work?
it's a fixed behaviour of GPUs, where data between the vertices of a triangle get interpolated linearly. This is how you can have textures, for instance, because the x/y coordinates of the texture gets interpolated across the whole triangle.
I am quite curious about that 'private bugfix mod', though. I wonder what else is in there?
I have a lot of miscellaneous bugfixes for issues I'm encountering while playing 1.7. The main reason I've kept it private is because they are very untested and some of them might even be questionable. I also sometimes add experimental fixes that end up causing glitches in the world that are hard to revert (e.g. partially ungenerated structures), and I wouldn't want users' worlds to be corrupted by bugs I introduce. 1.7 is also even less popular than 1.12, itself a largely abandoned version.
Also, I cannot take credit for all of these fixes; some of them (including the AO fix) are based on the many pointers TheMasterCaver has left in his various forum posts and/or other players' code analyses in Mojira bug reports.
The underwater bug is caused by the faster fall-off of lights, while the smooth lighting logic is coded for 1 light level per block falloff, can't really do anything about that
As for the non-full block rendering, it's implemented in completely different parts of the code i haven't read yet.
I might look into these in the future, but triangulator is low priority for the time being, i need to focus on some private projects for a few weeks