
LCull
Cursed, performant Frustum logic for heavy culling scenes
The project code was created with help of Artificial Intelligence.
An open source mod with cursed, performant Frustum logic for heavy culling scenes. More FPS, but has some side effects.
Advantages
- Culling entities that off-screen:
- Helps in different heavy scenes which increases FPS. (like in CounterMine 2)
- Accelerates work by x2 with Entity Culling, Sodium/Embeddium mods, cuz they're professionals here yea.
Weaknesses
- Useless for other scenes:
- Low amounts of entities
- Entities behind the walls.
- Modded mobs (probably)
- Increases CPU load.
Benchmarks
Default 1.21.11 Fabric version
Before: Without mods
After: With LCull
!lcull1
1.21.11 Fabric with mods: Sodium, Entity Culling, Fabric API
Before: Without LCull
After: With LCull
!lcull2
Why I made this mod?
Minecraft keeps every loaded entity in the render loop even when it is behind your back or far outside the screen, so the GPU and CPU pay full price for things you will never see. In entity-heavy scenes, like RPG-modded servers, minigame hubs or CounterMine maps WITH UP TO 10K ENTITIES (or just a much amount of Display entities), that overhead turns into a real frame-rate tax. Sodium and Entity Culling already do excellent work on the block and entity side, but I wanted a small, focused frustum path tuned specifically for thousands of entities on screen at once, and a clean place to experiment with the rendering pipeline. LCull grows out of the ideas in Lomka (my earlier work that proved tick and refresh culling help a lot) and narrows the scope to one job: stop drawing entities that are not in the view frustum.
How the LCull's Frustum checks works?
Every frame the game already builds a Frustum for the active camera. LCull asks that frustum whether an entity's axis-aligned bounding box lives inside the visible volume - the same six-plane test the renderer uses for chunks, evaluated in a branchless form that resolves the per-corner sign choices once per frame instead of per entity. When the whole box is outside, the entity is skipped during rendering and never reaches the draw call.
Two things keep the result from flickering. The safety margin around the box grows with the entity's speed - 1 block for a stationary entity, up to 2.5 for a fast mover - so nothing pops mid-stride; and a projectile cannot exempt itself by moving fast, because the margin is capped. LCull also leaves vanilla's own escapes intact: anything the renderer marks as never-cullable (fishing hooks, the ender dragon, lightning bolts, name-tag displays) is handed straight back to vanilla, and a leashed mob stays visible while the thing holding its rope is. Both deliberately leave a little on the table rather than dropping something the player can see.
What the Minecraft and LCull problem?
Minecraft does apply its own frustum to chunks and block entities, but the per-entity render loop still iterates and submits everything that is loaded, which is exactly why off-screen mobs cost as much as on-screen ones. LCull removes that off-screen cost, but it cannot remove entities hidden behind walls, because that needs occlusion culling and a visibility graph, a much harder problem than a frustum test. The mod also does nothing useful when there are only a few entities, or in singleplayer where the simulation, not rendering, is the bottleneck. Because culling is decided on the render thread, entities can pop out the instant they leave the view; that is the intended trade for the FPS win, and it trades a little extra CPU work for the frustum evaluation. There is also a narrow compatibility edge: a mod that assumes every entity is "rendered" each frame could behave oddly, which is why LCull stays an opt-in, tunable tweak rather than a silent override.
Links
- Source
- Issue tracker
Как поиграть с друзьями с модом LCull?
Мод LCull куда интереснее в компании: поднимите сервер Майнкрафт с уже установленным модом, позовите друзей и играйте по своим правилам. Хостинг Майнкрафт для мода LCull будет готов за пару минут - BungeeHost сделает всё за вас.
