feat(forest): green thin-instanced conifer field with ×1–×3 random sizes (FLO-482)#125
Merged
Conversation
…zes (FLO-482) The forest tree GLB (forest-tree.glb) is a single material-less mesh, so it rendered white, and the streamed manifest's 12 tree placements all collapsed onto one shared cached root (the loader ref-counts one model per asset id) — so the forest only ever showed a single white tree. Replace that with a greened, thin-instanced conifer field: - forestTreeField.ts — pure, seeded scatter (generateForestTreePlacements): 64 trees in a non-grid sqrt-weighted ring (clearing radius 7 → outer 58), each with a random yaw and a uniform random scale in ×1…×3. Deterministic via a fixed seed (mulberry32 createRng) — no Date.now(), so tests never flake. - forestTrees.ts — loads the GLB once, hard-facets it (v1.2) and paints it a flat matte green (no textures), then thin-instances the prototype across the scatter (one draw call per submesh regardless of count — no perf regression). Fire-and-forget mount mirrors survivorAvatar; forestTreeLoader:null skips it. - Wire mountForestTreeField into createForestScene; remove the collapsing tree placements from FOREST_MANIFEST (asset id stays registered). - Vitest: scatter count/clearing/scale-band/variance + foliage colour/material + mount load/dispose. Docs: forest-zone.md "Conifer field" section. Verified: npm run lint clean, npm test green (53 tests across the 4 touched suites), npm run build ok. In-engine screenshot in docs/verification confirms a dense field of varied-size green conifers (not white, not a grid). Co-Authored-By: Wayland <wayland@agents.flopbut.local> Co-Authored-By: Claude Opus 4.8 <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 & why
Board ask (FLO-468 → FLO-482): «натыкать больше ёлок в лесу, рандом размер ×1–×3; покрасить хвою в зелёный без текстур, а то белые совсем странно».
The forest tree GLB is a single material-less mesh (renders white), and the streamed manifest's 12 tree placements all collapsed onto one shared cached root (the loader ref-counts one model per asset id) — so the forest only ever showed one white tree.
Changes
forestTreeField.ts— pure, seeded scatter (generateForestTreePlacements): 64 conifers in a non-gridsqrt-weighted ring (clearing radius 7 → outer 58), random yaw, uniform random scale ×1…×3. Deterministic (fixed mulberry32 seed, noDate.now()) so tests never flake.forestTrees.ts— loads the GLB once, hard-facets it (v1.2 read) and paints it a flat matte green (no textures), then thin-instances it across the scatter — one draw call per submesh regardless of count, so the higher tree count is no perf regression. Fire-and-forget mount;forestTreeLoader: nullskips it for headless tests.mountForestTreeFieldintocreateForestScene; removed the collapsing tree placements fromFOREST_MANIFEST(asset id stays registered).docs/guide/forest-zone.md"Conifer field" section.Verification
npm run lintclean ·npm testgreen (53 tests across the 4 touched suites) ·npm run buildok.docs/verification/flo482-forest-conifer-field.png): a dense field of varied-size green conifers, not white, not a grid.Co-Authored-By: Wayland wayland@agents.flopbut.local
🤖 Generated with Claude Code