diff options
author | chai <215380520@qq.com> | 2024-03-13 11:00:58 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2024-03-13 11:00:58 +0800 |
commit | 6ce8b9e22fc13be34b442c7b6af48b42cd44275a (patch) | |
tree | b38119d2acf0a982cb67e381f146924b9bfc3b3f /UnityEngine.PostProcessing/EyeAdaptationModel.cs |
+init
Diffstat (limited to 'UnityEngine.PostProcessing/EyeAdaptationModel.cs')
-rw-r--r-- | UnityEngine.PostProcessing/EyeAdaptationModel.cs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/UnityEngine.PostProcessing/EyeAdaptationModel.cs b/UnityEngine.PostProcessing/EyeAdaptationModel.cs new file mode 100644 index 0000000..aab9a3d --- /dev/null +++ b/UnityEngine.PostProcessing/EyeAdaptationModel.cs @@ -0,0 +1,97 @@ +using System; + +namespace UnityEngine.PostProcessing; + +[Serializable] +public class EyeAdaptationModel : PostProcessingModel +{ + public enum EyeAdaptationType + { + Progressive, + Fixed + } + + [Serializable] + public struct Settings + { + [Range(1f, 99f)] + [Tooltip("Filters the dark part of the histogram when computing the average luminance to avoid very dark pixels from contributing to the auto exposure. Unit is in percent.")] + public float lowPercent; + + [Range(1f, 99f)] + [Tooltip("Filters the bright part of the histogram when computing the average luminance to avoid very dark pixels from contributing to the auto exposure. Unit is in percent.")] + public float highPercent; + + [Tooltip("Minimum average luminance to consider for auto exposure (in EV).")] + public float minLuminance; + + [Tooltip("Maximum average luminance to consider for auto exposure (in EV).")] + public float maxLuminance; + + [Min(0f)] + [Tooltip("Exposure bias. Use this to offset the global exposure of the scene.")] + public float keyValue; + + [Tooltip("Set this to true to let Unity handle the key value automatically based on average luminance.")] + public bool dynamicKeyValue; + + [Tooltip("Use \"Progressive\" if you want the auto exposure to be animated. Use \"Fixed\" otherwise.")] + public EyeAdaptationType adaptationType; + + [Min(0f)] + [Tooltip("Adaptation speed from a dark to a light environment.")] + public float speedUp; + + [Min(0f)] + [Tooltip("Adaptation speed from a light to a dark environment.")] + public float speedDown; + + [Range(-16f, -1f)] + [Tooltip("Lower bound for the brightness range of the generated histogram (in EV). The bigger the spread between min & max, the lower the precision will be.")] + public int logMin; + + [Range(1f, 16f)] + [Tooltip("Upper bound for the brightness range of the generated histogram (in EV). The bigger the spread between min & max, the lower the precision will be.")] + public int logMax; + + public static Settings defaultSettings + { + get + { + Settings result = default(Settings); + result.lowPercent = 45f; + result.highPercent = 95f; + result.minLuminance = -5f; + result.maxLuminance = 1f; + result.keyValue = 0.25f; + result.dynamicKeyValue = true; + result.adaptationType = EyeAdaptationType.Progressive; + result.speedUp = 2f; + result.speedDown = 1f; + result.logMin = -8; + result.logMax = 4; + return result; + } + } + } + + [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; + } +} |