Page 1 of 2

What can cause these shadows?

Posted: Sat May 21, 2016 14:34
by burli
Sometimes Minetest generates shadows without any obvious reason. Currently I try to fix this in the lua version of the v6 cavegen.

Image

If I fly above these shadows the wield hand gets dark. If I fly up the shadow ends always exactly at 44.0 or at 124.0

I have disabled caves, dungeons and decorations and I use vanilla mc game 0.4.14 with valleys mapgen. The only installed mod is the lua version of v6 caves.

Any idea what can cause these shadows?

Re: What can cause these shadows?

Posted: Sat May 21, 2016 15:00
by Krock
Did you forget to update the lightening like this in the Lua code?

Code: Select all

vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:write_to_map(data)

Re: What can cause these shadows?

Posted: Sat May 21, 2016 15:23
by burli
No. Check this code.
https://github.com/duane-r/fun_caves/blob/v6/mapgen.lua

I fixed some bugs, but I didn't touch this. And yes, debug is set to false

Re: What can cause these shadows?

Posted: Sat May 21, 2016 20:08
by KCoombes

Re: What can cause these shadows?

Posted: Sat May 21, 2016 20:15
by Krock
burli wrote:No. Check this code.<snip>
That's strange because it updates the light after writing the node data. Does anything change when you add "vm:update_map()" after "vm:write_to_map()"?
KCoombes wrote:This will fix it.
You misunderstood the main topic. It is about fixing the lightening bug in a Lua mod.

Re: What can cause these shadows?

Posted: Sat May 21, 2016 21:14
by burli
No, it wont. It removes the shadows, but does not fix the bug. I don't want to run mapfix evey minute

But I get closer. The shadows always appear in the corners of a mapchunk. And I think the size is 16x16 nodes

Image

But they thend to appear on water, but also on solid nodes

Image

Even larger shadows an at a chunk border

Image

I think it has something to do with the overgeneration of some mods. The extra 16 nodes around the chunk. The v6 cavegen use this, and I think moretrees also use this

Will try something with moretrees tomorow

Re: What can cause these shadows?

Posted: Sat May 21, 2016 22:19
by kaadmy
I think I've had shadows like that with <16x16 sizes. might be wrong though.

Re: What can cause these shadows?

Posted: Sun May 22, 2016 03:38
by paramat
The 'fun caves' mod is for use with singlenode mapgen.

Re: What can cause these shadows?

Posted: Sun May 22, 2016 04:02
by burli
paramat wrote:The 'fun caves' mod is for use with singlenode mapgen.
1: it's the "original" fun caves. It is the lua version of the v6 cavegen
2: Duane added surface to the new fun caves

Re: What can cause these shadows?

Posted: Sun May 22, 2016 04:23
by paramat
Ok, contact the mod author in the mod thread.

Re: What can cause these shadows?

Posted: Sun May 22, 2016 05:18
by burli
paramat wrote:Ok, contact the mod author in the mod thread.
I don't think it is a mod problem. Moretrees has the same problem and I think I saw them in vanilla minetest too, but very rarely

Re: What can cause these shadows?

Posted: Sun May 22, 2016 05:51
by burli
Ok, I forgot that the moretree bug is "a little bit" different oO

Re: What can cause these shadows?

Posted: Sun May 22, 2016 11:01
by burli
paramat wrote:Ok, contact the mod author in the mod thread.
I still think it is an engine problem similar to moretrees, probably caused by the same issue. Both mods work with v6, but have problems with v7 based mg's.

Re: What can cause these shadows?

Posted: Sun May 22, 2016 16:40
by StepDevelop
Worldedit bugs ;) Me too returns this bug. it is the fault of deleted nodes, they remain invisible and you can select and generate shadows in the game. If not installed mods, Minetest works wonders! but without mods, are you doing a little :)

I hope I was helpful. The Worldedit bug I could not solve it.

Re: What can cause these shadows?

Posted: Sun May 22, 2016 16:56
by burli
I never used Worldedit.

Hm, generated and deleted nodes... The cavegen only generates air which should not cause shadows

Re: What can cause these shadows?

Posted: Sun May 22, 2016 20:33
by StepDevelop
burli wrote:I never used Worldedit.

