火龙MOD网
首页游戏库玩家合集工具辅助
游戏库/致命公司/体验与辅助/室内设施地牢结构 (CullFactory)

室内设施地牢结构 (CullFactory)

适用版本:v68 / 2026最新版MOD 版本:v2.1.0文件大小:113.9 KB更新日期:2026-11-17

### 【模组详细说明与实操指南】

!Banner

**注意:** 性能提升可能因设备而异。请随意尝试并尝试不同的选项!

## Overview

- 停止渲染不可见或距离相机太远的对象。

- 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

### 门户遮挡剔除

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

### Cached Shadow Maps

A light can be set up so that CullFactory manages it and only renders its shadow maps when they become visible, keeping them in the cached shadow map until they become invisible again. This is done by setting its `Shadow Map`'s `Update Mode` to `On Enable` or `On Demand`, and turning the `Update on light movement` and `Always draw dynamic` off. Lights set to `On Enable` are changed to `On Demand` at runtime when culling is enabled.

For all lights that meet those criteria, CullFactory will mark the lights to have their shadow maps rendered when they go from culled to visible. While their shadow maps are rendering they are set to render only `Room`, `MiscLevelGeometry`, `Terrain`, and `Railing`. These are specifically chosen because they generally contain only static geometry, to avoid shadows being baked into the cache that will appear out of place when an object moves.

Using this feature should allow more shadow maps to be used with less cost to performance. It is best suited to environments with a lot of static geometry, especially when it is out of reach of the player and their shadow.

### 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:

```cs

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 outside and move it to the appropriate pool so that it can be visible again.

The `RefreshGrabbableObjectPosition()` can also be called as an alternative to `GrabbableObject.EnableItemMeshes()` to avoid the overhead of finding the renderer components and switching their visibility unnecessarily.

### 【联机规则与注意事项】

* **联机兼容性**:【建议全员安装】(联机辅助模组,开黑车队全员安装体验最佳)

* **前置依赖需求**:BepInEx-BepInExPack-5.4.2100

* **当前模组版本**:`2.1.0`

* **适配版本**:针对《致命公司》2026 最新稳定版(v68+)整理适配