🐛 fix(effects): stabilize LOD effect culling - #107
Open
24KaratAu wants to merge 1 commit into
Open
Conversation
|
@24KaratAu is attempting to deploy a commit to the Samuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds hysteresis bias when capping active effects to reduce LOD churn near the cutoff boundary by prioritizing already-active buildings.
Changes:
- Compute a hysteresis bias from
farSq - nearSq - Subtract bias from active buildings' squared distances when sorting for cap selection
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return { idx, distSq: dx * dx + dz * dz }; | ||
| const actualDistSq = dx * dx + dz * dz; | ||
|
|
||
| // // Bias active buildings to reduce LOD churn near the cutoff boundary |
|
|
||
| // Cap at maxActiveEffects — keep closest buildings | ||
| if (newSet.size > maxActiveEffects) { | ||
| const hysteresisBiasSq = Math.max(0,farSq - nearSq); |
|
|
||
| // Cap at maxActiveEffects — keep closest buildings | ||
| if (newSet.size > maxActiveEffects) { | ||
| const hysteresisBiasSq = Math.max(0,farSq - nearSq); |
24KaratAu
force-pushed
the
fix/lod-transition-pop
branch
from
May 29, 2026 18:20
caa49d3 to
5d399fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes visual popping of high-detail building effects during fly mode in dense city areas.
EffectsLayer.tsxalready applied hysteresis for distance-based activation, but themaxActiveEffectscapacity limit introduced a second instability source. Buildings near the active-set cutoff boundary continuously swapped positions during small camera movements, triggering rapid mount/unmount churn forActiveBuildingEffects.This change stabilizes the capacity-culling step by applying a small prioritization bias to already-active buildings:
This makes active effects slightly "stickier" so they remain mounted until meaningfully outdistanced by new candidates, reducing visible popping while preserving the existing rendering architecture and performance characteristics.
Related issue
Fixes #92
Screenshots
N/A (visual stabilization / reduced effect churn)
Checklist
.envvalues committednpm run lintpasses globally (repo currently contains unrelated pre-existing lint errors)