Fix terminal foliage dispatch on frond branches
Generate authored terminal leaves independently of frond activation, matching the recovered last-level dispatch. This prevents three umbrella-thorn copies from expanding leaf cards into full frond nodes and hitting the node budget. Add an active-frond regression with 17500 terminal cards and record verification: all 606 resources generate without truncation, SDK and client targeted tests pass, and corpus ASan/UBSan checks pass.
This commit is contained in:
@@ -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
|
initialization/leaf-group scheduling, alternate source directions and complete
|
||||||
leaf/frond geometry/lighting still differ; original LOD reducers remain unfinished.
|
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
|
## Remaining differences
|
||||||
|
|
||||||
Independent LOD meshes, main-bone multiple body spheres and the native GPU wind
|
Independent LOD meshes, main-bone multiple body spheres and the native GPU wind
|
||||||
|
|||||||
@@ -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});
|
if(tube) m_trunk.grids.push_back({base,rings+1,radial+1,true});
|
||||||
size_t next=node.level+1;
|
size_t next=node.level+1;
|
||||||
if (next<info.branch_levels.size() && next<8 && processed<GenerationStats::max_nodes) {
|
if (next<info.branch_levels.size() && next<8 && processed<GenerationStats::max_nodes) {
|
||||||
bool terminal=next+1==info.branch_levels.size() && !info.leaves.empty()
|
// 10002450 selects 10003af0 at the last authored level independently
|
||||||
&& !(info.fronds.enabled && info.fronds.type<=1 && next>=info.fronds.start_level);
|
// 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;
|
uint32_t count=node.level==0?8u:4u;
|
||||||
if(level.has_child_density) {
|
if(level.has_child_density) {
|
||||||
float density=level.scalar_fields[2]*length/H;
|
float density=level.scalar_fields[2]*length/H;
|
||||||
|
|||||||
@@ -132,6 +132,17 @@ void leafTests() {
|
|||||||
"terminal cards limited by node/16-bit budget");
|
"terminal cards limited by node/16-bit budget");
|
||||||
check(full->GetGenerationStats().nodes_by_level[0]==1 && full->GetGenerationStats().nodes_by_level[1]==0,
|
check(full->GetGenerationStats().nodes_by_level[0]==1 && full->GetGenerationStats().nodes_by_level[1]==0,
|
||||||
"terminal cards counted as branch nodes");
|
"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() {
|
void lodTests() {
|
||||||
|
|||||||
Reference in New Issue
Block a user