Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/UnityEngine/PostProcessing/AntialiasingModel.cs
2026-02-21 16:45:37 +08:00

227 lines
5.4 KiB
C#

using System;
namespace UnityEngine.PostProcessing
{
[Serializable]
public class AntialiasingModel : PostProcessingModel
{
public enum Method
{
Fxaa = 0,
Taa = 1
}
public enum FxaaPreset
{
ExtremePerformance = 0,
Performance = 1,
Default = 2,
Quality = 3,
ExtremeQuality = 4
}
[Serializable]
public struct FxaaQualitySettings
{
[Range(0f, 1f)]
[Tooltip("The amount of desired sub-pixel aliasing removal. Effects the sharpeness of the output.")]
public float subpixelAliasingRemovalAmount;
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
[Range(0.063f, 0.333f)]
public float edgeDetectionThreshold;
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
[Range(0f, 0.0833f)]
public float minimumRequiredLuminance;
public static FxaaQualitySettings[] presets = new FxaaQualitySettings[5]
{
new FxaaQualitySettings
{
subpixelAliasingRemovalAmount = 0f,
edgeDetectionThreshold = 0.333f,
minimumRequiredLuminance = 0.0833f
},
new FxaaQualitySettings
{
subpixelAliasingRemovalAmount = 0.25f,
edgeDetectionThreshold = 0.25f,
minimumRequiredLuminance = 0.0833f
},
new FxaaQualitySettings
{
subpixelAliasingRemovalAmount = 0.75f,
edgeDetectionThreshold = 0.166f,
minimumRequiredLuminance = 0.0833f
},
new FxaaQualitySettings
{
subpixelAliasingRemovalAmount = 1f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.0625f
},
new FxaaQualitySettings
{
subpixelAliasingRemovalAmount = 1f,
edgeDetectionThreshold = 0.063f,
minimumRequiredLuminance = 0.0312f
}
};
}
[Serializable]
public struct FxaaConsoleSettings
{
[Tooltip("The amount of spread applied to the sampling coordinates while sampling for subpixel information.")]
[Range(0.33f, 0.5f)]
public float subpixelSpreadAmount;
[Range(2f, 8f)]
[Tooltip("This value dictates how sharp the edges in the image are kept; a higher value implies sharper edges.")]
public float edgeSharpnessAmount;
[Range(0.125f, 0.25f)]
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
public float edgeDetectionThreshold;
[Range(0.04f, 0.06f)]
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
public float minimumRequiredLuminance;
public static FxaaConsoleSettings[] presets = new FxaaConsoleSettings[5]
{
new FxaaConsoleSettings
{
subpixelSpreadAmount = 0.33f,
edgeSharpnessAmount = 8f,
edgeDetectionThreshold = 0.25f,
minimumRequiredLuminance = 0.06f
},
new FxaaConsoleSettings
{
subpixelSpreadAmount = 0.33f,
edgeSharpnessAmount = 8f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.06f
},
new FxaaConsoleSettings
{
subpixelSpreadAmount = 0.5f,
edgeSharpnessAmount = 8f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.05f
},
new FxaaConsoleSettings
{
subpixelSpreadAmount = 0.5f,
edgeSharpnessAmount = 4f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.04f
},
new FxaaConsoleSettings
{
subpixelSpreadAmount = 0.5f,
edgeSharpnessAmount = 2f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.04f
}
};
}
[Serializable]
public struct FxaaSettings
{
public FxaaPreset preset;
public static FxaaSettings defaultSettings
{
get
{
return new FxaaSettings
{
preset = FxaaPreset.Default
};
}
}
}
[Serializable]
public struct TaaSettings
{
[Range(0.1f, 1f)]
[Tooltip("The diameter (in texels) inside which jitter samples are spread. Smaller values result in crisper but more aliased output, while larger values result in more stable but blurrier output.")]
public float jitterSpread;
[Tooltip("Controls the amount of sharpening applied to the color buffer.")]
[Range(0f, 3f)]
public float sharpen;
[Tooltip("The blend coefficient for a stationary fragment. Controls the percentage of history sample blended into the final color.")]
[Range(0f, 0.99f)]
public float stationaryBlending;
[Range(0f, 0.99f)]
[Tooltip("The blend coefficient for a fragment with significant motion. Controls the percentage of history sample blended into the final color.")]
public float motionBlending;
public static TaaSettings defaultSettings
{
get
{
return new TaaSettings
{
jitterSpread = 0.75f,
sharpen = 0.3f,
stationaryBlending = 0.95f,
motionBlending = 0.85f
};
}
}
}
[Serializable]
public struct Settings
{
public Method method;
public FxaaSettings fxaaSettings;
public TaaSettings taaSettings;
public static Settings defaultSettings
{
get
{
return new Settings
{
method = Method.Fxaa,
fxaaSettings = FxaaSettings.defaultSettings,
taaSettings = TaaSettings.defaultSettings
};
}
}
}
[SerializeField]
private Settings m_Settings = Settings.defaultSettings;
public Settings settings
{
get
{
return m_Settings;
}
set
{
m_Settings = value;
}
}
public override void Reset()
{
m_Settings = Settings.defaultSettings;
}
}
}