forked from Mirrorlandia_minetest/minetest
Ensure deterministic client occlusion culling and minor improvements (#14212)
* Ensure deterministic client occlusion culling * Increase culling optimize distance slightly * More accurate culling when sampling
This commit is contained in:
parent
8db4ba9e58
commit
bd42cc2c77
@ -2103,7 +2103,7 @@ server_side_occlusion_culling (Server-side occlusion culling) bool true
|
|||||||
# rendering glitches (missing blocks).
|
# rendering glitches (missing blocks).
|
||||||
# This is especially useful for very large viewing range (upwards of 500).
|
# This is especially useful for very large viewing range (upwards of 500).
|
||||||
# Stated in MapBlocks (16 nodes).
|
# Stated in MapBlocks (16 nodes).
|
||||||
block_cull_optimize_distance (Block cull optimize distance) int 20 2 2047
|
block_cull_optimize_distance (Block cull optimize distance) int 25 2 2047
|
||||||
|
|
||||||
[**Mapgen]
|
[**Mapgen]
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ void set_default_settings()
|
|||||||
// This causes frametime jitter on client side, or does it?
|
// This causes frametime jitter on client side, or does it?
|
||||||
settings->setDefault("max_block_send_distance", "12");
|
settings->setDefault("max_block_send_distance", "12");
|
||||||
settings->setDefault("block_send_optimize_distance", "4");
|
settings->setDefault("block_send_optimize_distance", "4");
|
||||||
settings->setDefault("block_cull_optimize_distance", "20");
|
settings->setDefault("block_cull_optimize_distance", "25");
|
||||||
settings->setDefault("server_side_occlusion_culling", "true");
|
settings->setDefault("server_side_occlusion_culling", "true");
|
||||||
settings->setDefault("csm_restriction_flags", "62");
|
settings->setDefault("csm_restriction_flags", "62");
|
||||||
settings->setDefault("csm_restriction_noderange", "0");
|
settings->setDefault("csm_restriction_noderange", "0");
|
||||||
|
15
src/map.cpp
15
src/map.cpp
@ -1193,13 +1193,14 @@ bool Map::isBlockOccluded(v3s16 pos_relative, v3s16 cam_pos_nodes, bool simple_c
|
|||||||
// this is a HACK, we should think of a more precise algorithm
|
// this is a HACK, we should think of a more precise algorithm
|
||||||
u32 needed_count = 2;
|
u32 needed_count = 2;
|
||||||
|
|
||||||
v3s16 random_point(myrand_range(-bs2, bs2), myrand_range(-bs2, bs2), myrand_range(-bs2, bs2));
|
// This should be only used in server occlusion cullung.
|
||||||
if (!isOccluded(cam_pos_nodes, pos_blockcenter + random_point, step, stepfac,
|
// The client recalculates the complete drawlist periodically,
|
||||||
start_offset, end_offset, needed_count))
|
// and random sampling could lead to visible flicker.
|
||||||
return false;
|
if (simple_check) {
|
||||||
|
v3s16 random_point(myrand_range(-bs2, bs2), myrand_range(-bs2, bs2), myrand_range(-bs2, bs2));
|
||||||
if (simple_check)
|
return isOccluded(cam_pos_nodes, pos_blockcenter + random_point, step, stepfac,
|
||||||
return true;
|
start_offset, end_offset, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Additional occlusion check, see comments in that function
|
// Additional occlusion check, see comments in that function
|
||||||
v3s16 check;
|
v3s16 check;
|
||||||
|
@ -305,9 +305,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes, bool simple_check = false)
|
bool isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes)
|
||||||
{
|
{
|
||||||
return isBlockOccluded(block->getPosRelative(), cam_pos_nodes, simple_check);
|
return isBlockOccluded(block->getPosRelative(), cam_pos_nodes, false);
|
||||||
}
|
}
|
||||||
bool isBlockOccluded(v3s16 pos_relative, v3s16 cam_pos_nodes, bool simple_check = false);
|
bool isBlockOccluded(v3s16 pos_relative, v3s16 cam_pos_nodes, bool simple_check = false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user