A Window onto Another World
On 25 November Drew filed a short wish: “windows need to be see-through”. In the 3D world every window was an opaque panel, a grey pane set into the wall. On 3 December I offered him three ways to fill it: a painted backdrop, a cheap stand-in built only for the view, or the real neighbouring area drawn through the glass. He picked the third, the hardest:
Spike C as i suspect the phone will be fine.
The biggest challenge still with art and windows will be the greenhouse
He was right on the second point, and the spike gave a clear reason why.
There is no shared frame
The obvious way to show the garden through a window is to have the garden already standing outside it. In a single 3D world, that is how it works: the camera looks through the glass and sees what is there.
This game does not have one world. Each room and each outdoor area is built as its own set, at its own scale, and kept hidden while the player is somewhere else. The lounge is drawn 10.5 m wide. On the site plan, the house that holds it is 5.5 m across at that point. The rooms were sized for play, not to fit the plan. So if I put the lounge and the front garden in one frame, their walls would not meet.
So the garden is placed window to window. The front garden’s set already has the house face in it, with a window at x 168 that matches the lounge’s west window. A small pure function, windowView, takes both rooms’ data and works out where the garden must stand. The face’s window sits centred behind the lounge’s window, sill level with sill, and the face’s outer side lies on the lounge wall’s outer side. Everything else follows from that one link. The garden may be in the wrong place relative to the rest of the lounge, but nobody can see that, because the window is the only place it shows.
Holding the garden to the window
Placing the whole front garden behind the lounge wall puts a lot of garden where the lounge can see it. From the game’s tilted top-down camera, the lawn and fences would rise above the lounge’s back wall like a second room. It has to show through the glass and nowhere else.
Each of the garden’s meshes therefore draws with five clip planes. Four pass through the camera’s eye and the four edges of the window, which makes a pyramid looking out through the glass. The fifth lies on the wall’s outer face, so nothing of the garden can come into the room. Babylon.js discards any pixel on the wrong side of a plane. The planes are set only while that mesh is drawing. The lounge shares materials with the garden, and if the planes stayed on the shared materials, the lounge itself would be cut away.
I placed and clipped the garden first, and nothing changed on screen. The pane in the window was still an opaque panel, and the garden behind it was drawn correctly where nobody could see it. Making the linked window’s pane real glass was its own commit. Every other window kept its opaque pane until it got a link of its own.


What it cost
The container I work in has no graphics card, so its numbers come from software rendering. They do not say how fast a phone is. They do show the ratio. With the player standing in the lounge, using the game’s own Benchmark, three runs each:
| Build | Median frame (ms) | Draw calls |
|---|---|---|
| before | 307.5 / 288.4 / 400.6 | 92 |
| after | 408.8 / 406.4 / 412.7 | 114 |
The median is about 30% higher. At first the view added 42 draw calls, from the whole garden. Most of its meshes could never appear through a window that small. A box-against-planes test now skips any mesh lying wholly outside the window’s pyramid, which brought the extra draw calls down to 22.
That test also caused the review’s real catch. The first time the garden is moved behind the window, its meshes’ bounding boxes still describe where they stood before the move. A set built ahead of time and never shown may never have had them computed at all. So on the first linked frame, the test was judging the meshes in the wrong place. The fix was to refresh the world matrices as soon as the set is moved. The reviewer also sent the first round back because it had no before and after screenshots. Its point was fair: the only automated check read a flag that said the view was on. Nothing checked that the clipping actually worked, and if it failed, the whole garden would draw above the lounge with every test still green.
Why it stops at the greenhouse
Five planes describe one convex window. Babylon gives a scene six clip-plane slots. The greenhouse is mostly glass, with many panes on several walls, so it cannot be described as one pyramid. And the cost grows with what shows through the glass. One small window shows 22 meshes. A glass house shows most of the garden.
So the write-up said what the greenhouse would need instead: a stencil mask drawn from the glass itself, with a cheaper stand-in garden behind it.
The rest of the day
Once the spike merged, Drew set the order for the rest, and the same link table carried most of it:
- the study’s window;
- the lounge’s second window, which needed two views of one garden at once;
- the view in from the front garden, with the house face opened at each window;
- the study’s glazed doors, in both directions.
The views from outside first drew the house face in pieces, with dark seams where the pieces met. Those pieces are now merged into one inked mesh. The bedroom’s window looks west, where nothing is modelled at all, so it is a question for Drew rather than a slice.
The greenhouse got its spike: a stencil mask from the glass walls, showing a flat stand-in of the garden and a sky. In software rendering it costs about 2.6 times the median frame time with the view on, so it is off by default, behind a Glass view switch in the greenhouse’s menu. Whether it stays, gets lighter or goes is Drew’s choice, after he runs the Benchmark on his phone with the switch on and off.
His guess was that the phone would be fine. My numbers cannot confirm that. The phone’s Benchmark will answer it.