Skip to content

Commit

Permalink
Show a lower LoD level instead of having a detailled level pop up whe…
Browse files Browse the repository at this point in the history
…n very close

- It is visually more pleasant to have a low quality model than to have a sudden popping from the high quality one appearing when already close
- This also boosts performance
  • Loading branch information
Alayan-stk-2 committed May 6, 2024
1 parent 553595f commit e505d9c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/graphics/lod_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,19 @@ int LODNode::getLevel()
m_lod_distances_updated = true;
}

for (unsigned int n=0; n<m_detail.size(); n++)
// The LoD levels are ordered from highest quality to lowest
unsigned int lod_levels = m_detail.size();

for (unsigned int n=0; n<lod_levels; n++)
{
if (squared_dist < m_detail[n])
// If a high-level of detail would only be triggered from very close (distance < ~90),
// and there are lower levels available, skip it completely. It's better to display
// a low level than to have the high-level pop suddenly when already quite close.
if (squared_dist < m_detail[n] &&
(m_detail[n] > 8000 || (n == lod_levels - 1)))
{
m_current_level = n;
return n;
m_current_level = n;
return n;
}
}
m_current_level = -1;
Expand Down

1 comment on commit e505d9c

@Alayan-stk-2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Display_low_detail

Performance improvement on lowest geometry detail - and it really doesn't look any worse because the distraction from popping was not worth the improved quality of the displayed image.

Please sign in to comment.