From 0118c35b57433c851ed485b1093ef7decf20d10a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 16 Jul 2026 01:54:09 +0100 Subject: [PATCH] Preserve volume witness diagnostics --- .../PlayMode/GenericWorldCaptureTests.cs | 38 ++++++++++++++++++- ReleaseConsumerProject/Packages/manifest.json | 2 +- .../Packages/packages-lock.json | 4 +- .../PlayMode/GenericWorldCaptureTests.cs | 38 ++++++++++++++++++- scripts/run-aetheria-daemon-world-witness.ps1 | 2 +- 5 files changed, 76 insertions(+), 8 deletions(-) diff --git a/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs b/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs index 57d685b..892df97 100644 --- a/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs +++ b/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs @@ -1269,7 +1269,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests floatCopy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0); floatCopy.Apply(); RenderTexture.active = previous; - File.WriteAllBytes(Path.Combine(directory, $"field-{layerKey}.exr"), floatCopy.EncodeToEXR()); + File.WriteAllBytes( + Path.Combine(directory, $"field-{layerKey}.exr"), + floatCopy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat)); UnityEngine.Object.DestroyImmediate(floatCopy); } } @@ -1288,6 +1290,12 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests var historyIndexField = typeof(EveUnityFieldsVolumeRenderer).GetField( "_historyTextureIndex", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + var materialField = typeof(EveUnityFieldsVolumeRenderer).GetField( + "_material", + System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + var metadataField = typeof(EveUnityFieldsVolumeRenderer).GetField( + "_programMetadata", + System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var raymarchTexture = raymarchField?.GetValue(renderer) as RenderTexture; var historyTextures = historyTexturesField?.GetValue(renderer) as RenderTexture[]; var historyIndex = historyIndexField?.GetValue(renderer) is int value ? value : -1; @@ -1299,9 +1307,35 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests : null; WriteFloatTexture(historyTexture, Path.Combine(directory, "field-volume-history.exr")); WriteFloatTexture(historyTexture ?? raymarchTexture, Path.Combine(directory, "field-volume-cloud.exr")); + WriteVolumeMaterialFacts( + materialField?.GetValue(renderer) as Material, + metadataField?.GetValue(renderer) as IReadOnlyDictionary, + Path.Combine(directory, "field-volume-material.txt")); RenderTexture.active = previous; } + private static void WriteVolumeMaterialFacts( + Material material, + IReadOnlyDictionary metadata, + string path) + { + if (material == null || metadata == null) return; + var facts = new List(); + foreach (var binding in metadata.OrderBy(value => value.Key, StringComparer.Ordinal)) + { + if (binding.Key.Contains(".floatPort.", StringComparison.Ordinal)) + facts.Add($"{binding.Key}={binding.Value}:{material.GetFloat(binding.Value):R}"); + else if (binding.Key.Contains(".vectorPort.", StringComparison.Ordinal)) + facts.Add($"{binding.Key}={binding.Value}:{material.GetVector(binding.Value)}"); + else if (binding.Key.Contains(".texturePort.", StringComparison.Ordinal)) + { + var texture = material.HasProperty(binding.Value) ? material.GetTexture(binding.Value) : null; + facts.Add($"{binding.Key}={binding.Value}:{texture?.name ?? ""}:{texture?.width ?? 0}x{texture?.height ?? 0}"); + } + } + File.WriteAllLines(path, facts); + } + private static void WriteFloatTexture(RenderTexture texture, string path) { if (texture == null || string.IsNullOrWhiteSpace(path)) return; @@ -1311,7 +1345,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests copy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0); copy.Apply(); RenderTexture.active = previous; - File.WriteAllBytes(path, copy.EncodeToEXR()); + File.WriteAllBytes(path, copy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat)); UnityEngine.Object.DestroyImmediate(copy); } diff --git a/ReleaseConsumerProject/Packages/manifest.json b/ReleaseConsumerProject/Packages/manifest.json index 74c3590..01675bc 100644 --- a/ReleaseConsumerProject/Packages/manifest.json +++ b/ReleaseConsumerProject/Packages/manifest.json @@ -9,7 +9,7 @@ "org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.13", "org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.2.3", "org.gamecult.eve.surface": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.2", - "org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.48", + "org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.49", "org.gamecult.eve.unity-uitoolkit": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.1" }, "testables": [ diff --git a/ReleaseConsumerProject/Packages/packages-lock.json b/ReleaseConsumerProject/Packages/packages-lock.json index 486fd74..cc2cc9d 100644 --- a/ReleaseConsumerProject/Packages/packages-lock.json +++ b/ReleaseConsumerProject/Packages/packages-lock.json @@ -144,7 +144,7 @@ "hash": "140e1bd963a0033e66777a3b2c5fe6e9c97dfe32" }, "org.gamecult.eve.unity-scene": { - "version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.48", + "version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.49", "depth": 0, "source": "git", "dependencies": { @@ -155,7 +155,7 @@ "com.unity.render-pipelines.universal": "17.4.0", "com.unity.modules.particlesystem": "1.0.0" }, - "hash": "c00ee0e9e33f63a9084b01255523ca21ab9368d2" + "hash": "e6ba1a36f6f0bce8df2c9834c25a8a980f03413c" }, "org.gamecult.eve.unity-uitoolkit": { "version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.1", diff --git a/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs b/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs index 57d685b..892df97 100644 --- a/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs +++ b/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs @@ -1269,7 +1269,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests floatCopy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0); floatCopy.Apply(); RenderTexture.active = previous; - File.WriteAllBytes(Path.Combine(directory, $"field-{layerKey}.exr"), floatCopy.EncodeToEXR()); + File.WriteAllBytes( + Path.Combine(directory, $"field-{layerKey}.exr"), + floatCopy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat)); UnityEngine.Object.DestroyImmediate(floatCopy); } } @@ -1288,6 +1290,12 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests var historyIndexField = typeof(EveUnityFieldsVolumeRenderer).GetField( "_historyTextureIndex", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + var materialField = typeof(EveUnityFieldsVolumeRenderer).GetField( + "_material", + System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + var metadataField = typeof(EveUnityFieldsVolumeRenderer).GetField( + "_programMetadata", + System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var raymarchTexture = raymarchField?.GetValue(renderer) as RenderTexture; var historyTextures = historyTexturesField?.GetValue(renderer) as RenderTexture[]; var historyIndex = historyIndexField?.GetValue(renderer) is int value ? value : -1; @@ -1299,9 +1307,35 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests : null; WriteFloatTexture(historyTexture, Path.Combine(directory, "field-volume-history.exr")); WriteFloatTexture(historyTexture ?? raymarchTexture, Path.Combine(directory, "field-volume-cloud.exr")); + WriteVolumeMaterialFacts( + materialField?.GetValue(renderer) as Material, + metadataField?.GetValue(renderer) as IReadOnlyDictionary, + Path.Combine(directory, "field-volume-material.txt")); RenderTexture.active = previous; } + private static void WriteVolumeMaterialFacts( + Material material, + IReadOnlyDictionary metadata, + string path) + { + if (material == null || metadata == null) return; + var facts = new List(); + foreach (var binding in metadata.OrderBy(value => value.Key, StringComparer.Ordinal)) + { + if (binding.Key.Contains(".floatPort.", StringComparison.Ordinal)) + facts.Add($"{binding.Key}={binding.Value}:{material.GetFloat(binding.Value):R}"); + else if (binding.Key.Contains(".vectorPort.", StringComparison.Ordinal)) + facts.Add($"{binding.Key}={binding.Value}:{material.GetVector(binding.Value)}"); + else if (binding.Key.Contains(".texturePort.", StringComparison.Ordinal)) + { + var texture = material.HasProperty(binding.Value) ? material.GetTexture(binding.Value) : null; + facts.Add($"{binding.Key}={binding.Value}:{texture?.name ?? ""}:{texture?.width ?? 0}x{texture?.height ?? 0}"); + } + } + File.WriteAllLines(path, facts); + } + private static void WriteFloatTexture(RenderTexture texture, string path) { if (texture == null || string.IsNullOrWhiteSpace(path)) return; @@ -1311,7 +1345,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests copy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0); copy.Apply(); RenderTexture.active = previous; - File.WriteAllBytes(path, copy.EncodeToEXR()); + File.WriteAllBytes(path, copy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat)); UnityEngine.Object.DestroyImmediate(copy); } diff --git a/scripts/run-aetheria-daemon-world-witness.ps1 b/scripts/run-aetheria-daemon-world-witness.ps1 index 609b160..20d049a 100644 --- a/scripts/run-aetheria-daemon-world-witness.ps1 +++ b/scripts/run-aetheria-daemon-world-witness.ps1 @@ -13,7 +13,7 @@ param( ) $ErrorActionPreference = "Stop" -$expectedEveUnityCommit = "c00ee0e9e33f63a9084b01255523ca21ab9368d2" +$expectedEveUnityCommit = "e6ba1a36f6f0bce8df2c9834c25a8a980f03413c" $expectedEveFieldsCommit = "c5a4a75c1b727499b16c2dae1895f29e2a9f72f0" $expectedEveUnityUiToolkitCommit = "4d0cbe0185bdc4fc65eb63503a7c5cb578539669" $expectedCultLibCommit = "feb5c71513e71d681699f462fe3682b3168c6f73"