r/threejs • • 3d ago

Demo Web Browser Flight Sim, all ThreeJS

https://theofs.vercel.app A flight simulator. it's all three.js + WebXR, with real satellite terrain, 240 Hz physics, and real 3D cockpits you can look around in, thoghts?

![img](xtpe39pxy05i1)

![img](x2gyl9pxy05i1)

![img](bby9lapxy05i1)

![img](lcc7kapxy05i1)

![img](5jmsn9pxy05i1)

2 Upvotes

4 comments sorted by

1

u/plus2link 3d ago

240 Hz physics only pays off if the render loop interpolates between steps, otherwise you are simulating frames nobody sees, and in XR you are stuck at the headset's rate anyway, so a fixed 90 Hz sim with interpolation is usually the smoother choice. Satellite terrain tends to fall apart at the horizon rather than up close: sample height with a mip bias so distant ridges stop sparkling, and cap LOD edges with skirts instead of stitching them, because a one-pixel crack reads as a hole in the sky from a few km out. The cockpit is the other trap, since a 2 cm near plane and a 100 km far plane in one pass will z-fight the panel screws, so either logarithmicDepthBuffer or a separate pass for the interior with its own near and far. Are the height and imagery streamed as quadtree tiles with a resident budget, or one big texture?

1

u/Easy_Safety_1253 11h ago

yeah its 240hz but it does interpolate between steps so no jitter. i mostly did 240 so the landing gear doesnt freak out on the ground lol. terrain is quadtree tiles not one texture, it loads the closest ones first and throws out old ones so the quest doesnt run out of memory. and yeah i use skirts. the depth thing is fair, its all one pass rn with near at 5cm. havent seen the panel flicker yet but ill probably split the cockpit into its own pass

1

u/Inevitable-thing-121 1d ago

Real satellite terrain plus a cockpit you can actually look around in WebXR is a great combo. Curious how you stream the terrain tiles at airliner speed: prefetch along the flight path, or a fixed radius around the plane? Near the ground on approach seems like the hardest case.

1

u/Easy_Safety_1253 11h ago

thanks! it's a radius around the plane right now, not prefetching along the flight path. the ground is a quadtree that gets sharper the closer you are (altitude counts too), and it always loads the closest tiles first so the stuff right under you never waits. old tiles stay up until the new ones are fully loaded, so there are no holes, it just sharpens a sec late.

approach is the hard part like you said. airports get flattened to their real elevation so the runway is solid even if the terrain around it is still loading. fast and low is where you can see it get blurry for a second. look-ahead prefetching is on my list