Hm, generated and deleted nodes... The cavegen only generates air which should not cause shadows

Hi burli. Can you tell me that mods do you use? I make "accurate testing" of Minetest. If you let me know the mods you use, I see to clarify your problem. Thank you :)

And an air block problem, which are selected (node selection appears), I found this bug using "worldedit" and the "more trees".

Re: What can cause these shadows?

Posted: Sun May 22, 2016 20:38
by burli
As I said in the first post
burli wrote:I have disabled caves, dungeons and decorations and I use vanilla mc game 0.4.14 with valleys mapgen. The only installed mod is the lua version of v6 caves.
The mod is a rewrite of the v6 cavegen in Lua to make the v6 caves avalible for other mapgens. It was originally convertet by duane, but I made some bugfixes.

Re: What can cause these shadows?

Posted: Sun May 22, 2016 21:25
by qwertymine3
This seems to be an engine issue, I can re-create these shadows with this code

Code: Select all

minetest.register_on_generated(function(minp,maxp,seed)
	vm,emin,emax = minetest.get_mapgen_object("voxelmanip")
	vm:set_lighting({day=0,night=0})
	vm:calc_lighting()
	vm:write_to_map()
end)
Also I can reproduce ~100% of times by loading a map in a specific way.
Hopefully not terrain dependent:
Look forward when loading terrain.
When all chunks loaded, look backwards.
When all chunks loaded, look left or right.
When all chunks loaded, look backwards.
Spoiler
chunksize = 5
mg_biome_np_heat = {
flags = defaults
lacunarity = 2
octaves = 3
offset = 50
persistence = 0.5
scale = 50
seed = 5349
spread = (750,750,750)
}
mg_biome_np_heat_blend = {
flags = defaults
lacunarity = 2
octaves = 2
offset = 0
persistence = 1
scale = 1.5
seed = 13
spread = (8,8,8)
}
mg_biome_np_humidity = {
flags = defaults
lacunarity = 2
octaves = 3
offset = 50
persistence = 0.5
scale = 50
seed = 842
spread = (750,750,750)
}
mg_biome_np_humidity_blend = {
flags = defaults
lacunarity = 2
octaves = 2
offset = 0
persistence = 1
scale = 1.5
seed = 90003
spread = (8,8,8)
}
mg_flags = notrees, nocaves, dungeons, noflat, light, decorations
mg_name = v7
mgv7_cave_width = 0.3
mgv7_np_cave1 = {
flags = defaults
lacunarity = 2
octaves = 4
offset = 0
persistence = 0.5
scale = 12
seed = 52534
spread = (96,96,96)
}
mgv7_np_cave2 = {
flags = defaults
lacunarity = 2
octaves = 4
offset = 0
persistence = 0.5
scale = 12
seed = 10325
spread = (96,96,96)
}
mgv7_np_filler_depth = {
flags = defaults
lacunarity = 2
octaves = 3
offset = 0
persistence = 0.7
scale = 1.2
seed = 261
spread = (150,150,150)
}
mgv7_np_height_select = {
flags = defaults
lacunarity = 2
octaves = 6
offset = -8
persistence = 0.7
scale = 16
seed = 4213
spread = (500,500,500)
}
mgv7_np_mount_height = {
flags = defaults
lacunarity = 2
octaves = 3
offset = 256
persistence = 0.6
scale = 112
seed = 72449
spread = (1000,1000,1000)
}
mgv7_np_mountain = {
flags = defaults
lacunarity = 2
octaves = 5
offset = -0.6
persistence = 0.63
scale = 1
seed = 5333
spread = (250,350,250)
}
mgv7_np_ridge = {
flags = defaults
lacunarity = 2
octaves = 4
offset = 0
persistence = 0.75
scale = 1
seed = 6467
spread = (100,100,100)
}
mgv7_np_ridge_uwater = {
flags = defaults
lacunarity = 2
octaves = 5
offset = 0
persistence = 0.6
scale = 1
seed = 85039
spread = (1000,1000,1000)
}
mgv7_np_terrain_alt = {
flags = defaults
lacunarity = 2
octaves = 5
offset = 4
persistence = 0.6
scale = 25
seed = 5934
spread = (600,600,600)
}
mgv7_np_terrain_base = {
flags = defaults
lacunarity = 2
octaves = 5
offset = 4
persistence = 0.6
scale = 70
seed = 82341
spread = (600,600,600)
}
mgv7_np_terrain_persist = {
flags = defaults
lacunarity = 2
octaves = 3
offset = 0.6
persistence = 0.6
scale = 0.1
seed = 539
spread = (2000,2000,2000)
}
mgv7_spflags = mountains, ridges
seed = 3965213387771378814
water_level = 1
[end_of_params]
Tested at (2381,50-60,3004)
Reloading was done by deleting map.sqlite
Lighting issues will appear in different places each load.


