-
Notifications
You must be signed in to change notification settings - Fork 57
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
Inverted shadows when lightning strikes at night #181
Comments
Is this build from latest git or another build? If one of the released builds, what's the version string? |
This is -git (last built ecff412). I remember this happening since a while, so it is not a regression in a recent version. |
Strange bug, will see if I can reproduce it, though I've never seen it before. Not related to the recent water changes, as this affects the ground. Which means, if I'm not mistaken, that this is not a shader issue, but old-style OpenGL lighting behaviour. Might be a driver bug. Only happens at night, which is when the (positional) street lights are lit, might be connected as well, during the day we only have the (directional) sun light to deal with. [EDIT: in daylight, there is no light used for the lightning, so it makes sense the shadows are not affected]
Pong. Yeah, you've got the right person :) |
I wonder if there is an outdoor map entirely without lights where I could test that (if one exists and that would help)? Throw at me anything you want test or any other info you might need. I am pretty sure I saw this when I first started playing EL and since I also got the water shader issues which were fixed recently (no ripples, I could see through objects and the reflection was stretched if you remember), so I wonder if my opengl version is too recent again :p |
You can build the client with the DEBUG option enabled, and then use Shift+Ctrl+t to simulate a lightning strike. I've done some digging, but have not found anything so far. Things look normal over here, with shadows darker than the light from the lightning bolt. Colour values also seem to be neatly clipped, so it's not like the eye candy issue where out of bounds colour values were generated. |
el.mp4Here is a video of me letting lightning strike at "night". As you can see, I also simulated a lightning strike indoors with lights -1. There was an insane amount of spam on my stdout regardless of anything I have done. What would be the next steps to debug this? I also tried enabling the opengl trace option but this made the client hang on login without any error. Also, interestingly enough, when I uncheck the shadow bug option in the settings, the entire ground becomes black when lightning strikes but shadows look correct otherwise. |
Sorry for taking so long to respond.
Yeah, we should remove those eye candy debug prints. They are not very useful.
Obviously, that shouldn't happen either. Can you run it through gdb and find where it hangs? Maybe open a separate issue for that.
🤨
Yuck, I'm getting nowhere with this. Can you try the following patch:
That should:
If all is well, the RGB values should all be between 0 and 1, and the alpha component should be 1. I don't expect these to be out of range, but would like to rule it out as well. |
Here, I recorded the exact behavior. Sorry for the 8 seconds of nothing, I do not know why ffmpeg did that. I need to check its behavior at day, but it will become day soon in EL and I can test that. el.mp4And here is the output. |
For some reason Firefox refuses to play your videos over here (claims file is corrupt). Chrome has no issues, so I have no idea what FF's problem is. Anyway, so the shadow bugs option does indeed disable shadows altogether, so that's good. As to why the scene turns black, I do not yet know. It's not because the light color is black, the lightning color has constant (non-zero) ambient and diffuse colors (and even when it was black, there is a non-zero ambient component, zo it should be dark but not entirely black). I am thinking the depth texture is not blended correctly with the scene somehow. Question: does the water with the new water shader also become black when lightning strikes? |
I have the exact same problem. To make sure the uploaded mp4 works I actually manually open the link to the mp4 in mpv. Just linux problems I guess.
I got two more videos for you. The comparison to lightning and shadows at daylight: el2.mp4So we got two problems here as far as I can see:
Answer: It is complicated. el3-smaller3.mp4As you can see, the new water shader is totally broken for me. It does not only break the water, it also breaks the sky. With the new water shader disabled, the water is not affected by those shadows and remains visible. |
Had to resort to mpv, as even Chrome would not play that file :)
It almost looks as if it's not using a shader at all. Anything in the log related to shaders?
Okay, that's what I expected. The ground tiles are rendered using classic OpenGL, whereas the water is rendered using a GLSL shader (which explicitly checks the depth buffer and blends with the light or shadow color). So somehow your drivers misinterpret how to apply the depth map. Can't say I blame them as I am getting mightily confused myself. BTW, from the looks of the water I assume you have frame buffer support enabled. Is that correct? |
Looking at the video again, I'm pretty sure that is exactly what happens (the water height changing gives it away). Do you have the new water shader files installed? The should be a |
The second I switch I get a spam of:
Yes. At the very top of the issue there is the config file I uploaded.
No. Where do I get them? |
They're also included with the git sources (in the |
That worked. But it is currently day in EL for two more hours. Is there anything I can do to change the time to night so I can test the new water shader behavior with lightning strikes at night? So far the only difference I can see is that the reflections seem a tiny bit brighter. |
Answer: No. It appears to be illuminated. |
Does this make a difference?
|
Unfortunately not. |
What about this? Does it
Some context: If I'm not mistaken, the code is supposed to compute (in this stage) the new pixel (or light, not sure?) color as
where C_p is the existing pixel color (without shadowing, that's SOURCE0), C_s is the shadow color (SOURCE1), and C_d (SOURCE2) is the depth map value, which I think should either 0 or 1 depending on whether the pixel is visible from the perspective of the lightning bolt. If C_d is 0, the pixel is not visible from the lightning bolt, and result becomes the shadow color; if it is 1 the light from the bolt can reach the pixel and the result becomes the existing color. I'm trying to determine if something wonky is going on with the depth map (the C_d value), or if the previous pixel color C_p is somehow not what we expect it to be (i.e. black). Above patch replaces C_s with C_p. That way, not matter what the value of C_d, the outcome of the mixing should be C_p, i.e. you should see the normal scene without shadows (but lighted by the lightning). |
I could not perceive any change. Sorry, I meant to post a video too but I went to bed shortly after that reply. el-shadows.mp4It is currently not nighttime in EL, but I shall test the new patch soon. |
I tested it and now everything is black, minus water (new water shader) and illuminated objects such as street lights. By the way, I am having trouble applying your patches. The line numbers are off by at least 10 lines. I am using the latest master and both git apply or patch complain. |
Ok, so it looks like the previous rendering stage is not being picked up correctly.
Probably because I revert my earlier patches from this thread, and you didn't. Best assume patches refer to vanilla master. |
But I did try a clean vanilla master, too.
If you need anything else just shout at me and I will try to get you some more debugging info. |
Gamma does not have any effect for me either. But that might be a Xorg only thing. |
It only happens at night. The lightning looks fine at day.
glxinfo:
Config (github does not like ini files, just mv it to the ini extension):
el.txt
Ping @gvissers, I hope I ping the right person since I intend to ping Grum
The text was updated successfully, but these errors were encountered: