diff --git a/speedtree/REVERSE-ENGINEERING.md b/speedtree/REVERSE-ENGINEERING.md index 9771fc2..7e87655 100644 --- a/speedtree/REVERSE-ENGINEERING.md +++ b/speedtree/REVERSE-ENGINEERING.md @@ -494,6 +494,32 @@ This is additional static recovery, not full original DLL equivalence. Global RN initialization/leaf-group scheduling, alternate source directions and complete leaf/frond geometry/lighting still differ; original LOD reducers remain unfinished. +## 2026-10-12 Frond limbs with terminal foliage: umbrella-thorn truncation fix + +`10002450` determines the last-level leaf path from the branch level count, +independently of frond activation. It calls `10003af0` for terminal leaves while +frond generation applies to the current limb. The replacement incorrectly +excluded terminal leaf generation when fronds were enabled at the last level. +This expanded high-density foliage into complete terminal branch/frond nodes. + +The three identical b3_umbrellathorn_rt_flowers4.spt assets have five branch levels, +fronds starting at level 3, and level-3 child density 800. The replacement now +emits level-3 frond limbs and level-4 leaves/flowers, without terminal tubes/fronds. +Each copy generates 87 branch nodes (1/5/15/66), 18814 terminal cards / 75256 leaf +vertices, and identical geometry/bounds. No node or vertex limit is raised. + +A synthetic regression combines active fronds with 17500 terminal leaf cards: +one frond limb, zero terminal branch nodes, 70000 leaf vertices, no truncation. +The correction also restores previously suppressed terminal cards in other +frond assets. Full 606-resource output now reports zero generation truncation, +462 billboard, 324 frond and 480 authored-leaf models. Twelve formerly reported +frond models had fronds only in the erroneous terminal path; they now have leaf +cards there, matching the recovered last-level dispatch. + +Verification and source/copy evidence are in the sibling client's +build/verification/speedtree-frond-terminal-fix/VALIDATION.md. Original DLL output +parity is still unverified; other remaining differences are unchanged. + ## Remaining differences Independent LOD meshes, main-bone multiple body spheres and the native GPU wind diff --git a/speedtree/src/branch_generator.cpp b/speedtree/src/branch_generator.cpp index 2bab5e8..17cf913 100644 --- a/speedtree/src/branch_generator.cpp +++ b/speedtree/src/branch_generator.cpp @@ -197,8 +197,9 @@ void SpeedTreeModel::BuildAuthoredBranches(float H,const SpeedTreeSptInfo& info) if(tube) m_trunk.grids.push_back({base,rings+1,radial+1,true}); size_t next=node.level+1; if (next=info.fronds.start_level); + // 10002450 selects 10003af0 at the last authored level independently + // of frond activation. Frond limbs can carry terminal leaves/flowers. + bool terminal=next+1==info.branch_levels.size() && !info.leaves.empty(); uint32_t count=node.level==0?8u:4u; if(level.has_child_density) { float density=level.scalar_fields[2]*length/H; diff --git a/speedtree/tests/branch_wind_test.cpp b/speedtree/tests/branch_wind_test.cpp index 666c56f..d25eebf 100644 --- a/speedtree/tests/branch_wind_test.cpp +++ b/speedtree/tests/branch_wind_test.cpp @@ -132,6 +132,17 @@ void leafTests() { "terminal cards limited by node/16-bit budget"); check(full->GetGenerationStats().nodes_by_level[0]==1 && full->GetGenerationStats().nodes_by_level[1]==0, "terminal cards counted as branch nodes"); + // Regression for umbrella-thorn: active fronds do not turn terminal leaves + // into complete branch/frond nodes, even with more cards than the node guard. + dense.u(13000);dense.u(13002);dense.u(0);dense.u(13003);dense.u(0); + dense.u(13004);dense.u(1);dense.u(13007);dense.data.push_back(1);dense.u(13001); + auto flowering=SpeedTreeModel::CreateFromMemory(dense.data.data(),dense.data.size(),"frondFlowers",1000,0); + check(flowering && !flowering->WasGenerationTruncated(),"frond terminal leaves hit branch budget"); + check(flowering->GetTrunkMesh().vertices.empty() && !flowering->GetFrondMeshes().empty() + && flowering->GetFrondMeshes()[0].vertices.size()==10,"frond terminal path emitted extra fronds"); + check(flowering->GetLeafMesh().vertices.size()==70000 + && flowering->GetGenerationStats().terminal_leaf_calls==17500 + && flowering->GetGenerationStats().nodes_by_level[1]==0,"frond lost terminal flowers"); } void lodTests() {