Drawing long building cells in chunks for better detail
A 215 m street drew the house beside the eye coarse because Godot picks a batch's range from its box. A k-d split into chunks fixed it, at a cost in draw calls.
A house right beside the eye could be drawn as a coarse far model. I fixed it by splitting a long cell of buildings into chunks, each with its own level of detail, and it costs about twice the draw calls on a 12-house street. I also gave bridges a plan that says what they span, and made a barn one dark room.
Why was the gate beside the eye drawn coarse?
Godot decides when a batch of instances is visible from the distance to the middle of the batch’s box. It doesn’t look at any one instance. My cell of buildings was one batch per piece and level with one box over the whole cell, which for a street is about 215 m long. So every house got the level that the middle of the street got. Standing next to a gate at one end, the gate could be drawn at a far level.
I tinted each piece by its level and filmed it, and the green, which is the full model, stays beside the eye now.
How does the split work?
The fix is to make the boxes small. A function takes one box per building and gives back each building’s chunk number. It keeps a stack of lists of buildings, merges each list’s boxes, and stops when the merged box’s half diagonal is at most 32 m or the list has one building. A building is never split, because it can’t be drawn at two levels. Otherwise it splits along the longer side of the merged box, x or z. It sorts the buildings by the center of their boxes on that axis and cuts at the middle. If everything lands on one side, it cuts in half by count instead, so it always ends.
Each chunk then builds its own batches, and each batch’s box is the chunk’s box. Each chunk also gets its own far block, a single mesh of the chunk’s buildings that shows from 320 m. The far block is the visibility parent of the chunk’s batches, so they switch off when it switches on. A cell that fits in one street front of 64 by 40 m stays one chunk or two.
The guarantee follows from the numbers. Level 0 ends at 64 m with a 4 m margin, and a chunk is wrong by at most its 32 m reach. So anything within 64 minus 4 minus 32, which is 28 m, of the eye is always at full detail. Anything past 64 plus 4 plus 32, which is 100 m, never is.
How do I know it’s right?
A test walks the eye along a long cell 7 m off its line at 1.6 m high, every 4 m. It checks that every piece within 28 m is at level 0, every piece past 100 m is at a far level, and each piece is at exactly one level. It covered 8968 pieces-and-eye pairs, and none was wrong. Another part builds a 200 m cell of six bridges, a wall and a gate, and checks that the gate’s arch from 4.5 m away and the beam bridge’s rail from 8 m are drawn at level 0, using Godot’s rule read from the cell’s nodes.
Is 32 m worth the draw calls?
It’s a trade and I put it to myself as one. I tried a reach of 45 m and one of 32 m on the 12-house street seen from inside. At 45 m it cost 541 draw calls, and it only guarantees full detail within about 15 m. At 32 m it costs 695, up from 363 before the change, and guarantees 28 m. Triangles went down a little, from 1.95 million to 1.78 million. I picked 32 m, since a house in reach being coarse was the thing I was fixing.
Letting a level lay a bridge over a gap
A bridge’s plan now says what it spans, so a level can put one over a gap later. The plan holds the deck height of 3.0 m, and how much room there is under it: 2.25 m under the beam deck, 2.034 m under the 6 m arch’s crown and 1.3 m under the dead arch. It holds where the abutments’ inner faces are, at minus and plus 6 m, and the four 3 m squares between them. Each square has its least clear height, how much of its width is open, and whether the deck stands over it or has fallen. It also holds the strips that are solid, the piers and arch walls.
All of it is read from a table of profiles copied from the kit’s collision boxes. Each member along its length is a list of segments marked as under, solid, open or fill. A test checks the table against the installed members. Nothing places a bridge over a gap yet.
Making a barn one dark room
Through a barn’s open cart door you could see lit partitions behind the leaves, like a wainscot. A barn is one big hall, so I removed its 36 partition pieces and kept only the floor slabs. The inside faces and the floor are now drawn in the darkest of the light columns. The left half of the picture is before and the right half is after.

What is left
Nothing lays a bridge over a gap yet. The plan is there for when a level wants one.