Skip to content

Commit

Permalink
Pick a random ray, so that far missing block will eventually be shown
Browse files Browse the repository at this point in the history
  • Loading branch information
lhofhansl committed Dec 7, 2023
1 parent 3713e80 commit bbda364
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2068,11 +2068,11 @@ block_send_optimize_distance (Block send optimize distance) int 4 2 32767
server_side_occlusion_culling (Server-side occlusion culling) bool true

# At this distance the server will perform a simpler and cheaper occlusion check.
# Smaller values potentially improve performance, at the expense of visible
# Smaller values potentially improve performance, at the expense of temporarily visible
# rendering glitches (missing blocks).
# This is especially useful for very large viewing range (upwards of 500).
# Stated in mapblocks (16 nodes).
block_cull_optimize_distance (Block cull optimize distance) int 25 2 32767
block_cull_optimize_distance (Block cull optimize distance) int 20 2 32767

[**Mapgen]

Expand Down
2 changes: 1 addition & 1 deletion src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ void set_default_settings()
// This causes frametime jitter on client side, or does it?
settings->setDefault("max_block_send_distance", "12");
settings->setDefault("block_send_optimize_distance", "4");
settings->setDefault("block_cull_optimize_distance", "25");
settings->setDefault("block_cull_optimize_distance", "20");
settings->setDefault("server_side_occlusion_culling", "true");
settings->setDefault("csm_restriction_flags", "62");
settings->setDefault("csm_restriction_noderange", "0");
Expand Down
8 changes: 6 additions & 2 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,9 +1180,13 @@ bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes, bool simple_chec
// this is a HACK, we should think of a more precise algorithm
u32 needed_count = 2;

v3s16 random_point(myrand_range(-bs2, bs2), myrand_range(-bs2, bs2), myrand_range(-bs2, bs2));
if (!isOccluded(cam_pos_nodes, pos_blockcenter + random_point, step, stepfac,
start_offset, end_offset, needed_count))
return false;

if (simple_check)
return isOccluded(cam_pos_nodes, pos_blockcenter, step, stepfac,
start_offset, end_offset, needed_count);
return true;

// Additional occlusion check, see comments in that function
v3s16 check;
Expand Down

0 comments on commit bbda364

Please sign in to comment.