[UE 5.9 PVE] FPVMeshBuilder::ApplyDaVinciRule shrinks all plants except PlantNumber 0 due to hardcoded PointIndex == 0

Summary

[ProceduralVegetationEditor] ApplyDaVinciRule collapses trunk radius of all plants except PlantNumber 0 due to hardcoded PointIndex == 0

What Type of Bug are you experiencing?

World Creation Tools

Steps to Reproduce

  1. Enable the Experimental ProceduralVegetationEditor plugin in UE 5.9 and create a new Procedural Vegetation asset.
  2. Build a multi-seed graph: PointScatter → SeedGenerator → Grower → MeshBuilder → Export.
  3. On PointScatter, set NumPoints = 5 and Grid Size = (120, 120, 10) so 5 separate plants/trunks are generated.
  4. On Grower, set GrowthCycles = 25 and IncrementalRadius = 0.008 (so trunks grow noticeably thicker than 1 cm).
  5. On MeshBuilder → BranchRadius, set DaVinciRuleStrength = 0.8 and execute/preview Export.

Expected Result

All 5 plants (PlantNumber 0..4) should apply Da Vinci’s rule using each plant’s own trunk root radius (RootScale), resulting in 5 trunks of consistent, natural thickness.

Observed Result

Only the first plant (PlantNumber 0) retains its thick trunk radius, while all subsequent plants (PlantNumber 1..4) collapse down to ~1 cm radius (plus MinRadius). Setting DaVinciRuleStrength = 0.0 immediately restores equal thickness across all 5 trunks.

Affects Versions

5.9

Platform(s)

Windows

Upload an image

Additional Notes

Exact root cause in engine source:
File: Engine/Plugins/Experimental/ProceduralVegetationEditor/Source/ProceduralVegetation/Private/Implementations/PVMeshBuilder.cpp
Function: FPVMeshBuilder::ApplyDaVinciRule (lines ~2060-2088)

Inside the per-plant loop for (auto& [PlantNumber, PlantBranches] : PlantToBranches):

float RootScale = 1.0f;
for (const int32 BranchIndex : PlantBranches)
{
    for (const int32 PointIndex : BranchPointsAttr[BranchIndex])
    {
        if (PointIndex == 0)
        {
            RootScale = PointScaleAttr[PointIndex];
        }
        ...
        DavinciPscale *= RootScale;
        PointScaleAttr[PointIndex] = FMath::Lerp(PointScaleAttr[PointIndex], DavinciPscale, Bias);
    }
}

PointIndex == 0 is a global point index belonging only to PlantNumber == 0. For every subsequent plant (PlantNumber >= 1), PointIndex == 0 is never matched, so RootScale remains 1.0f (1 cm), shrinking all branches of plants 1..N toward 1 cm when DaVinciRuleStrength > 0.

Suggested fix: initialize RootScale from the first point of the current plant’s trunk (BranchPointsAttr[PlantBranches[0]][0], since PlantBranches is sorted by ascending BranchHierarchyNumberAttr) instead of checking global PointIndex == 0.