Declarative 3D/XR framework built on Babylon.js and tosijs. Compose 3D scenes with web components. See the b3d page for a live interactive demo.
import {
b3d,
b3dSun,
b3dSkybox,
b3dLoader,
b3dWater,
b3dReflections,
} from 'tosijs-3d'
document.body.append(
b3d(
{ glowLayerIntensity: 1 },
b3dSun({ shadowCascading: true }),
b3dSkybox({ timeOfDay: 6, realtimeScale: 100 }),
b3dLoader({ url: './scene.glb' }),
b3dWater({ y: -0.2 }),
b3dReflections()
)
)Procedural astronomical objects — planets, stars and star systems, galaxies, and black holes with accretion disk, photon ring and lensing. Generated, not modelled — a solar system is a few attributes.
Procedural terrain — streaming LOD terrain with a biome shader that runs one material from seafloor to mountain, a floating origin so worlds can be large, and carved landforms — volcanoes with lava tubes bored through them, arches, caverns.
Biped control — a character controller with an animation state machine and follow/XR cameras, from a GLB.
Aircraft control — a forgiving flight model that flies like a drone below transition speed and like a plane above it, with VTOL, bank-to-turn, a HUD and radar.
One UI for flat, in-scene and VR — the widget set renders as a DOM overlay, as a texture on a surface in the scene, and as a floating panel in a headset, from the same declaration. Includes a flowing box model, menus and panels, a data table, and an on-screen keyboard — because a headset has nowhere to type.
SVG textures — draw with SVG, use it as a live texture. Designer artwork becomes a HUD, a gauge, or a control surface without a round-trip through a bitmap.
...and a few things that are less visible but are why the rest works:
Every input device behind one interface — keyboard/mouse, touch, hardware
gamepads and XR controllers all produce the same ControlInput, so an entity is
driven identically by a thumbstick, a glass pad, or an AI. Vehicle enter/exit and
input focus come with it. Most frameworks hand you the input surface and wish you
luck.
Simulation that doesn't know about the renderer — a pure, deterministic world store with a documented contract, so an external driver (a narrative engine, a test, a headless run) can drive a world the simulation never had to anticipate.
Adaptive by default — a device-capability probe vends per-tier budgets, and
performance-sensitive settings resolve to auto rather than to a number that is
always wrong for something. A Quest and a workstation get different worlds.
Pure models, actually tested — the flight model, ballistics, guidance, biome classification, layout and text editing are engine-free and unit-tested (1000+ assertions run in ~2s with no GPU). If it can be a function of its inputs, it is.
Requires Bun.
bun install
bun startDev server runs on https://localhost:8030 with auto-rebuild on file changes.