-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Temporal Hysteresis and Zero Allocation
Dasik edited this page Aug 20, 2026
·
1 revision
High-speed occlusion culling can introduce two common performance flaws:
- Camera-Grazing Flicker (Z-Fighting / Boundary Pop-in): Small camera rotations crossing block edges can cause entities to rapidly flicker between rendered and unrendered states on alternating frames.
-
Garbage Collection Stutter Spikes: Continuous allocation of
new Vec3()objects during raycasting triggers JVM Young-Gen garbage collection pauses.
Camera Culling solves both issues with an Adaptive Distance-Scaled Grace Buffer and a Zero-Allocation Hot-Path Engine.
| Property | Value |
|---|---|
| Near Distance Grace Buffer | |
| Medium Distance Grace Buffer | |
| Far Distance Grace Buffer | |
| Visibility Transition | Instantaneous ( |
| Tracking Structure |
it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap (Zero boxing overhead) |
| Per-Frame Allocations |
|
[ENTITY SIGHTLINE LOST]
│
├── Frame 1 occluded ──► RENDER (Grace Decay)
├── Frame 2 occluded ──► RENDER (Grace Decay)
├── Frame 3 occluded ──► RENDER (Grace Decay)
└── Frame 4 occluded ──► CULL (Streak Met)
-
Instant Unculling: As soon as a single raycast sample establishes a clear line of sight, the occlusion streak is removed (
OCCLUDED_STREAK.remove(id)), making the entity visible immediately. - Asymmetric Decay: Becoming occluded requires multiple consecutive frames; becoming visible takes 1 frame. This eliminates camera-turning flicker.
In CullingRaycastHelper.java, intermediate vector heap allocations are completely eliminated:
public static boolean hasLineOfSight(Level level, Vec3 from, double toX, double toY, double toZ) {
Vec3 to = new Vec3(toX, toY, toZ);
ClipContext ctx = new ClipContext(from, to, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, CollisionContext.empty());
BlockHitResult hit = level.clip(ctx);
if (hit.getType() == HitResult.Type.MISS) {
return true;
}
...
}
Camera Culling Documentation • Part of the Vanilla Outsider Collection
Author: Dasik (Rifaditya) • Licensed under GNU General Public License v3.0 (GPLv3)
📌 Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits ahead of public release builds on CurseForge/Modrinth.
- MC 26.3 Overview
- Entity Occlusion Culling
- Block Entity Culling
- Sign & Hanging Sign Culling
- Particle & Animation Culling
- Mob Crowd Overdraw Defense
- Distance Texture LOD
- Boss & Blacklist Immunity
- Temporal Hysteresis & Math
- Commands & Configuration
- GUI Configuration (YACL)
- Debug Tracing & Diagnostics
- Architecture & Mixins
- Developer Setup & Building
- API & Mod Integration
- MC 26.2 Overview
- Entity Occlusion Culling
- Block Entity Culling
- Sign & Hanging Sign Culling
- Particle & Animation Culling
- Mob Crowd Overdraw Defense
- Distance Texture LOD
- Boss & Blacklist Immunity
- Temporal Hysteresis & Math
- Commands & Configuration
- GUI Configuration (YACL)
- Debug Tracing & Diagnostics
- Architecture & Mixins
- Developer Setup & Building
- API & Mod Integration
- MC 26.1.2 Overview
- Entity Occlusion Culling
- Block Entity Culling
- Sign & Hanging Sign Culling
- Particle & Animation Culling
- Mob Crowd Overdraw Defense
- Distance Texture LOD
- Boss & Blacklist Immunity
- Temporal Hysteresis & Math
- Commands & Configuration
- GUI Configuration (YACL)
- Debug Tracing & Diagnostics
- Architecture & Mixins
- Developer Setup & Building
- API & Mod Integration