CullFactory

版本 v2.0.11·更新於 2026-06-16

Stops rendering interior rooms that aren't visible - Helps with performance without affecting visuals.

截圖 共 1 張

模組介紹 作者原文

Note: Performance gains may vary between devices. Feel free to give it a try and experiment with different options!

Overview

  • Stops objects that are not visible, or are too far from the camera, from being rendered.
  • Interior rooms, items, and lights will be culled.
  • The default settings are designed to allow zero visual artifacts or popping.
  • Compatible with any mods that add cameras.

Culling Methods

Portal Occlusion Culling

The default culling method, this is intended to hide all objects that are not visible to a camera without affecting visuals. It does so by recursively checking which other tiles are visible to the camera through doorways and connecting pathways between tiles in the interior.

Depth Culling

This is a more naive method that will make tiles visible that are separated from the camera by a certain number of tiles. It may result in hallways becoming invisible in view of the camera.

Developer Information

Rooms are invisible in my interior!

Neighboring rooms are invisible: The Doorway.Socket.Size field is used to determine the bounds of every doorway in the interior. If the size does not encompass the entirety of the possible visible portions of any tiles that can connect to the socket, then those tiles may visibly disappear.

The player's room is invisible: To determine which tile the camera is within, the tiles are searched in the order they were created until a tile with bounds intersecting the camera is found. If the camera is not within any tile bounds, then the closest tile within a certain radius of the camera is used instead. This radius is very lenient, but please try to ensure that your tile bounds are accurate, as inaccurate tile bounds can also lead to players getting stuck in walls.

Important note: DunGen gets very confused about the bounds of a Tile when the object it resides on is scaled. It is best to always keep the scale of your tile objects set to identity (1, 1, 1). If your models need to be scaled, place them into a child object and scale that rather than the tile.

Items or lights are invisible after I move them in or out of the interior!

If items are invisible after your code has teleported them in or out of the interior, you may want to call GrabbableObject.EnableItemMeshes() to fix the issue.

Item/dynamic light culling places each GrabbableObject into one of two pools, interior or exterior. If an item is in a pool that is not currently visible to any cameras, it will be invisible. To avoid unnecessary work, items are only moved between pools when they are:

  • Spawned
  • Dropped
  • Shown or hidden, i.e. when changing inventory slots
  • Grabbed by an enemy
  • Held by a player teleporting via an EntranceTeleport or ShipTeleporter
  • Held by an enemy whose state was changed via EnemyAI.SetEnemyOutside()

If you are teleporting any item in or out of the dungeon and it is not covered by the above cases, a call to GrabbableObject.EnableItemMeshes() will cause CullFactory to move the item to the appropriate pool before the current frame is rendered.

In cases where a light becomes invisible when moving in or out of the interior, the following code can be used to implement a soft dependency to update the light positions whenever necessary:

internal static class CullFactorySoftCompat

{

private static readonly bool CullFactoryDynamicObjectsAPIExists = Chainloader.PluginInfos.TryGetValue("com.fumiko.CullFactory", out var info) && info.Metadata.Version >= new Version(1, 5, 0);

[MethodImpl(MethodImplOptions.NoInlining)]

internal static void RefreshGrabbableObjectPosition(GrabbableObject item)

{

if (CullFactoryDynamicObjectsAPIExists)

DynamicObjectsAPI.RefreshGrabbableObjectPosition(item);

}

[MethodImpl(MethodImplOptions.NoInlining)]

internal static void RefreshLightPosition(Light light)

{

if (CullFactoryDynamicObjectsAPIExists)

DynamicObjectsAPI.RefreshLightPosition(light);

}

}

Calling the RefreshLightPosition() method will make CullFactory check whether the light is inside or out

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack

檔案與校驗

檔案名稱
CullFactory-2.0.11.zip
檔案大小
108.5 KiB
SHA-256
176518e1a5a6a87dbb656bd6ec12f1b6b3102e7964a1bcf7dc1d43872d341d37
入庫時間
2026-10-06 19:15