From 37d9f993e189dc6a0f3c01cdbabf5c7241ea0b1c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 15 Jul 2026 17:31:02 +0100 Subject: [PATCH] Reconcile volumetric fields after surface arrival --- .../PlayMode/GenericWorldCaptureTests.cs | 21 +++++++++++++++++++ .../PlayMode/GenericWorldCaptureTests.cs | 21 +++++++++++++++++++ .../Fields/EveUnityFieldsVolumeRenderer.cs | 4 ++++ .../org.gamecult.eve.unity-scene/package.json | 2 +- 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs b/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs index 27875c4..ed3531c 100644 --- a/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs +++ b/ReleaseConsumerProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs @@ -8,6 +8,7 @@ using GameCult.Caching.MessagePack; using GameCult.Eve.Surface; using GameCult.Eve.UnityUIToolkit; using GameCult.Eve.UnityScene; +using GameCult.Eve.UnityScene.Fields; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; @@ -666,6 +667,14 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests Assert.That(beamRenderer.TryGetPower(beamPresentation.Id, out tractorReleasedPower), Is.True); Assert.That(tractorReleasedPower, Is.Zero, "Released held input did not return the daemon-authored tractor presentation to zero."); + var fieldVolume = root.GetComponent(); + Assert.That(fieldVolume, Is.Not.Null, "The generic client did not install its Fields volume lowerer."); + Assert.That(fieldVolume.PresentedFrameId, Is.GreaterThanOrEqualTo(0), + "The advertised Fields splat document never reached the generic volume lowerer."); + Assert.That(fieldVolume.PresentedLayerCount, Is.GreaterThan(0), + "The generic volume lowerer did not rasterize any advertised Fields layers."); + Assert.That(fieldVolume.CompositeCount, Is.GreaterThan(0), + "The generic volume lowerer never composited into the pilot camera."); WriteWitnessFacts( initialVersion, runtime.ActiveVersion, @@ -677,6 +686,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests (camera.cullingMask & (1 << mapLayer)) == 0, (mapCamera.cullingMask & (1 << mapLayer)) != 0, environmentPresentation, + fieldVolume.PresentedFrameId, + fieldVolume.PresentedLayerCount, + fieldVolume.CompositeCount, movementReceipt, lookReceipt, focusReceipt, @@ -733,6 +745,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests bool pilotCameraExcludesMapChannel, bool mapCameraIncludesMapChannel, bool environmentPresentation, + long fieldVolumeFrameId, + int fieldVolumeLayerCount, + long fieldVolumeCompositeCount, WitnessReceipt movement, WitnessReceipt look, WitnessReceipt targeting, @@ -769,6 +784,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests providerAdvertisement = true, providerAssets = true, environmentPresentation = environmentPresentation, + fieldVolumeFrameId = fieldVolumeFrameId, + fieldVolumeLayerCount = fieldVolumeLayerCount, + fieldVolumeCompositeCount = fieldVolumeCompositeCount, movement = movement != null, aimPresentation = look != null && aimDotDistance >= 49.9f, targeting = targeting != null, @@ -828,6 +846,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests public bool providerAdvertisement; public bool providerAssets; public bool environmentPresentation; + public long fieldVolumeFrameId; + public int fieldVolumeLayerCount; + public long fieldVolumeCompositeCount; public bool movement; public bool aimPresentation; public bool targeting; diff --git a/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs b/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs index 27875c4..ed3531c 100644 --- a/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs +++ b/TestProject/Assets/Tests/PlayMode/GenericWorldCaptureTests.cs @@ -8,6 +8,7 @@ using GameCult.Caching.MessagePack; using GameCult.Eve.Surface; using GameCult.Eve.UnityUIToolkit; using GameCult.Eve.UnityScene; +using GameCult.Eve.UnityScene.Fields; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; @@ -666,6 +667,14 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests Assert.That(beamRenderer.TryGetPower(beamPresentation.Id, out tractorReleasedPower), Is.True); Assert.That(tractorReleasedPower, Is.Zero, "Released held input did not return the daemon-authored tractor presentation to zero."); + var fieldVolume = root.GetComponent(); + Assert.That(fieldVolume, Is.Not.Null, "The generic client did not install its Fields volume lowerer."); + Assert.That(fieldVolume.PresentedFrameId, Is.GreaterThanOrEqualTo(0), + "The advertised Fields splat document never reached the generic volume lowerer."); + Assert.That(fieldVolume.PresentedLayerCount, Is.GreaterThan(0), + "The generic volume lowerer did not rasterize any advertised Fields layers."); + Assert.That(fieldVolume.CompositeCount, Is.GreaterThan(0), + "The generic volume lowerer never composited into the pilot camera."); WriteWitnessFacts( initialVersion, runtime.ActiveVersion, @@ -677,6 +686,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests (camera.cullingMask & (1 << mapLayer)) == 0, (mapCamera.cullingMask & (1 << mapLayer)) != 0, environmentPresentation, + fieldVolume.PresentedFrameId, + fieldVolume.PresentedLayerCount, + fieldVolume.CompositeCount, movementReceipt, lookReceipt, focusReceipt, @@ -733,6 +745,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests bool pilotCameraExcludesMapChannel, bool mapCameraIncludesMapChannel, bool environmentPresentation, + long fieldVolumeFrameId, + int fieldVolumeLayerCount, + long fieldVolumeCompositeCount, WitnessReceipt movement, WitnessReceipt look, WitnessReceipt targeting, @@ -769,6 +784,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests providerAdvertisement = true, providerAssets = true, environmentPresentation = environmentPresentation, + fieldVolumeFrameId = fieldVolumeFrameId, + fieldVolumeLayerCount = fieldVolumeLayerCount, + fieldVolumeCompositeCount = fieldVolumeCompositeCount, movement = movement != null, aimPresentation = look != null && aimDotDistance >= 49.9f, targeting = targeting != null, @@ -828,6 +846,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests public bool providerAdvertisement; public bool providerAssets; public bool environmentPresentation; + public long fieldVolumeFrameId; + public int fieldVolumeLayerCount; + public long fieldVolumeCompositeCount; public bool movement; public bool aimPresentation; public bool targeting; diff --git a/packages/org.gamecult.eve.unity-scene/Runtime/Fields/EveUnityFieldsVolumeRenderer.cs b/packages/org.gamecult.eve.unity-scene/Runtime/Fields/EveUnityFieldsVolumeRenderer.cs index 69ed109..aeea49b 100644 --- a/packages/org.gamecult.eve.unity-scene/Runtime/Fields/EveUnityFieldsVolumeRenderer.cs +++ b/packages/org.gamecult.eve.unity-scene/Runtime/Fields/EveUnityFieldsVolumeRenderer.cs @@ -25,6 +25,7 @@ namespace GameCult.Eve.UnityScene.Fields public long PresentedFrameId { get; private set; } = -1; public int PresentedLayerCount => _targets.Count(target => target.TargetTexture != null); + public long CompositeCount { get; private set; } public void Bind(EveUnityPlayableWorldClientHost host, IEveUnityFieldsSplatsDocumentSource? source) { @@ -77,6 +78,7 @@ namespace GameCult.Eve.UnityScene.Fields if (_host == null || _document == null || camera == null || _host.ActiveCameraTransform != camera.transform) return; + if (PresentedLayerCount == 0) RenderLayers(_document); var field = ActiveField(); if (field == null || !EnsureMaterial(field)) return; ApplyFieldBindings(field, _document); @@ -113,6 +115,7 @@ namespace GameCult.Eve.UnityScene.Fields _commands.SetRenderTarget(BuiltinRenderTextureType.CameraTarget); _commands.DrawProcedural(Matrix4x4.identity, _material!, compositePass, MeshTopology.Triangles, 3, 1); context.ExecuteCommandBuffer(_commands); + CompositeCount++; } private EveUnityFieldVolumeProjection? ActiveField() => @@ -218,6 +221,7 @@ namespace GameCult.Eve.UnityScene.Fields _sourceShader = null; _activeNodeId = ""; PresentedFrameId = -1; + CompositeCount = 0; } private void SetMatrix(EveUnityFieldVolumeProjection field, string propKey, Matrix4x4 value) diff --git a/packages/org.gamecult.eve.unity-scene/package.json b/packages/org.gamecult.eve.unity-scene/package.json index 1e161eb..2737004 100644 --- a/packages/org.gamecult.eve.unity-scene/package.json +++ b/packages/org.gamecult.eve.unity-scene/package.json @@ -1,7 +1,7 @@ { "name": "org.gamecult.eve.unity-scene", "displayName": "Eve Unity Scene Lowering", - "version": "0.3.33", + "version": "0.3.34", "unity": "2021.3", "description": "Provider-agnostic Unity scene shell for gamecult.eve.surface.v1 interactive world surfaces.", "dependencies": {