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.
36 KiB
AVA2 legacy SpeedTreeRT compatibility
This implementation uses the static analysis of the AVA2 PE32 x86 DLL with
SHA-256 ddba9b9b427d541ebc0bf1221fffc5d56a85d7b8ee0dfe6370a83a133da6967b.
The full analysis is in the sibling client under
ava2-client/build/verification/speedtree-decompile/; no generated pseudocode or
game assets are copied into this SDK. The original DLL and reference files are unchanged.
Implemented corrections
| Source address | Recovered behavior | SDK change |
|---|---|---|
100230a0, 10022f80, 10023060 |
General tree fields: 2001 far LOD, 2002 one byte, 2003 near LOD, 2005 seed, 2006 size, 2007 variance | Correct field widths/semantics; removed byte-by-byte token guessing |
10022950, 10007ae0, 10007ad0, 10007b00 |
Token 1000, counted __IdvSpt_02_ string, nested sections; little-endian 4-byte values and counted strings |
Sequential cursor, signature checks, bounds/count checks and explicit endian conversion |
10006a70, 10023640, 10015a60, 100257e0 |
Branch spline strings, counted branch/leaf records and general wind fields | Traverse metadata without treating payload bytes as tokens |
1001ebb0, 10021840 |
10002 leaf, 10003 billboard, 10004 frond; eight floats per UV quad; counted composite texture name | Correct atlas groups, arbitrary ordering and zero counts; preserve all authored UV corners |
10018380, 10023ec0, 1001ea20, 100085b0, 100243c0, 10024760, 100187e0, 100211f0 |
Lighting, engine LOD, wind level, frond, branch texture control, flare, shadow and user-data field widths | Safely traverse these sections to retain subsequent metadata |
1001f2d0 |
Sphere/cylinder/box position and dimensions | Expose collision objects in original coordinates; no automatic runtime collision integration |
10022fc0, 10023060 |
Near/far clamped LOD response | SpeedTreeSptInfo::EvaluateLod(distance); caller supplies distance, no x86 approximate-sqrt emulation |
1001b8a0, original SpeedTreeWrapper::LoadTree |
Property size applied before Compute | Positive factory size overrides SPT size; zero/default uses authored size |
The factory default size is now zero (use SPT size). A positive argument is an
explicit override. Missing/corrupt SPT input returns null; callers wanting a
placeholder must use CreateProcedural. Failed SDK property registration leaves
the previous registration unchanged. Existing forest instance creation still
has its documented procedural fallback for an unknown CRC.
Texture names are derived from counted fields, including non-ASCII author paths,
instead of guessing CompositeMap prefixes from arbitrary file bytes. The SDK
retains its TGA-to-DDS conversion convention for converted client assets; this is
a resource adaptation policy, not an assertion that the DLL itself performs that conversion.
Raw UV quads are preserved with no implicit V inversion; the legacy rectangle
API now returns their bounds. Generated foliage uses the raw quads when available.
Validation (2026-10-11)
- Debug SDK tests: procedural geometry/forest behavior and SPT format regressions.
- AddressSanitizer + UndefinedBehaviorSanitizer: both SDK tests and all 606 SPT files under the original AVA2 pack_maker passed without reported memory/UB errors.
- Corpus: 606 basic metadata parses succeeded; 323 consumed the complete file.
The other 283 stop at token 21000, report
metadata_complete=falseand preserve only the already parsed metadata. The analyzed DLL's extension dispatcher also does not handle 21000. This is not a claim of full compatibility with that extension. - Regressions cover wrong size/LOD tokens, one-byte fields, every truncated base prefix, corrupt magic, oversized counts, truncated/non-finite UV payloads, zero/reordered atlas groups, more than 64 atlas entries, embedded token bytes inside strings, unsupported extensions, rotated UV quads and explicit size overrides.
- The sibling client's
ava2.speedtree_forestintegration test is built against this external SDK, with a corrected valid synthetic SPT fixture.
Reproduce without committing client resources or build products:
cmake -S speedtree -B build/speedtree-check -DCMAKE_BUILD_TYPE=Debug
cmake --build build/speedtree-check -j 8
ctest --test-dir build/speedtree-check --output-on-failure
build/speedtree-check/spt_format_test '/path/to/AVA2/1. Client DEV/pack_maker'
2026-10-11 Branch generation and wind follow-up
SPT branch levels now retain their nine BezierSpline fields and segment settings.
The generator uses the recovered length (6004), radius (6005), radius profile
(6006), growth (6003) and declination (6007) curves to build connected limb
hierarchies. Tree assets with branch levels no longer select their shape from
filename-based pine/oak rules. Radius/growth vary along each limb; normals use
longitudinal/circumferential tangents including taper and curvature. Geometry is
bounded to four authored levels, 128 limbs, 24 radial segments and 32 length rings.
Grass/shrub fallback and explicit procedural models retain their simpler geometry.
The random stream follows the Park-Miller multiplier/modulus (10027a50), the
128-entry shuffle (10027f50, 10027bb0) and DLL scaling constant at
0x1015c510 (2^-31); 0x1015c514 confirms a shuffle index multiplier of 128.
Each model owns its stream, so geometry does not depend on global RNG state or
model creation order. Authored seed affects orientation and size variance;
positive property size uses the supplied property variance, now forwarded by
both SDK and AVA2 forest adapters. Seed zero maps deterministically to one here;
the original time-dependent seed-zero behavior is not reproduced.
Spline parsing follows 10025f00 / 10026520: min/max/variance plus nodes with
position, normalized tangent and handle length. Signed variance is preserved
(three real SPTs have negative spline variance). Evaluation now reproduces the recovered 500-entry parameter sampling and
x-resampling table, followed by the original 499-scaled lookup. Bitwise equality
with x87 execution has not been verified. Branch attachment locations, counts,
orientation frames, leaf placement and generation call order remain SDK policies.
Wind now uses the recovered indexed, weighted affine transform from 10011e10:
p' = p + w * (M * p - p). Optional column-major local-space matrices are supplied
through WindParameters::matrices; absent matrices use synthesized rotations.
The fallback is still approximate; forest instances now supply the original
AVA2 source-level four-matrix controller described below.
Leaf cards rock around their pivot using one shared phase/weight per card,
strength zero is neutral, and inverse-transpose normals follow deformation.
World wind direction is converted into the instance's local frame before
deformation, rather than rotating the wind along with the instance yaw.
The reference GLSL uses the same weighted transform, generated-wind frequencies,
gust settings, leaf pivot and normal rules. Its interface now includes vertex
attribute location 6 (wind_matrix_index) and a std140 WindBlock at binding 3:
four column-major mat4 values plus vec4 settings (matrixCount, gustFrequency, gustStrength, 0) and a second vec4 (legacyLeafEnabled, leafPhase, rockingRange, rockingFrequency). Set legacyLeafEnabled to zero for procedural rocking; a zero
rockingRange disables legacy rocking. Default settings are (0, 0.8, 0.5, 0); custom matrices support
up to four groups in this reference shader. Diffuse sampler binding is now 4,
avoiding a descriptor conflict with the vertex FrameBlock at binding 0. Uploaders
must use the new vertex stride/offset and block layout. CPU supports additional
matrix groups; CPU/GLSL correspondence assumes the same supplied groups and a
yaw plus uniform positive instance scale. AVA2 currently uses CPU-transformed
draw data and does not upload this optional GLSL interface.
Validation: branch/wind regressions cover spline endpoints/midpoint, signed variance, invalid curve counts, repeated/different seeds, filename-independent authored shape, radius curves, property size/variance, zero wind, weighted affine positions, inverse-transpose normals, anchor weights, world wind under yaw, coherent leaf cards, and world transform order. All 606 original SPTs generate finite, bounded, indexed geometry and finite wind positions under ASan/UBSan. Both reference shader stages compile to SPIR-V with glslc. This is static shader validation; GPU execution and Windows DLL output comparison have not been done.
2026-10-11 Original runtime primitives and forest integration
10026aa0,10026870,10025e00: cached 500-entry Bezier parameter sampling, x-resampling at i/500, exact last-node endpoint, and 499-scaled runtime queries using DLL constant 0x1015c4b8. A linear curve queried at 0.5 returns approximately 0.499, preserving the original sampling convention instead of direct inversion.SpeedTreeLib/SpeedTreeForest.cpp::SetupWindMatrices: four frequency pairs, 35-degree strength-dependent throw, strength*20 frequencies, compound X/Y rotations and phase rescaling when strength changes. Static/global phase state is replaced by per-controller state. Matrices are converted from source Z-up to SDK Y-up by an explicit basis permutation.10025480,100254d0,10025510: legacy leaf rocking range/frequency metadata and strength-change phase offset. SDK and AVA2 forest updates pass the matrices and phase into CPU deformation; GLSL exposes the same legacy waveform settings. Leaf per-group phase still comes from generated cards, not the unrecovered original orientation/rocking group table.1001d630,100207a0: discrete LOD bucket selection, boundary clamping and two alpha-test thresholds during overlap/exponent transitions. These helpers are exposed through SelectDiscreteLod and SelectLodTransition. They do not create original per-LOD geometry. The later billboard milestone below connects them to the client.- Parsed branch scalar/flag fields and LOD configuration are retained for future topology/LOD recovery rather than discarded.
Active client build and five targeted tests pass; four SDK tests and all 606 SPT metadata/generation/deformation checks pass under ASan/UBSan. Both GLSL stages compile to SPIR-V. Source matrices, phase continuity, zero-strength identity, controller isolation, sampled-curve quirks and LOD alpha thresholds have dedicated regressions. Evidence is under the sibling client's build/verification/speedtree-original-runtime/.
The user selected static recovery because no Windows execution environment is available. No original DLL execution, visual comparison or full-equivalence claim is made. This does not mark the entire original SpeedTree implementation complete; the remaining items below are actual missing behavior.
2026-10-11 Billboard generation and client distance switching
1001ebb0,10021840: retain horizontal (10006/20003) and 360-degree (10007/20004) flags, including supplemental overrides. Token20005is preserved as eight raw floats without guessing its purpose.10020390: SelectBillboardViews reproduces the half-step angle remapping, reversed atlas indices, cyclic endpoint wrap and composition of view-angle and distance alpha-test thresholds. Invalid/missing atlas entries are bounded; fully rejected draws are omitted. Threshold base remains the AVA2 value 84.100212c0,10020560: BuildBillboardMeshes supplies vertical camera-facing quads and optional horizontal quads at the bounds' midpoint, using the last atlas quad for horizontal UVs and preserving all four original UV pairs. Bounds are cached from our generated geometry. Vertical width uses the greater horizontal extent and the quad is centered on those bounds; these are SDK adaptations until original geometry/dimension computation is recovered.- AVA2 passes its camera into model draw construction, converts it through inverse instance yaw/scale, and selects the final leaf-to-billboard transition. Near trees retain generated geometry; far trees submit billboard quads. If LOD distances or billboard UVs are missing, generated geometry remains available. Branches and leaves currently share the final silhouette transition, with branch alpha testing enabled while fading. Original per-component LOD meshes and branch disappearance scheduling remain outstanding.
- Billboard vertices carry zero wind weights and are not leaf-rocking cards. Their geometry remains stable as time/strength changes.
Validation: active client application builds and all five targeted tests pass. Four SDK tests pass under ASan/UBSan. The 606-file corpus generates/deforms successfully under the sanitizers; 462 files produce valid billboard meshes. Regressions cover flags/overrides, raw supplemental UVs, horizontal planarity, atlas corners, angle wrap, threshold composition, near/transition/far draw selection, instance yaw/scale and wind-independent billboard positions. No DLL execution or rendered image comparison was performed.
2026-10-11 Frond geometry and extension 21000 payload
Recovered frond metadata from 100085b0, cross-checked with serializer
10008ac0 and constructor 100082c0: start branch level (13002), blade/profile
mode (13003), blade count (13004), profile spline (13005), profile sample count
(13006), enabled flag (13007), texture list (13008), LOD fields (13009..13013),
segment override (14007) and reduction mode (14008). Each texture retains its
filename, aspect ratio (14003), size scale (14004) and angle range (14005/14006).
LOD/reduction configuration is retained but does not yet generate reduced meshes.
10002450 switches enabled branches at/after the authored frond level away from
branch tubes. The SDK now applies that same level switch to its approximate
hierarchy, generates fronds along the branch centerlines, and avoids duplicate
leaf cards on terminal frond limbs. Authored fronds override the old filename
heuristic that previously rendered grass/bush-named SPTs as generic planes.
10009040: texture half-width uses centerline length * 0.5 * aspect * size scale; angle sampling retains the authored interval and alternates sign.10009740: blade mode emits multiple paired-vertex strips around the limb, with length-normalized V coordinates.1000b6d0,1000a820: profile mode emits 2*profile_samples-1 symmetric cross-section vertices, with the spline offset relative to its center value.- Atlas UVs use all four corners through bilinear interpolation; individual textures are used when no composite atlas is supplied. Fronds receive branch wind matrix weights, zero leaf-rocking weights, alpha testing and double-sided client draws. Radius and cached billboard bounds include frond vertices.
Limits/adaptations: the underlying limb scheduling and frames remain approximate; texture choice uses deterministic SDK scheduling rather than original random call order; blade/profile counts are capped for bounded work; the original blade-edge averaging, profile-frame smoothing, normal/tangent construction and per-level frond reduction have not been reproduced exactly. Generation has a 65535-vertex budget per material. Default missing profile data produces a flat profile instead of reconstructing the DLL constructor's default curve.
Corpus investigation: every one of the 283 extension-21000 occurrences contains 21000 + float followed by 21001 + float, followed by unsupported token 22000. The reader now preserves the pair in extension_21000 with has_extension_21000. Their meaning is unresolved, and no matching parser handler was found in the current DLL decompilation. This is an observed corpus grammar, not a recovered DLL algorithm. No guessed rendering effect is applied. The subsequent extension remains explicitly unsupported; completeness stays 323/606, with zero rejected files. Truncated/non-finite/missing-marker payloads are rejected.
Verified: ava2_client builds; five targeted active tests pass; four SDK tests and 606-file metadata/generation/deformation checks pass under ASan/UBSan. All 337 SPTs with enabled fronds produce frond geometry, and 462 produce billboard meshes. Tests cover both frond modes, dimensions, disabled state, source filename heuristics, zero wind, vertex/index limits, finite deformation and client draws. Evidence is in ../ava2-client/build/verification/speedtree-fronds/.
2026-10-12 Authored leaf cards and static map collision
Leaf parsing now retains each definition's flag, color, scalar, filename, pivot (4004), placement vector (4005) and dimensions (4006), rather than discarding its vectors. Defaults and storage offsets were checked in 10015a60/10014930. The obsolete 4007 scalar remains intentionally ignored as in the DLL reader.
10014b60 generates four corners from the authored width/height and pivot. Even variants use 1-pivot.x; odd variants use pivot.x. BuildLeafCorners preserves this asymmetric mirrored-pivot rule. Authored branch leaf clusters now emit a single card with these offsets, scaled by generated_height/authored_size, instead of two generic centered planes. Original curve-driven placement and exact variant selection are still not reconstructed.
OrientLeafOffset implements the recovered composition Rz(azimuth) * Ry(pitch) * Rx(rocking), explicitly converting source Z-up and SDK Y-up. CPU evaluation and AVA2 draw construction pass camera coordinates through inverse instance yaw; rotation and rocking preserve each card's pivot. Conservative pivot-sphere bounds prevent camera rotation from escaping the cached static-card bounds.
10015900 initializes group phases in [0,10000]; 10014b60 multiplies each phase by variant+1 before 10025510 evaluates the native leaf waveform. The SDK now uses three deterministic default groups with that multiplier and the native waveform. It does not reproduce the original global RNG call sequence or arbitrary group count setters. Camera facing uses the tree-to-eye direction in AVA2, whereas the original runtime uses its global camera view direction. Nonzero orientation perturbations, LOD card growth and original per-leaf normal/AO computation remain unrecovered. New authored card fields are CPU metadata; the reference GLSL has not been extended to execute this authored-card path.
AVA2 static map collision now follows the source-level SpeedTreeWrapper::OnUpdateCollisionData policy: sphere/cylinder shapes participate, CO_BOX is skipped. AreaData-loaded tree instances register collision-only proxies in MapObjectManager's spatial index; building draw lists and object counts are unchanged. Shape centers swap source Y/Z and use the rendered instance yaw; positions/dimensions use generated_height/authored_size and instance scale. This scale adaptation has not been compared to the DLL's computed collider output.
Queries optionally receive actor sphere-center height. Sphere checks include the vertical distance; cylinder checks use the original CollisionData.cpp vertical interval rejection and axis-segment distance. Old callers without height retain 2D projected queries. Actor movement/target completion now supply terrain height (or current actor Y) plus the 30-unit collision radius. This is a single ground sphere approximation, not the original bone-attached multiple dynamic spheres, continuous swept collision or full movement adjustment algorithm. Horizontal normals enable the existing sliding path. Weak lifetime tokens invalidate proxies on instance deletion/forest clearing/destruction; map clearing removes them. Programmatic tree creation or later instance pose edits outside AreaData loading are not automatically registered/synchronized with these static proxies.
Verified: active application builds; six targeted SDK/client/render tests pass. Four SDK tests plus 606 generated/deformed corpus models pass under ASan/UBSan: 357 use authored leaf cards, 337 have fronds, 462 have billboards. The corpus now also checks native wind matrices, camera orientation, translated/yawed/scaled instances and finite normals. Client SpeedTree/collision tests pass under the sanitizers. Sanitized render_3d initially skipped in the isolated empty run dir; it was then run directly with the existing populated active run dir and passed. Tests cover pivot/mirroring, rotation order, zero wind, coherent group phase, property resizing, camera transforms, sphere/cylinder footprints and heights, box omission, movement blocking/height clearance, spatial queries and lifetime invalidation. No DLL execution or visual parity comparison was performed.
2026-10-12 Independent LOD, branch sampling, multiple spheres and GPU wind
Independent branch, leaf and frond LOD mesh streams are now built once per model. Grid topology records allow fewer longitudinal/radial samples while preserving endpoints and closed branch seams. Leaves use nested, seeded card subsets and pivot-relative growth 1+level*growth (9009 / 1001e840, 10020960, 10014b60). AVA2 chooses branch/frond detail independently, renders the two selected leaf levels with their recovered alpha thresholds, and includes the billboard as the last leaf level only when its atlas exists. Bounds include all LODs/card rotations; a transformed bounds test follows sphere culling to avoid oversized spheres keeping wholly behind-camera trees. Level count and growth are bounded to eight. The topology decimator/card subset ranking are SDK choices, not the DLL's original importance/clustering reducers; independent meshes do not imply original LOD parity.
Re-exported the original DLL into /tmp/ava2-speedtree-static (1219 functions). 10002450 and disassembly 100036d2..100036e3 confirm child count truncation from 6012 * branch_length / tree_size. Fields 6010/6011 are the attachment interval. Nonterminal children reseed with parent_seed+3 per child; the first interval is 85..95% of the full interval. SampleBranchAttachment restores this rule; terminal sampling uses the running stream and full interval. Nonterminal azimuth sampling accounts for the parent percentage draw and child length-variance draw before the [-180,180] draw. Generation now traverses depth-first and interpolates attachment positions between centerline samples instead of snapping to a ring. These rules are corroborated by static control flow and independent integer/shuffle reference values. The complete original angular frame, leaf distribution and global RNG call sequence are still missing; full precise distribution has NOT been achieved.
Work remains bounded to 256 nodes and 65535 vertices per generated material, with radial/profile/level caps. WasGenerationTruncated exposes node/vertex/density budget truncation. Earlier fixed scheduling invented branches even when authored density implied none; current corpus mesh counts therefore differ from the earlier milestones. Truncation reporting is diagnostic, not a claim of original completeness.
RaceData now reads all collision attachments/spheres from MSM (source GameType.cpp LoadAttachingData/LoadCollisionData). BODY=1 spheres drive movement; DEFENDING and ATTACKING data remain available but do not block movement. Unattached source positions use the actor world transform; attached main-model spheres use the live bone world transform at the actor animation time. Radius stays authored as in the source. All body spheres are tested for movement/target completion and sliding, with a legacy ground-sphere fallback when usable body data is absent. Tests cover multiple spheres where only the later sphere blocks, and a real right-hand bone attachment. Other model indices, mounted-horse sharing, original swept/last-position collision and original collision movement adjustments remain outstanding.
The actual AVA2 HardwareScene Metal and embedded SPIR-V scene shaders now perform native four-matrix foliage deformation, inverse-transpose normals, generic leaf rocking and authored leaf camera/rocking rotation. Raw model/LOD streams are cached and shared across instances; per-frame matrices/phase/view parameters are uploaded as uniforms/instance data. The forest enables this path for native four-matrix frames. Software rendering materializes the SDK CPU result through an owned-model fallback callback. Billboard quads remain undeformed. Header layout is 576 bytes; vertex layout includes pivot XYZ/native phase at attribute 6. The earlier standalone foliage_shaders.h remains a reference and is not the active scene pipeline.
Validation: application build and seven targeted tests pass, including real Metal execution. Pixel masks from GPU matrix-only, generic-rocking and authored-camera paths, using compound controller rotations plus translation, are compared to SDK CPU positions/normals (edge tolerance <32 pixels on 64x64 targets and <=2 red-channel levels for shared lit pixels). GLSL compiles to embedded SPIR-V; Vulkan execution has not been tested. Four SDK tests and all 606 corpus models/all generated LODs pass ASan/UBSan finite/index/ wind/camera checks. Client multi-sphere/bone/fallback tests and populated render_3d asset tests also pass under the sanitizers. Corpus now has 462 billboard models, 282 frond models and 248 models with authored leaf cards; 347 report generation budget truncation. No original DLL execution or original output comparison exists.
2026-10-12 Generation baseline, branch-entry scheduling and terminal leaves
The first three planned work areas now have a reproducible baseline and another static-recovery implementation milestone. This does not complete original branch/frame generation or establish binary equivalence.
tools/generation_baseline.cppsorts input paths and writes JSONL with source seed, authored level count, generated nodes per level, terminal leaf calls, bounds, allocation-limit reasons and per-LOD vertices/triangles/grid/hash data. Hashes use explicit float/index fields, never struct padding. The baseline captured before these changes contains 213 files under pack_maker/Tree.tools/generation_samples.jsonpins representative source paths, SHA-256s and seeds; synthetic fixtures exercise repeated/different seeds and large budgets.tools/compare_generation_baselines.pycompares inventories and reports topology/bounds changes and resolved/new truncation.10002450entry draws are now length(6004), azimuth, angle(6007), gravity(6001), radius(6005), flexibility(6002), preserving variance draws even for zero variance. Missing sampled curves consume no draw. Nonterminal attachment sampling and the parent wind-profile draw use the reseeded shared stream; child entry reseeds again and discards one [0,100] draw. Child curve position is normalized within the authored attachment interval, rather than using the absolute parent attachment position. Tests use an independent integer/shuffle oracle to check each entry result and the trailing stream.10026460is a distinct perturbation sampler: nearest cached indexint(position*499+0.5), amplitudesample*variance, no min/max mapping. Its two draws per frame are scheduled separately from normal curve evaluations. Token 6003 is a wind profile, not a growth spline; the approximate gravity centerline now uses token 6017. Original incremental frame/gravity integration still needs recovery, and sampled perturbations are not yet applied to frames.- Longitudinal rings now use the authored 6009 count, matching the original
allocation of count+1 centerline records, instead of doubling/clamping to 32.
Unsupported fixed child-length shortening and 0.65 radius shrinking were
removed. The base-profile radius condition now uses the interpolated parent
attachment radius and DLL float constant
1004c1a4 = 0.85. 10003af0gets a distinct terminal path when authored leaves are present and the last level is not being emitted as a frond. It samples length/longitudinal segments, then azimuth, and uses the recovered 60-degree tilt (double constant1004c1c8 = 1.0471975389728654). It emits one card, not a complete terminal tube followed by three cards. The inherited frame remains approximate.10004380/10004540ordinary leaf variants include mirrored pairs, selected using integer [0,1000000] sampling modulo the pool. Rocking group uses integer [0,10000] modulo the three default groups. One shared [-scalar,scalar] color perturbation is applied to authored RGB. Special flagged-leaf selection via100044c0, placement/orientation/lighting details and arbitrary rocking group counts remain incomplete; flagged variants are not substituted into the ordinary pool.- The SDK vertex indices, CPU render commands and SDL GPU index uploads are all uint32. Consequently the old per-material 65535-vertex limit was unnecessary and has been removed for branches/fronds. Mesh splitting is not required by these active consumers. The per-model guards are now 16384 branch nodes and 2000000 base-geometry vertices, with terminal cards charged to vertices rather than branch nodes. Radial/length safety limits are 256/1024. These are SDK allocation guards, not recovered original limits; every triggered guard is exposed through GetGenerationStats/WasGenerationTruncated. Larger trees can consume more CPU/GPU memory than the earlier truncated approximation.
- Zero-length fronds without children can produce empty geometry; public bounds now remain finite zero bounds in this case instead of infinities.
Validation: SDK four tests and active client seven targeted tests pass, and the active ava2_client builds. SDK ASan/UBSan four tests and all 606 original resources across all LODs pass finite/index/native-wind/camera checks. Two complete JSONL snapshot runs are byte-identical, including finite bounds. Synthetic regressions cover 98035 trunk vertices, 70000 leaf vertices, terminal hierarchy accounting, entry/perturbation draw semantics and explicit oversized-input guard reporting. The fixed 213-file comparison reduces truncation from 132 to 1. Full 606-file corpus truncation falls from the previous milestone's 347 to 3; the remaining three are identical copies of b3_umbrellathorn_rt_flowers4.spt (SHA-256 44ec99e53b3158a6619ec7a5cb4110bfb67ff9943224b068a8bc99fa1d92c0d0), still hitting 16384 nodes. This umbrella-thorn sample was not flagged in the old 213-file baseline; the new scheduling reaches the guard and comparison.json explicitly reports it as new_truncation. Its original full shape/size remains unresolved. Current output has 462 billboard, 336 frond and 263 authored-leaf models. Counts/hashes are replacement baselines, not original DLL oracle outputs. Evidence: sibling client's build/verification/speedtree-generation-baseline/.
2026-10-12 Inherited branch frames, special leaf gating and axial spacing
10002450/10005960: frames now retain a full source Z-up row-vector basis. Local azimuth and compound roll/pitch rotations multiply the inherited parent basis. Child branches and terminal leaves inherit the frame of the actual attachment segment, rather than rebuilding a frame from only its direction. The first two10026460perturbation arguments are both zero (assembly at 10002828/10002854); subsequent arguments are the axial segment percentage. Perturbations now rotate actual frames and geometry instead of being discarded.- Default source Z-up gravity follows the recovered angular influence:
-2*(profile-0.5)*(1-abs(pi/2-inclination)/(pi/2))*inclination*gravity, rotating aboutup x forward. Vertical directions receive no gravity rotation, avoiding a zero-axis singularity. Positions advance along the preceding frame direction by the change in axial distance; no artificial fixed lateral bend remains. Nondefault original gravity/global direction configuration is still unsupported. 10024760retains token 16002 as the branch object's +0x24 exponent (default 1 in100061b0). Assembly 10002fbb..10002fcb applies pow(ring/segments, exponent). Axial queries, profiles and perturbations now use that percentage.10005110attachment searches use cumulative physical distance and interpolate the enclosing segment, not uniform ring indices. Four corpus files have exponent zero; this is valid and intentionally follows the original pow behavior. Negative or >32 exponents still invoke an explicit SDK tessellation guard. Remaining flare parameters and bark texture controls are not restored.- Frond lateral/profile directions now follow each centerline frame, rather than one constant branch basis. Original edge averaging/profile smoothing remains separate unfinished work.
10015a60and constructor10015800: preserve special-leaf threshold token 3000 (default 0.75), ancestor depth 3001 (default 1), probability 3002 (default 0.8).100044c0tests the leaf position at depth zero, otherwise the selected ancestor's branch attachment position, stopping at the root. Strict threshold equality fails and consumes no RNG; probability equality succeeds.10004380/10004540: flagged leaves now have a separate mirrored variant pool. Its gate consumes a probability draw only above threshold; accepted special variants use integer [0,100000] modulo the pool, ordinary variants use [0,1000000]. A failed gate falls back to ordinary variants; an empty ordinary pool emits no card. Generation stats/baselines expose special_leaf_cards. Existing default three rocking groups/color perturbation remain, but leaf normal construction, placement/orientation details and matrix group assignment still require recovery.
Regression coverage includes known source rotations, inherited frames, gravity sign/vertical singularity, 1024-step basis orthogonality, actual deterministic perturbation geometry, nonuniform/zero axial spacing and attachment distances, special threshold equality/no-draw semantics, probability draw count, ancestor traversal, forced special/ordinary variants and authored material colors. SDK four tests, client seven targeted tests and active application build pass. ASan/UBSan four SDK tests and the complete 606-resource/all-LOD/native-wind/camera corpus pass. Two snapshots are byte-identical, with 19 resources producing 68945 special leaf cards. There is no new truncation; the same three umbrella-thorn copies remain guarded. Evidence is in the sibling client's build/verification/speedtree-frames-special-leaves/VALIDATION.md. This is additional static recovery, not full original DLL equivalence. Global RNG 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 path are operational. Default inherited frame/perturbation/gravity rotations and special-leaf gating are recovered. Remaining original branch/leaf distribution, global random initialization/group scheduling, nondefault direction configuration, exact LOD importance/clustering reducers, frond smoothing and billboard dimensions/component schedules remain incomplete. Generation budgets can truncate assets and are explicitly reported. Multiple-sphere collision still needs original swept response, additional model indices and horse integration. Programmatically spawned/moved tree collision synchronization is incomplete. Newer SPT 21000 values have unresolved semantics; 22000 and later blocks are unsupported. Vulkan/D3D runtime and original Windows DLL parity remain unverified.