Lower advertised HDR grading space
This commit is contained in:
parent
b25d914049
commit
ed92fa7be0
4 changed files with 66 additions and 5 deletions
|
|
@ -43,6 +43,8 @@ namespace GameCult.Eve.UnityScene
|
|||
private bool _previousRenderPostProcessing;
|
||||
private AntialiasingMode _previousAntialiasing;
|
||||
private TemporalAA.Settings _previousTaaSettings;
|
||||
private UniversalRenderPipelineAsset? _colorGradingPipelineAsset;
|
||||
private ColorGradingMode _previousColorGradingMode;
|
||||
|
||||
public EveUnityPlayableWorldClientHost? Host
|
||||
{
|
||||
|
|
@ -141,6 +143,11 @@ namespace GameCult.Eve.UnityScene
|
|||
ReleaseRig();
|
||||
return false;
|
||||
}
|
||||
if (!ApplyColorGradingSpace(activeWorld))
|
||||
{
|
||||
ReleaseRig();
|
||||
return false;
|
||||
}
|
||||
ApplyAmbientEnvironment(activeWorld, cameraComponent, skybox, reflection, postProcessProfile);
|
||||
ApplyKeyLight(activeWorld);
|
||||
if (cameraComponent != null && _renderPolicySource != null)
|
||||
|
|
@ -316,6 +323,8 @@ namespace GameCult.Eve.UnityScene
|
|||
!IsFinite(world.TemporalSharpening) ||
|
||||
(!string.IsNullOrWhiteSpace(world.CameraReconstruction) &&
|
||||
!string.Equals(world.CameraReconstruction, "temporal-reprojection.v1", System.StringComparison.Ordinal)) ||
|
||||
(!string.IsNullOrWhiteSpace(world.ColorGradingSpace) &&
|
||||
!string.Equals(world.ColorGradingSpace, "hdr-before-tonemap.v1", System.StringComparison.Ordinal)) ||
|
||||
(string.Equals(world.CameraReconstruction, "temporal-reprojection.v1", System.StringComparison.Ordinal) &&
|
||||
(world.TemporalHistoryBlend < 0f || world.TemporalHistoryBlend > 1f ||
|
||||
world.TemporalJitterScale < 0f || world.TemporalJitterScale > 1f ||
|
||||
|
|
@ -359,6 +368,34 @@ namespace GameCult.Eve.UnityScene
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool ApplyColorGradingSpace(EveUnityPlayableWorldProjection world)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(world.ColorGradingSpace))
|
||||
{
|
||||
RestoreColorGradingSpace();
|
||||
return true;
|
||||
}
|
||||
var asset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
|
||||
if (asset == null ||
|
||||
!string.Equals(world.ColorGradingSpace, "hdr-before-tonemap.v1", System.StringComparison.Ordinal))
|
||||
return false;
|
||||
if (!ReferenceEquals(_colorGradingPipelineAsset, asset))
|
||||
{
|
||||
RestoreColorGradingSpace();
|
||||
_colorGradingPipelineAsset = asset;
|
||||
_previousColorGradingMode = asset.colorGradingMode;
|
||||
}
|
||||
asset.colorGradingMode = ColorGradingMode.HighDynamicRange;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void RestoreColorGradingSpace()
|
||||
{
|
||||
if (_colorGradingPipelineAsset == null) return;
|
||||
_colorGradingPipelineAsset.colorGradingMode = _previousColorGradingMode;
|
||||
_colorGradingPipelineAsset = null;
|
||||
}
|
||||
|
||||
private void ApplyKeyLight(EveUnityPlayableWorldProjection world)
|
||||
{
|
||||
var direction = new Vector3(
|
||||
|
|
@ -574,6 +611,7 @@ namespace GameCult.Eve.UnityScene
|
|||
|
||||
private void RestorePostProcess()
|
||||
{
|
||||
RestoreColorGradingSpace();
|
||||
ReleaseAdaptiveExposure();
|
||||
if (_postProcessCameraData != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ namespace GameCult.Eve.UnityScene
|
|||
ParseFloat(worldRoot.GetProp("exposureKeyValue"), 1f),
|
||||
worldRoot.GetProp("exposureAdaptation", "progressive"),
|
||||
ParseFloat(worldRoot.GetProp("exposureSpeedUp"), 2f),
|
||||
ParseFloat(worldRoot.GetProp("exposureSpeedDown"), 1f));
|
||||
ParseFloat(worldRoot.GetProp("exposureSpeedDown"), 1f),
|
||||
worldRoot.GetProp("colorGradingSpace"));
|
||||
}
|
||||
|
||||
private static EveUnityFieldVolumeProjection BuildFieldVolume(EveSurfaceComponent component) =>
|
||||
|
|
@ -439,7 +440,8 @@ namespace GameCult.Eve.UnityScene
|
|||
float exposureKeyValue = 1f,
|
||||
string exposureAdaptation = "progressive",
|
||||
float exposureSpeedUp = 2f,
|
||||
float exposureSpeedDown = 1f)
|
||||
float exposureSpeedDown = 1f,
|
||||
string colorGradingSpace = "")
|
||||
{
|
||||
WorldRootId = worldRootId ?? "";
|
||||
StatePointerId = statePointerId ?? "";
|
||||
|
|
@ -501,6 +503,7 @@ namespace GameCult.Eve.UnityScene
|
|||
ExposureAdaptation = exposureAdaptation ?? "";
|
||||
ExposureSpeedUp = exposureSpeedUp;
|
||||
ExposureSpeedDown = exposureSpeedDown;
|
||||
ColorGradingSpace = colorGradingSpace ?? "";
|
||||
}
|
||||
|
||||
public string WorldRootId { get; }
|
||||
|
|
@ -537,6 +540,8 @@ namespace GameCult.Eve.UnityScene
|
|||
|
||||
public string ExposureMode { get; }
|
||||
|
||||
public string ColorGradingSpace { get; }
|
||||
|
||||
public float ExposureLowPercent { get; }
|
||||
|
||||
public float ExposureHighPercent { get; }
|
||||
|
|
|
|||
|
|
@ -1133,6 +1133,14 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
var previousReflectionMode = RenderSettings.defaultReflectionMode;
|
||||
var previousCustomReflection = RenderSettings.customReflectionTexture;
|
||||
var previousReflectionIntensity = RenderSettings.reflectionIntensity;
|
||||
var previousDefaultPipeline = GraphicsSettings.defaultRenderPipeline;
|
||||
var previousQualityPipeline = QualitySettings.renderPipeline;
|
||||
var gradingRendererData = ScriptableObject.CreateInstance<UniversalRendererData>();
|
||||
var gradingPipelineAsset = UniversalRenderPipelineAsset.Create(gradingRendererData);
|
||||
gradingPipelineAsset.colorGradingMode = ColorGradingMode.LowDynamicRange;
|
||||
GraphicsSettings.defaultRenderPipeline = gradingPipelineAsset;
|
||||
QualitySettings.renderPipeline = gradingPipelineAsset;
|
||||
var previousGradingMode = gradingPipelineAsset.colorGradingMode;
|
||||
Material? skyboxMaterial = null;
|
||||
Cubemap? reflectionCubemap = null;
|
||||
VolumeProfile? postProcessProfile = null;
|
||||
|
|
@ -1168,7 +1176,8 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
exposureKeyValue: "0.5",
|
||||
exposureAdaptation: "progressive",
|
||||
exposureSpeedUp: "2",
|
||||
exposureSpeedDown: "1"),
|
||||
exposureSpeedDown: "1",
|
||||
colorGradingSpace: "hdr-before-tonemap.v1"),
|
||||
Advertisement("aetheria.daemon.game"),
|
||||
"cultmesh://aetheria/eve/surfaces/aetheria.daemon.game",
|
||||
1),
|
||||
|
|
@ -1184,6 +1193,7 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
var exposedWorld = host.ActiveProjection?.PlayableWorld;
|
||||
Assert.That(exposedWorld, Is.Not.Null);
|
||||
Assert.That(exposedWorld!.ExposureMode, Is.EqualTo("histogram.v1"));
|
||||
Assert.That(exposedWorld.ColorGradingSpace, Is.EqualTo("hdr-before-tonemap.v1"));
|
||||
Assert.That(exposedWorld.ExposureLowPercent, Is.EqualTo(47.37294f).Within(0.00001f));
|
||||
Assert.That(exposedWorld.ExposureHighPercent, Is.EqualTo(99f));
|
||||
Assert.That(exposedWorld.ExposureMinimumEv, Is.EqualTo(-3f));
|
||||
|
|
@ -1240,6 +1250,7 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
var adaptiveExposure = camera.GetComponent<EveUnityAdaptiveExposureRenderer>();
|
||||
Assert.That(adaptiveExposure, Is.Not.Null);
|
||||
Assert.That(adaptiveExposure.IsConfigured, Is.True);
|
||||
Assert.That(gradingPipelineAsset.colorGradingMode, Is.EqualTo(ColorGradingMode.HighDynamicRange));
|
||||
var postProcessTransform = hostObject.transform.Find("Eve World Post Process");
|
||||
Assert.That(postProcessTransform, Is.Not.Null);
|
||||
Assert.That(postProcessTransform.GetComponent<Volume>().sharedProfile, Is.SameAs(postProcessProfile));
|
||||
|
|
@ -1305,6 +1316,7 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
Assert.That(hostObject.transform.Find("Eve World Key Light"), Is.Null);
|
||||
Assert.That(hostObject.transform.Find("Eve World Post Process"), Is.Null);
|
||||
Assert.That(camera.GetComponent<UniversalAdditionalCameraData>(), Is.Null);
|
||||
Assert.That(gradingPipelineAsset.colorGradingMode, Is.EqualTo(previousGradingMode));
|
||||
aim.RefreshNow();
|
||||
Assert.That(aim.ViewDotVisible, Is.False);
|
||||
Assert.That(RenderSettings.ambientMode, Is.EqualTo(ambientMode));
|
||||
|
|
@ -1335,6 +1347,10 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
RenderSettings.defaultReflectionMode = previousReflectionMode;
|
||||
RenderSettings.customReflectionTexture = previousCustomReflection;
|
||||
RenderSettings.reflectionIntensity = previousReflectionIntensity;
|
||||
QualitySettings.renderPipeline = previousQualityPipeline;
|
||||
GraphicsSettings.defaultRenderPipeline = previousDefaultPipeline;
|
||||
UnityEngine.Object.DestroyImmediate(gradingPipelineAsset);
|
||||
UnityEngine.Object.DestroyImmediate(gradingRendererData);
|
||||
if (skyboxMaterial != null) UnityEngine.Object.DestroyImmediate(skyboxMaterial);
|
||||
if (reflectionCubemap != null) UnityEngine.Object.DestroyImmediate(reflectionCubemap);
|
||||
if (postProcessProfile != null) UnityEngine.Object.DestroyImmediate(postProcessProfile);
|
||||
|
|
@ -1942,7 +1958,8 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
string exposureKeyValue = "1",
|
||||
string exposureAdaptation = "progressive",
|
||||
string exposureSpeedUp = "2",
|
||||
string exposureSpeedDown = "1")
|
||||
string exposureSpeedDown = "1",
|
||||
string colorGradingSpace = "")
|
||||
{
|
||||
var playableChildren = new List<EveSurfaceComponent>
|
||||
{
|
||||
|
|
@ -2124,6 +2141,7 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
["exposureAdaptation"] = exposureAdaptation,
|
||||
["exposureSpeedUp"] = exposureSpeedUp,
|
||||
["exposureSpeedDown"] = exposureSpeedDown,
|
||||
["colorGradingSpace"] = colorGradingSpace,
|
||||
["keyLightDirection"] = "0.4,-1,0.25",
|
||||
["keyLightColor"] = "1,0.95,0.9",
|
||||
["keyLightIntensity"] = "0.75",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "org.gamecult.eve.unity-scene",
|
||||
"displayName": "Eve Unity Scene Lowering",
|
||||
"version": "0.3.61",
|
||||
"version": "0.3.62",
|
||||
"unity": "6000.0",
|
||||
"description": "Provider-agnostic Unity scene shell for gamecult.eve.surface.v1 interactive world surfaces.",
|
||||
"dependencies": {
|
||||
|
|
|
|||
Reference in a new issue