Repository navigation
Editor: a new scene from blank terrain, baked in the browser - #81
Merged
Merged
Conversation
New makes a scene from a template (terrain, land bands and a coastal sea) and bakes it in the browser in about two seconds; with nothing selected, the details panel shows the scene's settings, and a change bakes it again and shows it, keeping the camera and selection. A new scene is kept in the browser as it changes and reopened by ?draft=NAME. Agents do the same through project.new, scene.settings, scene.set, bake.run and bake.status. The scene building moves out of apps/bake into a solstice-bake library, which apps/bake-web builds for the browser and the editor runs in a Web Worker. The land's surfaces, which take minutes to make, are made once by `bake --surfaces` in the site's build and fetched ready-made; the compressor leaves such layers as they are. A scene baked in the browser is byte for byte the one `bake --project` makes of it natively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the review: putting a newly baked scene in place no longer leaves the editor without one if it can't be opened (the last scene comes back); commands wait while a scene is put in place, and the viewport's handlers do nothing then; New waits for a bake in flight and never shows it, refuses to replace a scene kept in the browser or to drop unsaved changes unless told to, and writes the scene it leaves first; a bake that finishes after a change is baked again rather than shown out of date; picks waiting on a replaced viewer are answered; the sea takes only a built-in ocean; a worker whose start failed tries again; scene.set is refused where the browser can't bake the scene; and bake.status no longer says a bake is waiting after it ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Phase 2 of the editor (
docs/editor.md). The user asked that the editor build scenes from blank terrain, not only edit baked ones; this is the first step of that.New scene. New, or
project.newfor agents, makes a scene from a template: an island of sand, dirt and grass in a coastal sea. It is baked in the browser in about 2 s and shown. It is kept in the browser as it changes, andeditor.html?draft=NAMEreopens it after a reload.Scene settings. With nothing selected, the details panel shows the scene's own settings, as Unreal's world settings do:
A change is one undo step. The scene bakes again in the browser and is put in place, keeping the camera and the selection.
Agent commands.
project.new,scene.settings,scene.set,bake.runandbake.status, documented indocs/editor-api.md, including a session that builds an island.One bake, browser or PC.
git mv, out ofapps/bakeinto asolstice-bakelibrary.apps/bake-webbuilds that library for wasm (7.7 MB), and a Web Worker loads it only when the editor first bakes.bake --projectmakes of the same project natively: the same SHA-256 (b988f966…, 13.1 MB), checked by hand. A unit test compares the browser path's encoding with the native one.Ready-made surfaces.
bake --surfaces DIRmakes them once. Each is written as an ordinary scene file holding one compressed layer (4.2 MB each at 1024²), so there is no new format.solstice_bake::textures), so it uses ready-made ones where provided. The compressor leaves already-compressed layers as they are.Build.
build-web.shbuildsbake-weband makes the surfaces intodist/content.scripts/check-changed.shbuild and lintbake-web, and the script now also builds the editor's wasm and runs the editor's Node tests, matching CI.Measured on one thread:
So a new scene uses 2 m cells. Finer terrain waits on a faster cluster builder (about 20k triangles a second on one thread now) or on baking terrain in tiles across workers; both are noted in the design.
Verified
bash scripts/check-changed.sh --allon this PR's head (6960de4) passes. That covers fmt, clippy, 1,001 workspace tests including the GPU tests on the RTX 5080, the four wasm32 builds (viewer, play, editor, bake-web) with clippy, andnode apps/viewer/web/editor/test.mjs(all passed).editor.html?newbakes and shows an island in 2.3 s.scene.setre-bakes in 1.7 s.?draft=untitledbrings the scene back with its changes.project.newrefuses an existing draft's name unless told to replace it.Authorship
Written by: Claude Opus 5.5 through Claude Code
Reviewed by: Claude Sonnet 5.5. No hard blocker. It verified:
encodeis the old compress, page and encode;scene.setacross a swap.Fixed from its points:
project.newcould overwrite a draft, or drop unsaved changes, unasked.scene.setaccepted changes on scenes the browser can't bake (those with models).Noted, not changed:
The ready-made surfaces aren't keyed by a version. After a change to the surface generator or the compressor, a local build reuses old ones until
assets/contentis deleted (the site's build makes them fresh).A bake can't be cancelled. Terrain limits are generous: up to 1024 cells, which takes minutes.
The browser-equals-native check for provided surfaces is by hand (the SHA-256 above); the unit test covers the generated path.
All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.
🤖 Generated with Claude Code