[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110607":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":14,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":31,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},110607,"solstice","SamG-Coder\u002Fsolstice","SamG-Coder","Nanite and Lumen style rendering in the browser: virtualized geometry and dynamic global illumination in Rust and WebGPU","https:\u002F\u002Fsamg-coder.github.io\u002Fsolstice\u002F",null,"Rust",96,9,1,4,0,7,44,50.9,"MIT License",false,"main",true,[25,26,27,28,29,30],"global-illumination","nanite","rendering","rust","webgpu","wgpu","2026-11-16 04:19:59","2026-11-21 05:25:50","# Solstice\n\n[![CI](https:\u002F\u002Fgithub.com\u002FSamG-Coder\u002Fsolstice\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FSamG-Coder\u002Fsolstice\u002Factions\u002Fworkflows\u002Fci.yml)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg)](LICENSE)\n\nA real-time renderer in Rust and WebGPU, built on the same core ideas as Unreal Engine 5's\nNanite and Lumen: virtualized geometry and dynamic global illumination, running in the browser.\n\n**[Try the live demo](https:\u002F\u002Fsamg-coder.github.io\u002Fsolstice\u002F)** in a WebGPU browser such as Chrome\nor Edge. It has three scenes, a ruined temple, a fort on a cove built from photoscans, and a meadow\nat the edge of a wood, streamed as you look around at a quality level that suits your GPU. Over\nthem, volumetric clouds drift with the wind while the weather changes by itself, and the day\npasses: the sun crosses the sky, and night brings the moon in its true phase, the stars and the\nMilky Way.\n\n![A ruined temple at dusk, firelight glowing from its doorway](docs\u002Fdusk.png)\n\nSolstice is an independent implementation written from published techniques. It contains no\nEpic Games code and is not affiliated with Epic Games.\n\n| Multi-bounce firelight | Daylight | Cluster view |\n|---|---|---|\n| ![Chamber](docs\u002Fchamber.png) | ![Daylight](docs\u002Fday.png) | ![Clusters](docs\u002Fclusters.png) |\n\n| A meadow and wood, all procedural | Fair-weather cumulus over the cove | Broken cloud over the temple |\n|---|---|---|\n| ![Meadow](docs\u002Fmeadow.jpg) | ![Cove](docs\u002Fcove-clouds.jpg) | ![Temple](docs\u002Ftemple-clouds.jpg) |\n\n| Sunrise over the cove | A gibbous moon at midnight | The Milky Way on a moonless night |\n|---|---|---|\n| ![Sunrise](docs\u002Fsunrise.jpg) | ![Moonlit](docs\u002Fmoonlit.jpg) | ![Milky Way](docs\u002Fmilky-way.jpg) |\n\n## Quick start\n\n```bash\ncargo run --release -p bake -- --quality web --output assets\u002Fweb.solstice\n```\n\n```bash\nbash scripts\u002Fbuild-web.sh\n```\n\n```bash\npython scripts\u002Fserve.py\n```\n\nThen open \u003Chttp:\u002F\u002Flocalhost:8765> in Chrome or Edge.\n\n### Publishing the site's scenes\n\nThe site does not bake or deploy its scenes: they take minutes to bake and hundreds of megabytes\nto move. Each scene has its own repository and Pages site, such as\n[solstice-scene-forest](https:\u002F\u002Fgithub.com\u002FSamG-Coder\u002Fsolstice-scene-forest), served on the same\ndomain as the viewer, so the browser can stream it, which it cannot from a GitHub release.\nPublishing one scene never redeploys the viewer or the others.\n\nBake on a PC and publish: the script compares each scene with the checksum its site records,\nand for each one that changed, uploads it as a release of that scene's repository and updates\nits `scene.txt`, which deploys it. `--check` reports what would be published.\n\n```bash\npython scripts\u002Fpublish-scenes.py --bake forest\n```\n\nFor the native viewer, bake the full scene and run it:\n\n```bash\ncargo run --release -p bake\n```\n\n```bash\ncargo run --release -p viewer\n```\n\nBoth viewers use **click** to look, **WASD** to move, **Q\u002FE** for down and up, and **Shift** to go\nfaster. The browser page also has controls for debug views, the weather, the time of day and render\nscale. Its weather starts as **Changing**, which drifts from one kind of weather to the next on its\nown; the menu fixes one instead, and **Extras** can follow a place's real weather (from\n[Open-Meteo](https:\u002F\u002Fopen-meteo.com)). A day passes in 20 minutes: the **Time of day** slider follows\nthe clock and sets it, **Time passes** speeds it up, slows it to real time or stops it, and **North**\nturns the sky around the scene. The page also takes `?time=HH:MM` and `?day-length=SECONDS`.\n\nThe native viewer takes `--weather NAME` or a weather file, and **C** moves to the next kind of\nweather. `--time HH:MM` starts a clock, with `--day N` (day of the year), `--latitude DEGREES` and\n`--day-length SECONDS`; **T** moves the clock on an hour.\n\n## Your own models\n\nAny glTF 2.0 file (`.gltf` or `.glb`) can be baked into a scene:\n\n```bash\ncargo run --release -p bake -- --gltf model.glb --fit 4 --ground --output assets\u002Fmodel.solstice\n```\n\n```bash\ncargo run --release -p viewer -- assets\u002Fmodel.solstice\n```\n\n![A photoscanned boulder imported from glTF](docs\u002Fscan.png)\n\n*[Boulder 01](https:\u002F\u002Fpolyhaven.com\u002Fa\u002Fboulder_01) by Rico Cilliers, from Poly Haven (CC0), imported\nwith the command above. The scan is not included in this repository.*\n\n`--fit` scales the model so its longest side is that many metres, and stands it on the ground. The\nGI system works in fixed world-space sizes, so use it for models in other units or at unusual\nscales. The ground is at Y = 0 when that lies in the lower half of the model, as it does for most\nscans, and otherwise at the model's lowest point. `--ground` adds a floor, and `--texture-size` sets the resolution all textures are resampled\nto (default 1024, must be a power of two). Textures are block compressed unless you pass\n`--raw-textures`. To see it in the browser, run `scripts\u002Fbuild-web.sh` and\nopen `http:\u002F\u002Flocalhost:8765\u002F?scene=model`.\n\n**Imported:** node hierarchies, instancing, mirrored transforms, multiple materials, double-sided materials, base colour,\nnormal, metallic-roughness and occlusion maps, material factors and emissive factors.\n\n**Not yet, and the bake prints a warning when a file uses them:** transparency and alpha masks (drawn\nopaque), emissive textures, texture transforms, a\nsecond UV set, punctual lights, animation and skinning (imported in their rest pose). Files that\nrequire compressed texture or geometry extensions, such as Basis or Draco, are rejected.\n\n## Building scenes\n\nA scene file places many models, or individual pieces of a modular kit, in one world:\n\n```text\nterrain 900 1024 0.3 52                       # size, cells, height, X where the shore begins\nwater -0.6 0.015 0.06 0.075                   # height, then colour\ncamera 66 1.5 -41 2.31 0.03                   # x y z yaw pitch\nmodel rocks\u002Frock.gltf 30 0 10 45 1.5          # path x y z yaw_degrees scale\nmodel rocks\u002Frock.gltf 9 ground:0.2 4 45 1.5    # on the terrain, lowest 20% buried\npart fort\u002Ffort.gltf tower_round 22 0 22 0 1   # one named piece, by its own origin\n```\n\n[`scenes\u002Fcove.txt`](scenes\u002Fcove.txt) is a complete example: a fort assembled piece by piece from a\nmodular kit, overlooking a bay with a ship at anchor, using 12 Poly Haven scans (CC0). It holds\n22 million instanced triangles, and renders in about 3.5 ms on an RTX 5080. To build it, adding\n`--texture-size 1024` for the smaller version used in the browser:\n\n```bash\npython scripts\u002Ffetch-scans.py scenes\u002Fcove.txt 2k\n```\n\n```bash\ncargo run --release -p bake -- --scene scenes\u002Fcove.txt --output assets\u002Fcove.solstice\n```\n\n![The assembled fort, seen from the beach](docs\u002Fcove.png)\n\n![Looking through the fort's iron gate into the courtyard](docs\u002Fgate.png)\n\n## Trees, grass and weather as data\n\nTrees, grass and weather are each described by a short text file, so a new tree or a change to\none needs no code. Every setting has a default, so a file names only what differs from it, and a\nmistake is reported with its line number.\n\n```text\n# Abridged from crates\u002Fsolstice-procgen\u002Fspecies\u002Ffir.species\nheight 16\ntrunk radius=0.22 flare=0.45 gnarl=0.015\ncrown cone\nbark fir_bark\nlevel per_metre=8 span=0.1..0.99 angle=102..74 length=0.2 radius=0.4 droop=0.3 whorl=5\nlevel per_metre=10 span=0.05..0.97 angle=62 length=0.4 radius=0.55 droop=0.12\nleaves fir_needles per_metre=22 length=0.16..0.26 width=0.17\n```\n\n```text\n# Abridged from crates\u002Fsolstice-procgen\u002Fgrass\u002Fverge.grass\nsize 2\ntufts per_m2=40 blades=6..16 height=0.12..0.35 width=0.004..0.008 lean=0.15..0.85\nweed kind=rosette per_m2=6 leaves=6..12 length=0.08..0.2 flowers=0.6 flower=0.6,0.42,0.01\nweed kind=clover per_m2=20 length=0.01..0.018 stalk=0.04..0.1 flowers=0.4 flower=0.55,0.42,0.45\n```\n\n```text\n# Abridged from crates\u002Fsolstice-render\u002Fweather\u002Fbroken.weather\ncoverage 0.62\ntype 0.95          # 0 is flat stratus, 1 heaped cumulus\nbase 1000          # metres\nthickness 2600\nwind speed=10 from=240\n```\n\nThe built-in files are oak, birch, fir and bush; meadow, lawn, dry, tall and verge grass; and clear,\nfair, broken, overcast, storm and cirrus weather. To see every tree and breed of grass side by\nside, with any files of your own:\n\n```bash\ncargo run --release -p bake -- --plants --species my.species --grass my.grass --output assets\u002Fplants.solstice\n```\n\n![Oaks and firs at the edge of the wood](docs\u002Fwood.jpg)\n\n## Using the library\n\n```rust\nlet scene = SceneAsset { meshes, materials, instances, lights, texture_size, textures };\nlet mut renderer = Renderer::new(&gpu, &scene, surface_format, RendererSettings::default());\n\n\u002F\u002F Every frame:\nrenderer.render(&gpu, &camera, &environment, &output_view, output_size, delta_seconds);\n\n\u002F\u002F Weather, at any time: one kind, eased into over 30 seconds, or a sky that changes by itself.\nrenderer.set_weather(Weather::by_name(\"broken\").unwrap(), 30.0);\nrenderer.set_weather_changing(true, \"fair\");\n\n\u002F\u002F The time of day: where the sun, moon and stars are, and how they light the scene. `daylight`\n\u002F\u002F is the scene's lighting under a high sun; the time keeps its colour and strength.\nlet mut time = TimeOfDay { day: 172.0, hours: 20.5 };\nlet environment = time.environment(&Place::default(), &daylight);\ntime.advance(delta_seconds \u002F 3600.0);\n```\n\nMeshes come from `solstice_builder::build_virtual_mesh`, which runs offline. See\n[`apps\u002Fbake`](apps\u002Fbake\u002Fsrc\u002Fscene.rs) for a complete example scene.\n\n## How it works\n\n```\ncrates\u002Fsolstice-builder   Mesh -> cluster LOD DAG (offline)\ncrates\u002Fsolstice-import    glTF 2.0 -> scene (offline)\ncrates\u002Fsolstice-procgen   Procedural surfaces, trees, grass and weeds (offline)\ncrates\u002Fsolstice-asset     GPU data layouts and the scene file format\ncrates\u002Fsolstice-render    The renderer\napps\u002Fbake                 Bakes scene files: procedural demo content or imported models\napps\u002Fviewer               Native and browser front ends\n```\n\n[`Renderer::render`](crates\u002Fsolstice-render\u002Fsrc\u002Frenderer.rs) reads top to bottom as the recipe for\na frame. There is deliberately no render graph: every pass is a plain struct with `record`.\n\n### Virtualized geometry\n\n**Offline**, each mesh becomes a DAG of 128-triangle clusters: cluster, group neighbours,\nsimplify each group with its boundary locked, split into new clusters, repeat. Grouping changes\nevery level, so seams locked at one level are simplified away at the next.\n\n**Each frame**, compute shaders walk a per-mesh hierarchy and pick a *cut* through the DAG, so that\nprojected error stays under one pixel. Two-phase occlusion culling tests last frame's depth, draws,\nrebuilds the depth pyramid, then retests what it rejected. Small clusters go to a software\nrasterizer in a compute shader, and the rest to the hardware rasterizer. Both write one visibility\nbuffer, which a final pass resolves to a G-buffer with analytic derivatives.\n\n### Lighting\n\n- **Sky:** physically based atmosphere (Hillaire 2020), with multiple scattering.\n- **Sun:** four cascaded shadow maps drawn through the same culling, plus screen-space contact\n  shadows. A cascade is only redrawn when its view changes, which removes the largest single cost\n  on small GPUs.\n- **Global illumination:** nearby geometry is voxelized into five clipmap levels, with a distance\n  field for fast ray marching and cached radiance on each surface voxel. Those voxels gather\n  light from each other over time, which gives unlimited bounces. Sparse screen probes trace into\n  this volume, first through the depth buffer for contact detail, and each pixel interpolates them.\n- **Screen traces:** probe rays and reflections first march a pyramid of the nearest depth of each\n  screen tile, as Lumen's screen traces do, skipping whole tiles a ray passes in front of. Hits\n  take their colour from last frame's image, found through motion vectors.\n- **Reflections:** one glossy ray per half-resolution pixel: screen space, then the volume, then sky.\n  A ray that runs out of steps among surfaces brings the light of the nearest, not the sky, and\n  one sample may add no more than about the light around it, so a room lit by what bounces in\n  has no sparks of daylight on its polished stone. Roughness is raised where the normals under\n  a pixel disagree, so fine relief doesn't glitter.\n- **Clouds:** volumetric, ray marched through noise in a layer over a curved planet. They cast\n  shadows on the ground, and a small panorama of them feeds the skylight, GI and reflections, so\n  an overcast sky dims and greys the whole scene. See below.\n- **Post:** temporal anti-aliasing and upscaling, histogram exposure, bloom, ACES tone mapping, and\n  contrast-adaptive sharpening on the displayed values, held within each pixel's neighbours so that\n  no edge gets a dark halo. Exposure follows what is on screen down to seven stops below sunlit\n  ground, which keeps night dark, and under a sun that is well up five stops further, so a hall\n  lit only by what bounces in through its doors is seen as the eye would see it.\n\n### Clouds and weather\n\nThe clouds follow the method of Horizon Zero Dawn and Unreal's volumetric clouds. Tiling 3D noise,\nPerlin-Worley for shapes and Worley for detail, is generated on the GPU once. A weather map says\nwhere cloud can form; its values are ranked when it is made, so that a coverage of 0.6 really\ncovers 60% of the sky. Each kind of cloud has a height profile, from a thin sheet of stratus to\nheaped cumulus and storm anvils, and detail noise erodes the edges into wisps below and billows\nabove.\n\nLight comes from a short march towards the sun, a two-lobed phase function, multiple scattering\nin octaves, and a diffusion term for light that has crossed hundreds of metres of cloud, which is\nwhy thick cloud bases are grey rather than black. Skylight is shaded by the cloud above, sunlit\nground lights the bases from below, and distant clouds fade into the haze.\n\nEach frame the weather eases towards its target, the wind carries everything along, and shapes\nslowly boil upwards. The clouds on screen are marched at half resolution and blended with last\nframe's, reprojected; texels behind geometry are skipped. At 1080p in the forest they cost about\n0.3 ms of GPU time.\n\n![The six built-in kinds of weather over the temple: clear, fair, broken, overcast, storm and cirrus](docs\u002Fweather.jpg)\n\n### Time of day, the moon and the stars\n\nThe sun follows the standard formulas for its declination through the year and its hour angle\nthrough the day, at the scene's latitude. The moon is a simpler model, good for the look rather than\nan almanac: it goes through its phases every 29.53 days, is opposite the sun when full, and so rises\nabout 50 minutes later each day. The stars sit on a celestial sphere placed from the sidereal time,\nso that the constellations and the Milky Way stand where they would that night: from 38 degrees\nnorth at midnight in late June, the galactic centre is 23 degrees up in the south, as a test checks.\n\n- **Twilight.** As the sun sets, the sky tables keep the air glowing. The night sky's own faint\n  glow, of airglow and starlight, is always there, lost by day, so twilight fades down to it and can\n  never dip below night. Below 10 degrees the moon takes over the lighting, in near darkness where\n  the change cannot be seen. Exposure stays tied to daylight, so night is dark rather than grey.\n- **Stars.** Three layers, from about 150 bright stars to many thousands of faint ones, with each\n  fainter magnitude about three times as common, as in the real sky. Each is coloured by its\n  temperature through Planck's law, dimmed and reddened by the air near the horizon, and twinkles\n  more the lower it is. They are drawn as spots about a pixel across at any resolution, found from\n  the eight nearest cells of a thin shell, which keeps the whole night sky to about 0.2 ms.\n- **The Milky Way.** Placed by the real galactic coordinates, brightest towards Sagittarius, with\n  star clouds and dust lanes along the Great Rift. It never changes on the celestial sphere, so it is\n  worked out once into a map, and costs one texture read a pixel.\n- **The moon.** It shows the near side's real seas, sized from their true diameters, with Tycho's\n  rays at full moon, and keeps its north towards the celestial pole. It reflects light as dusty\n  regolith does (Lommel-Seeliger), so the full moon is as bright at its edge as at its centre, and\n  earthshine lights its dark side when it is a crescent. By day it is as bright as it truly is and\n  shows pale against the blue; by night it is dimmed, as the eye adapts to it, so its face shows.\n- **The horizon.** Over a long path the air takes the colour of the sky at the horizon, so distant\n  land and sea fade into exactly that colour, and anything seen or reflected beyond the scene below\n  the horizon takes it too: sea and sky meet without a seam.\n\n### Trees and grass\n\nEvery leaf, needle and blade is geometry of its own, never a picture on a transparent card. As\nNanite foliage does, the cluster builder thins small separate pieces with distance and enlarges\nthe ones it keeps, so that a meadow covers as much from far away as close up. Trees are grown from\ntheir species: levels of branches spiral round their parents at the golden angle, or grow in\nwhorls on conifers; the crown's outline sets how long the trunk's branches are at each height.\nBarks are surfaces of the procedural library, with a texel per millimetre; oak bark is matched to\na photoscan by colour statistics and the steepness of its normals.\n\n### Where WebGPU forced a different design from Unreal\n\n| Unreal 5 uses | WebGPU lacks it, so Solstice uses |\n|---|---|\n| Mesh shaders | Compute culling and instanced vertex pulling |\n| 64-bit atomic visibility buffer | Separate 32-bit depth and ID buffers. Two triangles racing on a pixel can leave a one-frame wrong ID, which temporal AA hides |\n| Bindless resources | Shared geometry buffers and texture arrays |\n| Hardware ray tracing | Software tracing against the voxel and distance-field volume |\n| Work queues that grow themselves | One dispatch per hierarchy level, over a shared queue |\n\n## Measurements\n\nThe full scene has 26,945 instances and 8.76 billion instanced triangles, 4.5 million of them unique,\nin a 179 MB scene file baked in about 30 seconds on a desktop CPU. Native, Vulkan, RTX 5080, 1600x900,\nat High quality:\n\n| View | Frame time | Triangles drawn |\n|---|---|---|\n| Exterior | 5.9 ms | 7.0 M |\n| Exterior, camera moving | 6.2 ms | 6.9 M |\n| Inside the chamber | 5.9 ms | 9.9 M |\n\nThe web scene has 1.22 billion instanced triangles and is a 52 MB file. Native on the AMD\nintegrated GPU of the same machine, with the camera moving, since a still camera hides shadow costs:\n\n| Resolution, quality | Frame time, moving | Worst frame |\n|---|---|---|\n| 1600x900, High | 117 ms | 196 ms |\n| 1600x900, Low | 49 ms | 84 ms |\n| 1280x720, Medium | 57 ms | 106 ms |\n| 1280x720, Low | 39 ms (about 26 fps) | 74 ms |\n\nThe slowest frames are when a shadow cascade has to redraw. So integrated graphics runs at\nLow with visible stutter, and is usable rather than smooth.\n\nA scripted 60 second flight around the cove, saving an image each second and reporting every frame's\ntiming (`viewer assets\u002Fcove.solstice --flyover scenes\u002Fcove_flyover.txt --out DIR`):\n\n| GPU, resolution, quality | Average | 95th percentile | Worst frame | Frames over 33 ms |\n|---|---|---|---|---|\n| RTX 5080, 1600x900, High | 3.8 ms | 5.7 ms | 8.5 ms | 0 of 3570 |\n| AMD integrated, 1280x720, Low | 30 ms | 37 ms | 43 ms | 753 of 3570 |\n\nBrowsers tested on Windows, with the RTX 5080: Chromium 152, Edge 156 and Firefox 159, with no GPU\nerrors in any, and frame rates at each display's limit where it could be measured. **Not tested:**\nSafari, phones, Mac and Linux GPUs, and any browser running on integrated graphics. The GI volume\ntakes about 150 MB of GPU memory regardless of quality level, which may rule out the smallest GPUs.\n\n### Streaming\n\nScenes load on demand. A file holds a small manifest, then geometry in 128 KiB pages and textures\nby mip level, so the browser reads what the view needs with HTTP Range requests. For the browser\ncove at 50 Mbit\u002Fs, on an RTX 5080, with [the details here](docs\u002Fstreaming.md):\n\n| | Before | After |\n|---|---|---|\n| Download before the first image | 209 MB | **6.0 MB** |\n| First image | 36.5 s | **1.4 s** |\n| The opening view at full detail | At the first image | About 17 s, 61 MB in all |\n| Scene data on the GPU | 280 MiB | **195 MiB, fixed** |\n| Whole viewer on the GPU, browser | 855 MiB | **668 MiB** |\n\n**No holes.** Culling records which pages each view wants, and the CPU loads them. A cluster keeps\ndrawing until the set simplified into it has arrived. Parents always install before children and\nleave after them, so a partly loaded scene is still a valid cut through the DAG.\n\n**Fixed memory.** Geometry goes in a pool of page slots, evicting the least recently used page that\nnothing depends on. Textures go in three tiers of arrays, since WebGPU has no sparse textures:\nevery layer at 128 and 512, and a few slots at the largest size that fits. Add `?geometry-mb=64` or\n`?texture-mb=32` to the page to try other budgets.\n\n**Natively**, the viewer still loads everything, which keeps frame times comparable. Add `--stream`\nto read from disk as needed, with `--geometry-budget-mb` and `--texture-budget-mb`.\n\nA static host needs no setup. Without Range support, the page downloads the file once and streams\nfrom memory. `scripts\u002Fserve.py` adds Range and a bandwidth limit for local testing, with\n`--throttle-mbps`.\n\n### Texture compression\n\nScene files hold GPU block-compressed textures, at 3 bytes per texel where they used to take 8.\nFor the cove, with 23 texture layers, measured on the RTX 5080 before streaming, when files were\ngzipped and loaded whole. GPU memory is the whole viewer's and most of it is not textures, which is\nwhy it falls by less than the file does:\n\n| Scene | File | Gzipped download | Textures on the GPU | GPU memory, native | GPU memory, browser |\n|---|---|---|---|---|---|\n| Cove at 2048, uncompressed | 1,227 MB | 697 MB | 1,029 MB | 2,532 MiB | |\n| **Cove at 2048, BC** | **584 MB** | **451 MB** | **386 MB** | **1,809 MiB** | |\n| Browser cove at 512, uncompressed | 263 MB | 163 MB | 64 MB | 1,551 MiB | 1,134 MiB |\n| **Browser cove at 1024, BC** | **295 MB** | **209 MB** | **96 MB** | **1,553 MiB** | **1,133 MiB** |\n\nSo the browser cove gets four times the texels for the same GPU memory and a 28% larger download.\nAt 2048, renders differ from the uncompressed version by 43 to 48 dB, and side by side at 3x\nzoom the fort walls show no blocks or lost relief:\n\n![Fort wall at 3x. Top: 512 uncompressed, then 1024 BC. Bottom: 2048 uncompressed, then 2048 BC](docs\u002Ftextures.png)\n\n**Formats.** The old surface layer packed normal XY, roughness and metallic together, and no single\nformat holds that well, so it is now two maps. On the scanned fort wall, at 2048:\n\n| Normals stored as | Mean error | 99th percentile | Roughness |\n|---|---|---|---|\n| BC7, packed with roughness and metallic | 1.81 degrees | 6.4 degrees | 38.8 dB |\n| BC5, on their own (roughness and metallic in a second BC5) | 1.11 degrees | 4.3 degrees | 52.2 dB |\n\nColour and cavity are BC7 with the sRGB format, which measured about 42 dB on the same wall against\n36 dB for BC1 at half the size.\n\n**Encoders.** BC7 comes from [`block_compression`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fblock_compression), a pure\nRust port of Intel's ISPC compressor, at its \"basic\" setting: \"slow\" took three times as long and\ngained under 0.05 dB. BC5 comes from an endpoint search in\n[`texture.rs`](crates\u002Fsolstice-builder\u002Fsrc\u002Ftexture.rs), as that crate's BC5 scored 1 dB lower on normals.\nCompressing the cove takes about a minute on 16 threads.\n\n**Other GPUs.** WebGPU exposes `texture-compression-bc` on desktop GPUs, while phones generally expose\n`texture-compression-etc2` and `texture-compression-astc` instead. The crates that encode ASTC or ETC2\nwell wrap C++, not Rust, so files hold BC only, and a GPU without it gets the textures unpacked while\nloading, at no more than 512 per side. That matches the old uncompressed browser scene in look and GPU\nmemory. Add `?unpack-textures` to the page, or `--unpack-textures` to the viewer, to force that path. It\nhas only been tested that way, on the RTX 5080: no phone has been tried. See\n[testing without BC](docs\u002Ftesting-without-bc.md) for what to check on one.\n\n## Status: what this is and is not\n\nThe goal is Unreal-quality rendering in the browser. The core architecture is real and working.\nThe image is not yet at Unreal's level, and these are the main reasons, roughly in order of impact:\n\n1. **Demo content.** Unreal's best images come from photoscanned assets. The live demo's cove uses\n   scanned models, on procedural sand, while its temple is entirely procedural and looks it. Its\n   forest is procedural too: a meadow and wood of geometric grass, trees and bushes.\n2. **Shadow resolution.** Cascaded shadow maps stand in for Virtual Shadow Maps, so shadows lack\n   the per-pixel sharpness that makes dense geometry read properly.\n3. **Streaming's limits.** Cluster records stay resident at 48 bytes each, about 0.7 GB for a\n   billion unique triangles, where Nanite pages those too. Detail appears with no cross-fade.\n4. **Static scenes only.** Moving objects are not supported: no animation, and the GI volume is\n   only rebuilt when the camera moves. Previous-frame transforms exist in the data but are not fed.\n5. **Surface features.** One material per instance (multi-material models become several instances),\n   no translucency, no subsurface scattering, no volumetric fog, no material graph.\n6. **GI limits.** Voxels mean thin walls can leak light, and the finest voxels are 20 cm, so small\n   details get their indirect shadowing only from screen-space passes.\n7. **Texture memory.** All textures are resampled to one size, so models with many materials use a\n   lot of memory even when compressed, and phones must unpack them, as nothing bakes ASTC yet.\n8. **Far reflections.** Beyond the reach of screen-space tracing, reflections come from voxels, which\n   turn thin objects such as a ship's rigging into solid dark masses on water.\n9. **Alpha.** Masked and transparent surfaces draw solid, so torn sails have no holes.\n10. **Weather's limits.** No rain or snow falls, there is no lightning, and clouds are drawn only\n    where the sky shows, so low cloud never passes in front of a mountain. Under heavy cloud a thin\n    bright fringe can show along ridges against the sky.\n\n## Tests\n\n```bash\ncargo test --release\n```\n\n- The key property of the DAG: every LOD cut is **watertight**, at uniform thresholds and from\n  perspective viewpoints that mix levels.\n- All WGSL is validated without a GPU. Procedural meshes are checked to be closed and outward-facing.\n- The importer is tested against small hand-written glTF files, so that every expected value is\n  known exactly, including the classic bugs: inverted normal maps and inside-out mirrored instances.\n- GPU tests render real frames and check for validation errors, that no pixel is missing inside a\n  closed surface, and that occlusion culling skips hidden geometry. Others check the clouds: that a\n  clear sky is blue and an overcast one grey, that overcast all but removes shadows, and that the\n  wind moves the clouds. Others check the time of day: that twilight only ever grows darker on its\n  way into night, that the moon has no dark halo, and that a moonless night is full of stars. They\n  skip themselves if no GPU is available.\n- The sky's positions are checked against the real sky: sunrise in the east, the sun due south at\n  noon, the moon's phases, the sun at its own place among the stars, and the galactic centre.\n- Shaders are also checked for operator mixes that browsers reject but native compilers accept.\n- Every built-in tree, breed of grass and kind of weather is read and written back unchanged, and\n  each procedural surface is checked for seams, plausible brightness and steepness.\n\nTo check only what a change affects, as CI does for pull requests, run the checks for the\ncrates whose files changed and everything that depends on them. That covers formatting, clippy,\nthe tests (the GPU tests too) and, when the viewer is affected, the browser builds. Uncommitted\nwork counts:\n\n```bash\nscripts\u002Fcheck-changed.sh\n```\n\n`scripts\u002Faffected.py` makes the choice: changing the renderer checks the renderer and the\nviewer, not the gameplay crates. A change outside every crate, such as `Cargo.lock`, CI, a build\nscript or a scene, checks everything, and documentation checks nothing. Every push to `main`\nchecks the whole workspace, whatever the change.\n\n## Contributing\n\nSolstice is written and reviewed entirely by frontier AI models: all code, documentation, pull\nrequests, reviews, issues and comments. People direct the work and decide what is merged, but write and review none\nof it. See the [Code of Conduct](CODE_OF_CONDUCT.md).\n\n## License\n\n[MIT](LICENSE)\n","Solstice 是一个基于 WebGPU 和 Rust 实现的浏览器端实时渲染引擎，复现了 Unreal Engine 5 中 Nanite（虚拟化几何）与 Lumen（动态全局光照）的核心思想。它支持流式加载高细节场景、多跳间接光照、程序化天气与昼夜节律系统（含真实月相、星空与银河），所有计算均在 GPU 上完成。项目采用模块化场景部署架构，支持按需流式传输百万级多边形资产，并具备跨平台原生与 Web 双后端。适用于 Web 端高质量交互式 3D 可视化、数字孪生轻量化展示、教育演示及技术原型验证等对渲染保真度与实时性均有较高要求的场景。",2,"2026-11-24 04:39:26","CREATED_QUERY"]