You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.2 KiB

  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class EyeAdaptationModel : PostProcessingModel
  6. {
  7. public enum EyeAdaptationType
  8. {
  9. Progressive,
  10. Fixed
  11. }
  12. [Serializable]
  13. public struct Settings
  14. {
  15. [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.")]
  16. public float lowPercent;
  17. [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.")]
  18. public float highPercent;
  19. [Tooltip("Minimum average luminance to consider for auto exposure (in EV).")]
  20. public float minLuminance;
  21. [Tooltip("Maximum average luminance to consider for auto exposure (in EV).")]
  22. public float maxLuminance;
  23. [Min(0f), Tooltip("Exposure bias. Use this to offset the global exposure of the scene.")]
  24. public float keyValue;
  25. [Tooltip("Set this to true to let Unity handle the key value automatically based on average luminance.")]
  26. public bool dynamicKeyValue;
  27. [Tooltip("Use \"Progressive\" if you want the auto exposure to be animated. Use \"Fixed\" otherwise.")]
  28. public EyeAdaptationType adaptationType;
  29. [Min(0f), Tooltip("Adaptation speed from a dark to a light environment.")]
  30. public float speedUp;
  31. [Min(0f), Tooltip("Adaptation speed from a light to a dark environment.")]
  32. public float speedDown;
  33. [Range(-16, -1), 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.")]
  34. public int logMin;
  35. [Range(1, 16), 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.")]
  36. public int logMax;
  37. public static Settings defaultSettings
  38. {
  39. get
  40. {
  41. return new Settings
  42. {
  43. lowPercent = 45f,
  44. highPercent = 95f,
  45. minLuminance = -5f,
  46. maxLuminance = 1f,
  47. keyValue = 0.25f,
  48. dynamicKeyValue = true,
  49. adaptationType = EyeAdaptationType.Progressive,
  50. speedUp = 2f,
  51. speedDown = 1f,
  52. logMin = -8,
  53. logMax = 4
  54. };
  55. }
  56. }
  57. }
  58. [SerializeField]
  59. Settings m_Settings = Settings.defaultSettings;
  60. public Settings settings
  61. {
  62. get { return m_Settings; }
  63. set { m_Settings = value; }
  64. }
  65. public override void Reset()
  66. {
  67. m_Settings = Settings.defaultSettings;
  68. }
  69. }
  70. }