fix(render,sim): preserve MechPaint albedo/COLOR_0, monotonic tracer VFX IDs, dither fade, and GLB COLOR_0 check
This commit is contained in:
parent
2529ba62d2
commit
d81865091d
8 changed files with 201 additions and 56 deletions
|
|
@ -1102,6 +1102,107 @@ public partial class Smoke : Node
|
|||
Check(_main.Hud.ActiveHitArcCount >= 1, "Expected CrosshairOverlay to accept incoming hit arc");
|
||||
}
|
||||
|
||||
// 11. Finding 1: Merged MultiMeshPartPool meshes preserve real non-white material albedos and intact COLOR_0.R AO
|
||||
{
|
||||
foreach (string vid in new[] { "paladin", "jackal" })
|
||||
{
|
||||
var tpl = cache.Vehicles[vid];
|
||||
var meshesToCheck = new List<ArrayMesh> { tpl.SingleSurfaceStaticMesh };
|
||||
for (int i = 0; i < tpl.StaticRigidParts.Count; i++) meshesToCheck.Add(tpl.StaticRigidParts[i].Mesh);
|
||||
for (int i = 0; i < tpl.DetachableRigidParts.Count; i++) meshesToCheck.Add(tpl.DetachableRigidParts[i].Mesh);
|
||||
|
||||
float minAo = 1f;
|
||||
float maxAo = 0f;
|
||||
int whiteNeutralVerts = 0;
|
||||
int darkNeutralVerts = 0;
|
||||
int armorBandVerts = 0;
|
||||
int totalVerts = 0;
|
||||
|
||||
for (int m = 0; m < meshesToCheck.Count; m++)
|
||||
{
|
||||
ArrayMesh am = meshesToCheck[m];
|
||||
for (int s = 0; s < am.GetSurfaceCount(); s++)
|
||||
{
|
||||
var arr = am.SurfaceGetArrays(s);
|
||||
if (arr.Count <= (int)Mesh.ArrayType.Color ||
|
||||
arr[(int)Mesh.ArrayType.Color].VariantType != Variant.Type.PackedColorArray ||
|
||||
arr[(int)Mesh.ArrayType.TexUV].VariantType != Variant.Type.PackedVector2Array ||
|
||||
arr[(int)Mesh.ArrayType.TexUV2].VariantType != Variant.Type.PackedVector2Array)
|
||||
{
|
||||
Check(false, $"Merged MultiMesh '{vid}' missing Color/UV/UV2 arrays");
|
||||
continue;
|
||||
}
|
||||
|
||||
Color[] cols = arr[(int)Mesh.ArrayType.Color].AsColorArray();
|
||||
Vector2[] uv0 = arr[(int)Mesh.ArrayType.TexUV].AsVector2Array();
|
||||
Vector2[] uv1 = arr[(int)Mesh.ArrayType.TexUV2].AsVector2Array();
|
||||
for (int v = 0; v < cols.Length; v++)
|
||||
{
|
||||
totalVerts++;
|
||||
float ao = cols[v].R;
|
||||
if (ao < minAo) minAo = ao;
|
||||
if (ao > maxAo) maxAo = ao;
|
||||
|
||||
int band = (int)MathF.Floor((uv1[v].Y + 0.5f) * 0.5f);
|
||||
float r = uv0[v].X;
|
||||
float g = uv0[v].Y;
|
||||
float b = uv1[v].X;
|
||||
if (band < 3)
|
||||
{
|
||||
if (r > 0.95f && g > 0.95f && b > 0.95f) whiteNeutralVerts++;
|
||||
if (MathF.Max(r, MathF.Max(g, b)) < 0.15f) darkNeutralVerts++;
|
||||
}
|
||||
else if (band == 3)
|
||||
{
|
||||
armorBandVerts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GD.Print($"SMOKE INFO: MechPaint '{vid}' verts={totalVerts} COLOR_0.R=[{minAo:F4}, {maxAo:F4}] whiteNeutral={whiteNeutralVerts} darkNeutral={darkNeutralVerts} armorBand={armorBandVerts}");
|
||||
Check(totalVerts > 0 && minAo >= 0.03f && maxAo > 0.90f,
|
||||
$"Expected '{vid}' COLOR_0.R AO intact (min >= 0.03, max > 0.90), got [{minAo:F4}, {maxAo:F4}]");
|
||||
Check(whiteNeutralVerts == 0,
|
||||
$"Expected zero white-washed band 0..2 vertices on '{vid}', got {whiteNeutralVerts}");
|
||||
Check(darkNeutralVerts > 0 && armorBandVerts > 0,
|
||||
$"Expected both dark non-white rubber/gunmetal ({darkNeutralVerts}) and olive armor ({armorBandVerts}) vertices on '{vid}'");
|
||||
}
|
||||
Check(VehicleVisualInstance.PerfMaterialDupCount == 0,
|
||||
$"Expected zero StandardMaterial3D duplicates, got {VehicleVisualInstance.PerfMaterialDupCount}");
|
||||
}
|
||||
|
||||
// 12. Finding 2: Monotonic TracerEvent.Id spawns muzzle flash + recoilless smoke puffs ONCE regardless of TTL or FPS
|
||||
{
|
||||
var tracers = _main.Session.State.Tracers;
|
||||
tracers.Clear();
|
||||
_main.Arena.Sync(_main.Session, 1.69f, 0f);
|
||||
int vfxBefore = _main.Arena.TransientVfxCount;
|
||||
|
||||
int tracerId = _main.Session.State.AllocateTracerId();
|
||||
Vector3 pPos = new(_main.Session.State.Player.X, _main.Session.State.Player.Y, _main.Session.State.Player.Z);
|
||||
tracers.Add(new TracerEvent(
|
||||
pPos.X, pPos.Y + 1f, pPos.Z,
|
||||
pPos.X + 20f, pPos.Y + 1f, pPos.Z,
|
||||
0xFFEEDDAAu,
|
||||
0.03f, // Low TTL (< old 0.085f threshold) simulating <=30 FPS decay
|
||||
WeaponVisualClass.Explosive,
|
||||
"recoilless",
|
||||
tracerId));
|
||||
|
||||
_main.Arena.Sync(_main.Session, 1.70f, 0f);
|
||||
int vfxAfterFirst = _main.Arena.TransientVfxCount;
|
||||
Check(vfxAfterFirst == vfxBefore + 5 && _main.Arena.LastSpawnedTracerId == tracerId,
|
||||
$"Expected recoilless tracer #{tracerId} with Ttl=0.03 to spawn 1 muzzle + 4 smoke puffs (+5 VFX), got +{vfxAfterFirst - vfxBefore} (lastId={_main.Arena.LastSpawnedTracerId})");
|
||||
|
||||
// Re-sync with dt=0 (simulating >=60/120 FPS seeing the same TracerEvent again): must NOT re-emit
|
||||
_main.Arena.Sync(_main.Session, 1.71f, 0f);
|
||||
_main.Arena.Sync(_main.Session, 1.72f, 0f);
|
||||
Check(_main.Arena.TransientVfxCount == vfxAfterFirst,
|
||||
$"Expected same TracerEvent #{tracerId} across repeated render frames to spawn VFX once, got {vfxAfterFirst} -> {_main.Arena.TransientVfxCount}");
|
||||
tracers.Clear();
|
||||
}
|
||||
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue