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

Strange bug in light spreading #1190

Closed
selat opened this issue Mar 31, 2014 · 26 comments
Closed

Strange bug in light spreading #1190

selat opened this issue Mar 31, 2014 · 26 comments
Labels
Bug Issues that were confirmed to be a bug @ Mapgen Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible).

Comments

@selat
Copy link
Contributor

selat commented Mar 31, 2014

screenshot_212202899
You can download world here http://www.filehosting.org/file/details/444029/Test.tar.gz

@ShadowNinja
Copy link
Member

This isn't anything new. Minetest is known to have some lighting bugs, which are hard to fix. The nicest way to fix this would be to have the client dynamically generate lighting using hardware lighting. This would raise the system requirements a bit though...

@ghost
Copy link

ghost commented Apr 2, 2014

We should make it an option though, so people with very bad machines (like mine :)) can disable it, although this could break the engine into two pieces IMHO (if i remember things from my first trail to 3D right)
but how often does this lightning bug happen, and what raise of requirements are we speaking of?

@selat
Copy link
Contributor Author

selat commented Apr 2, 2014

But how does work current lighting? Is it recalculated each frame?

@Calinou
Copy link
Member

Calinou commented Apr 5, 2014

We should make it an option though, so people with very bad machines (like mine :)) can disable it, although this could break the engine into two pieces IMHO (if i remember things from my first trail to 3D right)

The problem is, hardware lighting is likely to behave differently, so it could be weird if you play multiplayer. The other problem is code duplication, indeed.

But how does work current lighting? Is it recalculated each frame?

No, it's pre-computed, using sky light (sun, moon) and block light (torch, lava) values.

@sapier
Copy link
Contributor

sapier commented Apr 6, 2014

current lighting is even more a performance killer then dynamic lighting would be (at least for somehow modern gpus). I've seen this on android where light calculation is topmost cpu hog

@PilzAdam
Copy link
Contributor

PilzAdam commented Apr 6, 2014

@sapier hardware lighting wouldnt help, we still need to calculate it the old way for e.g. get_node_light().

@RealBadAngel
Copy link
Contributor

afaik those shadows are caused by invisible caves that are generated in the sky...
and i dont remember that issue being fixed at all.
so, its mapgen bug not the lighting code.

@p5yk0g3n3s1s
Copy link

This should be considered a blocker. It looks horrible and is very hard to fix in-game, without worldedit of course. It makes minetest look bad to a first time user.

@RealBadAngel I remember paramat discussing these invisible caves with hmmm in a pull request at some point. I wonder if cave generation could be rewritten to help solve this bug?

@paramat
Copy link
Contributor

paramat commented Feb 19, 2015

afaik those shadows are caused by invisible caves that are generated in the sky...
and i dont remember that issue being fixed at all.
so, its mapgen bug not the lighting code.

The screenshot seems to show shadows occuring along a mapchunk edge, the shadow shapes look like the shadows of edges of large caves that extend beyond a mapchunks edge. Sometimes the large caves cause bugs and this my be one of them.

@p5yk0g3n3s1s
Copy link

That's unfortunate. These lighting artifacts make minetest look a bit unpolished.

@ShadowNinja ShadowNinja added Bug Issues that were confirmed to be a bug Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible). Medium priority labels Feb 20, 2015
@Zeno-
Copy link
Contributor

Zeno- commented Feb 20, 2015

These do seem to be more common lately, but I may be imagining it

@p5yk0g3n3s1s
Copy link

This sorta thing happened to me after mapgen once and it was kinda annoying because it happened right above my farm.

@paramat
Copy link
Contributor

paramat commented Feb 25, 2015

Mgv6 does not have a heightmap generated during mapgen, if i add one it would stop large caves being generate above ground, which might fix these shadows, i'll see what i can do.

@paramat paramat added @ Mapgen and removed @ Server / Client / Env. Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible). labels Feb 25, 2015
@p5yk0g3n3s1s
Copy link

^I hope it works, these shadows are a very old bug.

@C1ffisme
Copy link

I can still remember this being posted as a bug, and someone thought the sun was casting a shadow. That seems pretty hillarious now. Anyway, I also really hope this gets fixed. Maybe minetest should update nearby chunk's lighting every few minutes? This would fix the problem, maybe...

@paramat
Copy link
Contributor

paramat commented Feb 27, 2015

Heightmap will not fix this, i will try reducing the size of large caves so they do not extend beyond the mapchunk borders.

@Zeno-
Copy link
Contributor

Zeno- commented Feb 27, 2015

Why do invisible caves cause lighting bugs anyway? I looked at the lighting code a fair bit when I was optimising it and can't recall anything that would indicate that a cave should cause lighting changes.

@C1ffisme
Copy link

@Zeno- Yeah, it's like air has a shadow now.

@p5yk0g3n3s1s
Copy link

@Zeno- I think it's just a theory.

@paramat
Copy link
Contributor

paramat commented Feb 27, 2015

Yeah it's weird. These shadows are now very common, possibly due to changes made by hmmmm to lighting code while fixing dark nodes at y = 47. These shadows run along the edges of mapchunks so like floaty dungeons seem to be an overgeneration problem.
Mgv5/v7 have large caves only so might have fewer or no shadow bugs, something to test, they have no small pseudorandom caves (the new small 3D noise caves are never overgenerated) and the large caves are kept underground using heightmaps, so they may have no shadow bugs.
This is a big problem so i need to put a lot of work into this. This problem may justify a radical change in mgv6 cavegen because it looks really bad.
Re-adding the 'nontrivial' label.

@paramat paramat added the Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible). label Feb 27, 2015
@paramat
Copy link
Contributor

paramat commented Feb 27, 2015

Possibly related commits by hmmmm:
7233a12
3bdf3df

@paramat
Copy link
Contributor

paramat commented Feb 28, 2015

Weird fact: flying up and down above a shadow and watching the lighting of the wieldhand, the dark air always changes to bright air above y = 30.

Editing the core code to control caves, it seems the shadows are created by large caves and not small caves.

By placing cave air as water, as RBA did, large caves are certainly generated high above ground, and their edges cause the shadow bugs.

After more experimentation i can confirm these shadows are caused by the edges of large caves that are overgenerated into the ignore nodes of neighbouring not-yet-generated mapchunks. By stopping large cave air nodes replacing ignore nodes the shadows are fixed, but long flat walls appear in the terrian because large caves at the surface help to shape the terrain.
Small caves do not cause shadow bugs because they are prevented from replacing ignore nodes in neighbouring not-yet-generated mapchunks.
Why the cave air is causing shadows is a mystery to me.

@paramat
Copy link
Contributor

paramat commented Mar 1, 2015

This is the best i can do and seems to work well, comments? #2410

@paramat
Copy link
Contributor

paramat commented Mar 2, 2015

#2410 is now merged, hopefully there will now be far fewer shadow bugs, i couldn't find any during testing, although i expect them to still occasionally appear. Preventing large caves being generated above ground will also improve mapgen speed. Needs testing by others before issue is closed.

@paramat
Copy link
Contributor

paramat commented Mar 10, 2015

No feedback, seems to be successful so closing.

@paramat paramat closed this as completed Mar 10, 2015
@p5yk0g3n3s1s
Copy link

I haven't seen these sky shadows ever since the heightmap addition. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug @ Mapgen Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible).
Projects
None yet
Development

No branches or pull requests

10 participants