本项目代码在人工智能的帮助下创建。
一款开源模组,拥有诡异但高效的视锥剔除逻辑,适用于大量实体渲染的场景。能提升帧率,但会带来一些副作用。
优势
- 剔除屏幕外的实体:
- 在复杂的场景中有助于提升 FPS。(例如 CounterMine 2)
- 与 Entity Culling、Sodium/Embeddium 模组配合时,效率提升 x2,因为它们在这方面很专业。
劣势
- 在其他场景下无效:
- 实体数量较少时
- 实体位于墙壁后方时
- 模组生物(可能)
- 会增加 CPU 负载。
基准测试
默认 1.21.11 Fabric 版本
之前:无模组
之后:启用 LCull

1.21.11 Fabric 带模组:Sodium, Entity Culling, Fabric API
之前:未启用 LCull
之后:启用 LCull

为什么制作这个模组?
Minecraft 会将所有加载的实体保留在渲染循环中,即使它们在你的背后或远在屏幕之外,导致 GPU 和 CPU 为那些你永远不会看到的东西支付全额开销。在实体密集的场景中,比如 RPG 模组服务器、小游戏大厅或 CounterMine 地图(最多可达 10K 个实体,或者大量的 Display 实体),这种开销会变成实实在在的帧率税。Sodium 和 Entity Culling 已经在区块和实体层面做得非常出色,但我想要一个小型、专注的视锥路径,专门针对屏幕上同时存在的数千个实体进行优化,并作为一个干净的实验平台来研究渲染管线。LCull 源于 Lomka(我之前的作品,证明了 Tick 和刷新剔除很有帮助)中的想法,并将范围缩小到一项工作:停止绘制不在视锥体内的实体。
LCull 的视锥检测是如何工作的?
每一帧,游戏都会为当前摄像机构建一个视锥体。LCull 会询问该视锥体,实体的轴对齐包围盒(AABB)是否位于可见体积内——这与渲染器用于区块的六平面测试相同,但以无分支形式评估,每帧只解析一次每个角的符号选择,而不是每个实体一次。当整个包围盒都在外部时,实体在渲染期间被跳过,永远不会到达绘制调用。
有两点可以防止结果闪烁。包围盒周围的安全余量随实体的速度增长——静止实体为 1 个方块,快速移动的实体最高为 2.5 个方块——这样就不会出现中途瞬移的情况;并且 projectile 不能通过高速移动来豁免,因为余量有上限。LCull 也保留了原版自身的例外情况:任何被渲染器标记为不可剔除的内容(钓鱼钩、末影龙、闪电、名称标签显示)都会直接交还给原版,而拴绳的生物在拴绳对象存在时会保持可见。这两者都故意留有余地,而不是让玩家能看到的东西突然消失。
Minecraft 和 LCull 的问题是什么?
Minecraft 确实会对区块和区块实体应用自己的视锥体,但每实体的渲染循环仍然会迭代并提交所有已加载的内容,这正是屏幕外的怪物和屏幕内的怪物消耗相同性能的原因。LCull 消除了屏幕外的开销,但它无法移除隐藏在墙壁后面的实体,因为这需要遮挡剔除和可见性图,这是一个比视锥测试难得多的问题。当实体数量很少时,或者在单人游戏中(模拟而非渲染是瓶颈)时,该模组也没有用处。由于剔除是在渲染线程上决定的,实体一旦离开视野就会立即弹出;这是为了获得 FPS 提升而有意做出的权衡,并且用额外的 CPU 工作来换取视锥评估。还有一个狭窄的兼容性边缘情况:假设每一帧都“渲染”了每个实体的模组可能会出现异常行为,这就是为什么 LCull 是一个可选的、可调节的微调项,而不是静默覆盖。
链接
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

1.21.11 Fabric with mods: Sodium, Entity Culling, Fabric API
Before: Without LCull
After: With LCull

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
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 LCull
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
评论 0
登录后参与评分
还没有评论,来抢沙发吧