Merge nibu/rtd-cut8-forward-plus into Cut 7+8 integration
This commit is contained in:
commit
fa4e4c9860
21 changed files with 1317 additions and 226 deletions
|
|
@ -10,7 +10,7 @@ using RustToDust.Ymir;
|
|||
namespace RustToDust.Client.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Headless Godot smoke test: instantiates Main, drives 60 frames with throttle + fire + crater stamp,
|
||||
/// Headless & Vulkan Forward+ Godot smoke test: instantiates Main, drives 60 frames with throttle + fire + crater stamp,
|
||||
/// verifies terrain tile baking and Ymir physics integration, and exits with code 0 on pass.
|
||||
/// <c>godot --headless --path client res://tests/Smoke.tscn</c>
|
||||
/// </summary>
|
||||
|
|
@ -278,6 +278,7 @@ public partial class Smoke : Node
|
|||
await VerifySionMapAsync();
|
||||
await VerifyOrbitalDropSequenceAsync();
|
||||
await VerifyCut7bModularOrdnanceAsync();
|
||||
VerifyForwardPlusAtmosphere();
|
||||
}
|
||||
|
||||
private async Task VerifyHudAndShadersAsync(bool isHeadless)
|
||||
|
|
@ -389,7 +390,7 @@ public partial class Smoke : Node
|
|||
return;
|
||||
}
|
||||
|
||||
// GPU verification on OpenGL 3.3: render isolated InventoryGridControl (ambient vs live bilinear heat) & panel_chrome.gdshader
|
||||
// GPU verification on Forward+ Vulkan: render isolated InventoryGridControl (ambient vs live bilinear heat) & panel_chrome.gdshader
|
||||
var gridVp = new SubViewport
|
||||
{
|
||||
Size = new Vector2I(240, 240),
|
||||
|
|
@ -2276,6 +2277,123 @@ public partial class Smoke : Node
|
|||
GD.Print($"SMOKE INFO: Cut 7b verified (16 parts, bucketDelta={bucketDelta}, matDups={VehicleVisualInstance.PerfMaterialDupCount}, audioPlays={_main.Audio.Total3DPlaysRequested - audioShotsBefore})");
|
||||
}
|
||||
|
||||
private void VerifyForwardPlusAtmosphere()
|
||||
{
|
||||
string method = RenderingServer.GetCurrentRenderingMethod();
|
||||
var cmdArgs = System.Environment.GetCommandLineArgs();
|
||||
bool requestedDummy = false;
|
||||
for (int i = 0; i < cmdArgs.Length; i++)
|
||||
{
|
||||
if (cmdArgs[i] == "--rendering-driver=dummy" ||
|
||||
(cmdArgs[i] == "--rendering-driver" && i + 1 < cmdArgs.Length && cmdArgs[i + 1] == "dummy"))
|
||||
{
|
||||
requestedDummy = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool isHeadlessDummy = DisplayServer.GetName() == "headless" && requestedDummy;
|
||||
Check(method == "forward_plus" || (isHeadlessDummy && method == "dummy"),
|
||||
$"Expected RenderingMethod 'forward_plus' (or 'dummy' with --rendering-driver dummy), got '{method}'");
|
||||
|
||||
var sionBaked = AtmosphereLutBaker.GetOrBake(ArenaMapKind.Sion);
|
||||
var desertBaked = AtmosphereLutBaker.GetOrBake(ArenaMapKind.Desert);
|
||||
CheckFinitePositiveLut("Sion.Transmittance", sionBaked.TransmittanceImage, AtmosphereLutBaker.TransmittanceWidth, AtmosphereLutBaker.TransmittanceHeight);
|
||||
CheckFinitePositiveLut("Sion.MultiScattering", sionBaked.MultiScatteringImage, AtmosphereLutBaker.MultiScatteringSize, AtmosphereLutBaker.MultiScatteringSize);
|
||||
CheckFinitePositiveLut("Sion.SkyView", sionBaked.SkyViewImage, AtmosphereLutBaker.SkyViewWidth, AtmosphereLutBaker.SkyViewHeight);
|
||||
CheckFinitePositiveLut("Desert.Transmittance", desertBaked.TransmittanceImage, AtmosphereLutBaker.TransmittanceWidth, AtmosphereLutBaker.TransmittanceHeight);
|
||||
CheckFinitePositiveLut("Desert.MultiScattering", desertBaked.MultiScatteringImage, AtmosphereLutBaker.MultiScatteringSize, AtmosphereLutBaker.MultiScatteringSize);
|
||||
CheckFinitePositiveLut("Desert.SkyView", desertBaked.SkyViewImage, AtmosphereLutBaker.SkyViewWidth, AtmosphereLutBaker.SkyViewHeight);
|
||||
|
||||
Check(sionBaked.ZenithTransmittanceMean > desertBaked.ZenithTransmittanceMean,
|
||||
$"Expected Sion zenith transmittance ({sionBaked.ZenithTransmittanceMean:F4}) > Desert ({desertBaked.ZenithTransmittanceMean:F4})");
|
||||
Check(desertBaked.HazeColor.R > desertBaked.HazeColor.G && desertBaked.HazeColor.G > desertBaked.HazeColor.B,
|
||||
$"Expected warm golden Desert haze chromaticity R > G > B, got ({desertBaked.HazeColor.R:F3}, {desertBaked.HazeColor.G:F3}, {desertBaked.HazeColor.B:F3})");
|
||||
Check(sionBaked.HazeColor.B > sionBaked.HazeColor.R,
|
||||
$"Expected cool alpine Sion haze chromaticity B > R, got ({sionBaked.HazeColor.R:F3}, {sionBaked.HazeColor.G:F3}, {sionBaked.HazeColor.B:F3})");
|
||||
CheckSkyViewHorizonContinuity("Sion", sionBaked.SkyViewImage);
|
||||
CheckSkyViewHorizonContinuity("Desert", desertBaked.SkyViewImage);
|
||||
|
||||
var atmo = _main.Atmosphere;
|
||||
var env = atmo.Environment;
|
||||
Check(env.TonemapMode == Godot.Environment.ToneMapper.Agx, $"Expected ToneMapper.Agx, got {env.TonemapMode}");
|
||||
Check(env.GlowEnabled && env.GlowNormalized, $"Expected GlowEnabled && GlowNormalized, got enabled={env.GlowEnabled} norm={env.GlowNormalized}");
|
||||
Check(env.GlowBlendMode == Godot.Environment.GlowBlendModeEnum.Additive, $"Expected GlowBlendModeEnum.Additive, got {env.GlowBlendMode}");
|
||||
Check(env.SsrEnabled, "Expected SsrEnabled == true");
|
||||
Check(env.SsaoEnabled, "Expected SsaoEnabled == true");
|
||||
Check(env.VolumetricFogEnabled && env.VolumetricFogTemporalReprojectionEnabled,
|
||||
$"Expected VolumetricFogEnabled && TemporalReprojection, got vf={env.VolumetricFogEnabled} tr={env.VolumetricFogTemporalReprojectionEnabled}");
|
||||
Check(env.FogEnabled && env.FogAerialPerspective >= 0.20f,
|
||||
$"Expected FogEnabled && FogAerialPerspective >= 0.20f, got fog={env.FogEnabled} ap={env.FogAerialPerspective:F2}");
|
||||
Check(sionBaked.Preset.DepthFogAerialPerspective > 0.7f,
|
||||
$"Expected Sion DepthFogAerialPerspective > 0.7f, got {sionBaked.Preset.DepthFogAerialPerspective:F2}");
|
||||
|
||||
var sun = atmo.Sun;
|
||||
Check(sun.DirectionalShadowMode == DirectionalLight3D.ShadowMode.Parallel4Splits && sun.DirectionalShadowMaxDistance >= 280f,
|
||||
$"Expected Parallel4Splits & maxDist >= 280m, got {sun.DirectionalShadowMode} maxDist={sun.DirectionalShadowMaxDistance:F1}");
|
||||
|
||||
Check(GetViewport().UseTaa, "Expected GetViewport().UseTaa == true");
|
||||
|
||||
int checkedLights = 0;
|
||||
foreach (Node ch in _main.Arena.Particles.GetChildren())
|
||||
{
|
||||
if (ch is OmniLight3D omni)
|
||||
{
|
||||
checkedLights++;
|
||||
Check(omni.LightVolumetricFogEnergy == 0f,
|
||||
$"Expected {omni.Name}.LightVolumetricFogEnergy == 0f to prevent temporal fog ghosting, got {omni.LightVolumetricFogEnergy}");
|
||||
}
|
||||
}
|
||||
Check(checkedLights == ParticlePool.MaxFlashLights, $"Expected {ParticlePool.MaxFlashLights} ParticlePool OmniLight3D nodes, found {checkedLights}");
|
||||
|
||||
Check(atmo.FilmGrainLayer.Layer == 5 && atmo.FilmGrainLayer.Layer < _main.Hud.Layer,
|
||||
$"Expected FilmGrainLayer.Layer == 5 < Hud.Layer ({_main.Hud.Layer}), got {atmo.FilmGrainLayer.Layer}");
|
||||
|
||||
GD.Print($"SMOKE INFO: Cut 8 Forward+ verified (method={method}, sionZenithT={sionBaked.ZenithTransmittanceMean:F4}, desertZenithT={desertBaked.ZenithTransmittanceMean:F4}, desertHaze=({desertBaked.HazeColor.R:F3},{desertBaked.HazeColor.G:F3},{desertBaked.HazeColor.B:F3}), sionHaze=({sionBaked.HazeColor.R:F3},{sionBaked.HazeColor.G:F3},{sionBaked.HazeColor.B:F3}), grainLayer={atmo.FilmGrainLayer.Layer})");
|
||||
}
|
||||
|
||||
private void CheckFinitePositiveLut(string label, Image img, int expectedW, int expectedH)
|
||||
{
|
||||
Check(img.GetFormat() == Image.Format.Rgbah, $"Expected {label} format Rgbah, got {img.GetFormat()}");
|
||||
Check(img.GetWidth() == expectedW && img.GetHeight() == expectedH,
|
||||
$"Expected {label} size {expectedW}x{expectedH}, got {img.GetWidth()}x{img.GetHeight()}");
|
||||
bool allValid = true;
|
||||
float maxSum = 0f;
|
||||
int w = img.GetWidth();
|
||||
int h = img.GetHeight();
|
||||
for (int y = 0; y < h; y += Math.Max(1, h / 8))
|
||||
{
|
||||
for (int x = 0; x < w; x += Math.Max(1, w / 8))
|
||||
{
|
||||
Color c = img.GetPixel(x, y);
|
||||
if (!float.IsFinite(c.R) || !float.IsFinite(c.G) || !float.IsFinite(c.B) ||
|
||||
c.R < 0f || c.G < 0f || c.B < 0f)
|
||||
{
|
||||
allValid = false;
|
||||
}
|
||||
maxSum = MathF.Max(maxSum, c.R + c.G + c.B);
|
||||
}
|
||||
}
|
||||
Check(allValid && maxSum > 0f, $"Expected finite positive values in {label} LUT (valid={allValid}, maxSum={maxSum:F4})");
|
||||
}
|
||||
|
||||
private void CheckSkyViewHorizonContinuity(string label, Image skyView)
|
||||
{
|
||||
int yBelow = AtmosphereLutBaker.SkyViewHeight / 2 - 1;
|
||||
int yAbove = AtmosphereLutBaker.SkyViewHeight / 2;
|
||||
float worstRelJump = 0f;
|
||||
for (int x = 0; x < skyView.GetWidth(); x += 8)
|
||||
{
|
||||
Color cBelow = skyView.GetPixel(x, yBelow);
|
||||
Color cAbove = skyView.GetPixel(x, yAbove);
|
||||
float lBelow = cBelow.R * 0.2126f + cBelow.G * 0.7152f + cBelow.B * 0.0722f;
|
||||
float lAbove = cAbove.R * 0.2126f + cAbove.G * 0.7152f + cAbove.B * 0.0722f;
|
||||
float rel = MathF.Abs(lAbove - lBelow) / MathF.Max(1e-4f, lAbove);
|
||||
if (rel > worstRelJump) worstRelJump = rel;
|
||||
}
|
||||
Check(worstRelJump <= 0.05f,
|
||||
$"Expected smooth below-horizon SkyView seam <= 5% on {label} (y={yBelow}->y={yAbove}), got {worstRelJump * 100f:F2}%");
|
||||
}
|
||||
|
||||
private static int CountPremulViolations(Image img, float tolerance)
|
||||
{
|
||||
int count = 0;
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
using RustToDust.Core;
|
||||
|
||||
namespace RustToDust.Client.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Live OpenGL 3.3 (gl_compatibility) visual verification probe for:
|
||||
/// Live Forward+ (Vulkan) visual verification probe for:
|
||||
/// - Baked COLOR_0 vertex weathering (AO, edge curvature, per-island hash, rest height)
|
||||
/// - Brokkr 6-layer MechPaint spatial shader (mech_paint.gdshader) + INSTANCE_CUSTOM scorch/heat
|
||||
/// - 4x4 POM MultiMesh decal atlas + decal_pom.gdshader in 1 draw call
|
||||
|
|
@ -207,7 +208,7 @@ public partial class VisualProbe : Node3D
|
|||
cam.GlobalPosition = new Vector3(2.8f, 4.3f, 13.4f);
|
||||
cam.LookAt(new Vector3(0.0f, 4.4f, 0.2f), Vector3.Up);
|
||||
|
||||
// Wait several rendered frames so OpenGL 3.3 compiles all shaders and finishes drawing
|
||||
// Wait several rendered frames so Vulkan Forward+ compiles all shaders and finishes drawing
|
||||
for (int f = 0; f < 6; f++)
|
||||
{
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
|
@ -249,43 +250,11 @@ public partial class VisualProbe : Node3D
|
|||
|
||||
private void SetupEnvironment()
|
||||
{
|
||||
var sun = new DirectionalLight3D
|
||||
{
|
||||
Name = "DesertSun",
|
||||
LightColor = new Color(1.0f, 0.93f, 0.82f),
|
||||
LightEnergy = 1.85f,
|
||||
ShadowEnabled = true,
|
||||
DirectionalShadowMode = DirectionalLight3D.ShadowMode.Parallel2Splits,
|
||||
RotationDegrees = new Vector3(-38f, 36f, 0f)
|
||||
};
|
||||
AddChild(sun);
|
||||
|
||||
// Cool oblique fill light so POM recesses & metal rims catch clear specular highlights
|
||||
var fill = new DirectionalLight3D
|
||||
{
|
||||
Name = "SkyFill",
|
||||
LightColor = new Color(0.68f, 0.80f, 0.98f),
|
||||
LightEnergy = 0.55f,
|
||||
ShadowEnabled = false,
|
||||
RotationDegrees = new Vector3(-25f, -125f, 0f)
|
||||
};
|
||||
AddChild(fill);
|
||||
|
||||
var skyMat = new ProceduralSkyMaterial
|
||||
{
|
||||
SkyTopColor = new Color(0.24f, 0.34f, 0.44f),
|
||||
SkyHorizonColor = new Color(0.76f, 0.56f, 0.37f),
|
||||
GroundBottomColor = new Color(0.28f, 0.20f, 0.14f),
|
||||
GroundHorizonColor = new Color(0.68f, 0.48f, 0.32f)
|
||||
};
|
||||
var env = new Godot.Environment
|
||||
{
|
||||
BackgroundMode = Godot.Environment.BGMode.Sky,
|
||||
Sky = new Sky { SkyMaterial = skyMat },
|
||||
AmbientLightSource = Godot.Environment.AmbientSource.Sky,
|
||||
AmbientLightEnergy = 0.65f
|
||||
};
|
||||
AddChild(new WorldEnvironment { Name = "WorldEnv", Environment = env });
|
||||
GetViewport().UseTaa = true;
|
||||
var atmosphere = new AtmosphereSystem { Name = "AtmosphereSystem" };
|
||||
AddChild(atmosphere);
|
||||
atmosphere.ApplyMap(ArenaMapKind.Desert);
|
||||
atmosphere.Sun.RotationDegrees = new Vector3(-38f, 36f, 0f);
|
||||
}
|
||||
|
||||
private void VerifyBakedVertexColors(string name, ArrayMesh mesh)
|
||||
|
|
|
|||
Loading…
Reference in a new issue