← back to Goodquestion Ai

src/content/posts/2026-02-19-zone-culling-nearly-killed-my-3d-app.md

68 lines

---
title: '2,320 Objects, 88% Hidden, Zero Rendered: The Optimization That Broke Everything'
description: "My custom performance trick hid 88% of a 3D scene and caused blank screens. The fix was deleting my code entirely."
date: 2026-02-19
tags: ["debugging", "performance", "scaling"]
---

You spend a full day building a performance optimization, and the result is a completely blank screen on every device. That was my Tuesday.

![hero](/images/heroes/zone-culling-nearly-killed-my-3d-app.png)

## The Problem Worth Solving

I was building a multi-room 3D visualization -- a virtual workspace where users navigate between distinct spaces. Each room had between 50 and 400 objects: walls, floors, furniture, textures, lights. The entire scene held 2,320 objects.

Desktop performance was solid, but tablets were struggling. The obvious move? Only show objects the user actually needs to see. Hide everything else.

## The Clever Idea

I divided the 3D space into zones. When a user enters a zone, the system hides every object that belongs to a different zone. Fewer objects to render means faster frames. Simple math.

I tagged every object with a zone label during setup. On zone change, flip visibility. Clean and fast.

Except for one thing: **it hid 2,041 of 2,320 objects**. Every time.

## Why It Broke

The logic was sound. The data wasn't. Many objects had no zone tag at all -- ambient lights, shared geometry, structural elements that span multiple rooms. My system treated untagged objects as belonging to nowhere, which meant they slipped through the filter. But tagged objects from *other* zones were aggressively hidden.

The result: switching from Room A to Room B would hide everything in Room A -- including shared walls, floor planes, and environment maps. The user would see nothing. A black void with a spinner that never resolved.

The system faithfully logged `hid 2041 of 2320 objects` on every transition. I ignored it for two days because I assumed most objects *should* be hidden. More hidden means better performance, right?

## The Fix Nobody Wants to Hear

I deleted my optimization entirely.

The rendering framework already handles this. It ships with built-in visibility culling -- it checks whether each object is actually visible to the camera before drawing it. No zone tags, no manual toggling, no guessing. It has been doing this reliably since 2010 and handles edge cases I never considered: objects that span multiple zones, objects behind the camera, objects too small to matter at the current distance.

After removing my 47 lines of custom code, the app rendered correctly in every room. Tablet performance? Fine. The framework was already doing the work. My system was doing the same job, worse, and breaking the scene in the process.

## The Numbers

| Metric | My Custom System | Built-in Framework Culling |
|--------|-----------------|---------------------------|
| Objects hidden | 2,041 (88%) | ~800-1,400 (varies by camera angle) |
| Black screen bugs | Constant | Zero |
| Room transition time | 120ms | 0ms (automatic) |
| Lines of code | 47 | 0 |

## What This Means For Your Business

Every system you build has layers of tools and frameworks underneath it. Before you invest time building a custom solution to a performance problem, check whether the foundation already solves it.

This applies far beyond 3D graphics:

1. **Read the docs before you build.** The solution you need might already exist one layer down. That afternoon spent reading documentation can save a week of debugging.
2. **Measure before you optimize.** I assumed the bottleneck was object count. It was actually texture loading. I solved the wrong problem.
3. **Pay attention to your own logs.** That "hid 2041 of 2320" message was a giant red flag. I should have questioned it on day one instead of day three.

The fastest solution is often the one you don't have to build -- because someone already built it into the tools you are using.

## Let's Connect

- [Twitter/X: @AgentAbrams](https://x.com/AgentAbrams)
- [LinkedIn: Steve Abrams](https://linkedin.com/in/steveabrams)
- [YouTube: @AgentAbrams](https://youtube.com/@AgentAbrams)