Issue seems to be with light updates in the extended emerge area where the chunks are already loaded, as I can see the light issues forming on already loaded chunks.

Re: What can cause these shadows?

Posted: Mon May 23, 2016 00:29
by paramat
> Both mods work with v6, but have problems with v7 based mg's.

The overgeneration used in non-mgv6 mapgens does cause lighting problems.

Re: What can cause these shadows?

Posted: Mon May 23, 2016 00:48
by paramat
I've just realised, mgv6 cavegen can overgenerate by up to 16 nodes.
At https://github.com/duane-r/fun_caves/bl ... n.lua#L539 try:

vm:calc_lighting({x = minp.x - 16, y = minp.y - 16, z = minp.z - 16}, {x = maxp.x + 16, y = maxp.y + 16, z = maxp.z + 16})

or:

vm:calc_lighting({x = minp.x - 16, y = minp.y - 16, z = minp.z - 16}, {x = maxp.x + 16, y = maxp.y, z = maxp.z + 16})

These may not work though.

Re: What can cause these shadows?

Posted: Mon May 23, 2016 01:14
by qwertymine3
paramat wrote:I've just realised, mgv6 cavegen can overgenerate by up to 16 nodes.
At https://github.com/duane-r/fun_caves/bl ... n.lua#L539 try:

vm:calc_lighting({x = minp.x - 16, y = minp.y - 16, z = minp.z - 16}, {x = maxp.x + 16, y = maxp.y + 16, z = maxp.z + 16})
I see that you have missed my post...

Also it doesn't over generate when above ground, the mod doesn't replace air/ignore nodes.
Also that code causes even worse light errors, shortly before crashing minetest.

Re: What can cause these shadows?

Posted: Mon May 23, 2016 01:35
by paramat
I saw your post.
Didn't think this would work.
Large caves do replace air, they have to when flooded with liquid.
My guess is overgenerating large caves spreading darkness.
Still not sure how core mgv6 avoids these lighting bugs.

Re: What can cause these shadows?

Posted: Mon May 23, 2016 02:12
by qwertymine3
Over generating the caves does cause some lighting issues, however the ones which burli is talking about are not related.

burli, try changing the call to set_lighting to

Code: Select all

vm:set_lighting({day=0,night=0},minp,maxp)
EDIT: Fixes the shadows you are talking about, but cuts off mountain shadows @ mapchunk border...
Probably would also cause cave lighting issues...

Re: What can cause these shadows?

Posted: Mon May 23, 2016 02:16
by paramat
https://github.com/duane-r/fun_caves/bl ... n.lua#L296

local p1 = vector.add(orpi, veci, this.of, this.rs / 2)

This can't add 4 values, this would cause the heightmap checks to fail, causing shadows. Try fixing that.
Here's now vector add works https://github.com/minetest/minetest/bl ... or.lua#L86

We had a similar problem in core mgv6, overgenerated large caves were being generated above ground and the dark air was causing lighting bugs:
https://github.com/minetest/minetest/issues/1190
https://github.com/minetest/minetest/pull/2410

Re: What can cause these shadows?

Posted: Mon May 23, 2016 03:06
by qwertymine3
burli, change set_lighting and calc_lighting to:

Code: Select all

	vm:set_lighting({day=0,night=0},{x=minp.x,y=emin.y,z=minp.z},maxp)
	vm:calc_lighting({x=minp.x,y=emin.y,z=minp.z},maxp)
Tested with fun caves, no issues seen in my test senario