HOW IT WORKS
How do you stop visitors flying through the walls of a 3D scan?
There are quite a few tools out there that can stream massive 3D models into a browser. I tried most of them while building Submerged Viewer, and one gap kept coming up: none of them makes the walls solid. You fly straight into the rock and out the other side, where the scan turns into a hollow shell.
That makes sense. Those tools are built for inspecting models, and an inspector wants to go anywhere. I want something else. I want a cave to feel like a place you explore, a bit like a game: you follow the passage, squeeze through the tight bits, and the rock stops you.
The obvious fix, collision with the scan itself, does not work. A scan has holes, and it is full of things you should be able to pass, like the grate over the well in my Silver Mountain Fortress scan. So I built a collision cage that makes itself. Here is how it works.

THE SHORT ANSWER
Build the cage from the outside in.
- Take a medium level of detail of the scan. Knowing where the walls are does not need every millimetre.
- Fill the space around it with a 3D grid of 15 cm cells and mark the cells the scan passes through.
- Roll a ball 3 m across over the scan from the outside, never letting it touch the scan. It cannot squeeze through holes or the open ends of passages, so it never gets inside.
- Everything the ball reaches is rock. Everything else, including the bars, pipes and debris inside the passages, is space a visitor may fly through.
- Keep the camera 30 cm from the rock and let it slide along it.
Nothing is placed by hand and nothing about the scan changes. The cage is a small extra file that the viewer checks the camera against.
Status: a working prototype, tested on my scan of the well at Silver Mountain Fortress. It is not part of the public viewer yet, so on that page you can still fly through the walls.
WHY THE OBVIOUS ANSWERS FAIL
A scan is not a game level.
Colliding with the scan itself
A photogrammetry scan is a thin skin with holes wherever the camera could not see. A camera that collides with the skin slips out through every hole and catches on every loose spike.
Simplifying the scan first
Decimation smooths the surface in both directions. In some places the walls move into the passage, in others new gaps open. And the grate is still there, so you still cannot get past it.
Shapes placed by hand
I built this first: tubes and boxes placed along each passage. On a real cave it was too much work, and the shapes never matched passages that change shape every metre.
Only what is loaded
A streaming viewer holds full detail only in front of the camera. Collision against whatever happens to be loaded would miss the wall you are backing into.
THE IDEA
Roll a ball around the outside.
Mark the scan in a grid
The space around the scan is divided into 15 cm cells, and every cell the scan passes through is marked. For the well that is 51 million cells, of which about 95,000 touch the scan.
Start outside and roll inwards
A ball 3 m across starts at the edge of the grid and goes wherever its centre stays more than 1.5 m from the scan. It reaches the outside of every wall, but no hole or opening narrower than 3 m lets it in.
What the ball reaches is rock
Everything the ball can cover becomes the cage, so the cage lies on or behind the walls. It never cuts into a passage, because the ball was never inside one. The grate, far inside the shaft, is never touched.
The camera keeps its distance
For every cell near the cage, the cage file stores how far it is to the rock. The camera keeps 30 cm clear and is pushed back the shortest way out, which makes it slide along a wall instead of stopping dead.
The same rule covers everything inside a passage: a pipe sticking out of the wall, a ladder, a fallen block. The ball outside never reaches them, so they never become walls. For the streaming side of the viewer, read how to stream a 3D model with 100 million triangles.
TESTED ON A REAL SCAN
The well at Silver Mountain Fortress.
Measured 2026-10-12.
My scan of the well has three parts: rooms of the fortress at the top, a brick-lined shaft about 37 m deep, and a partly flooded tunnel about 64 m long at the bottom. The cage was built from the scan alone, in 18 seconds, with nothing placed by hand.




| Test | Result |
|---|---|
| Up through the grate at the top of the well | Passed: 5.6 m straight up, through the bars and into the room above |
| Flying sideways into a wall | Stops 30 cm from the wall and slides along it |
| 47 m of tunnel, including a section about 60 cm wide | Flown end to end, never stuck |
| Places where you could leave the scan | None found: tunnel, shaft and rooms are all inside the cage |
| Time to build the cage | 18 seconds, from 1.8 million triangles |
| Extra download for visitors | 1.9 MB, next to a 408 MB scan |
| Cost per frame | 0.02 ms |
LIMITS
What it does not do yet.
Very wide openings
An unscanned opening wider than the ball lets it in, and that part of the passage gets no cage. The build can notice this and try again with a bigger ball.
Thin rock between passages
Where two passages run closer than 3 m, the ball cannot get between them, so a visitor could cross from one to the other through the wall.
Large objects inside a passage
A pillar in the middle of a room is out of the ball's reach, just like the grate, so visitors fly through it. A size limit could keep large objects solid.
Very large scans
A mine several hundred metres across does not fit in one grid at 15 cm. It has to be processed in pieces, which the prototype does not do yet.
QUESTIONS
Frequently asked.
- Why not use physics on the scan itself?
- Physics engines expect closed, clean surfaces. A photogrammetry scan has holes wherever the camera could not see, loose fragments and spikes, and in a streaming viewer it is loaded piece by piece. Collision against it leaks through the holes, snags on the fragments and changes as detail arrives.
- Can visitors still pass through bars, grates and ladders?
- Yes. Anything inside a passage is out of reach of the ball rolled from outside, so it never becomes part of the cage. In the test the camera flew straight through the grate at the top of the well.
- What happens at a hole in the scan?
- The ball is 3 m across, so it rolls over any hole narrower than that without falling in. The cage closes the hole, and visitors stop there instead of drifting out of the scan into empty space.
- Does someone have to place shapes or draw the cage?
- No. The cage is computed from the scan. The prototype needs two numbers, the size of the ball and the distance the camera keeps from the walls, and the values that worked on the well are 3 m and 30 cm.
- Does it slow the viewer down?
- No. Keeping the camera inside costs about 0.02 ms per frame, and the cage for the well is a 1.9 MB file next to a 408 MB scan.
- Can I use it on my scans?
- Not yet. It is a working prototype, tested on one scan and not part of the public viewer. If you have a cave or mine scan you would like it tried on, write to me.
SEE THE SCAN
A grate you can fly through,
walls you cannot.
KEEP READING


