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.

Submerged Viewer showing a narrow rock tunnel with water on its floor, from the scan of the well at Silver Mountain Fortress
The tunnel at the bottom of the well at Silver Mountain Fortress, in Submerged Viewer. Today nothing stops a visitor flying straight into that rock.

THE SHORT ANSWER

Build the cage from the outside in.

  1. Take a medium level of detail of the scan. Knowing where the walls are does not need every millimetre.
  2. Fill the space around it with a 3D grid of 15 cm cells and mark the cells the scan passes through.
  3. 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.
  4. Everything the ball reaches is rock. Everything else, including the bars, pipes and debris inside the passages, is space a visitor may fly through.
  5. 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.

THE IDEA

Roll a ball around the outside.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

A ball rolled around the outside of a passage bridges a hole in the roof and the open end, never reaches the grate inside, and its path forms the cageBall, 3 m acrossHole in the scanCameraEnd of the scanThe cage (dashed)Grate: the ball never gets hereOutside: where the ball rolls
Seen in section. The ball bridges the hole and the open end and never reaches the grate, so the cage (dashed) runs along the outside of the walls and the grate stays passable.

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.

The iron grate at the top of the well, seen from below inside the shaft
Below the grate, looking up. With the cage on, the camera flew straight up 5.6 m, through the bars, into the room above.
The same grate seen from above, with the shaft dropping away beneath it
Above the grate, looking back down the shaft. The bars never became part of the cage.
A narrow rock tunnel with water on the floor, narrowing further into the distance
The tunnel a few metres before its tightest point, about 60 cm wide. The camera flew the 47 m from the field note "With high water" to "Brick ending" without getting stuck.
Side view of the scan's flyable space: rooms at the top, a long vertical shaft, and a tunnel running off along the bottom
The space where visitors can fly, computed from the scan. Rooms, shaft and tunnel are all inside; nothing leaks out.
TestResult
Up through the grate at the top of the wellPassed: 5.6 m straight up, through the bars and into the room above
Flying sideways into a wallStops 30 cm from the wall and slides along it
47 m of tunnel, including a section about 60 cm wideFlown end to end, never stuck
Places where you could leave the scanNone found: tunnel, shaft and rooms are all inside the cage
Time to build the cage18 seconds, from 1.8 million triangles
Extra download for visitors1.9 MB, next to a 408 MB scan
Cost per frame0.02 ms

LIMITS

What it 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.