EyeAdaptationModel.cs 2.8 KB

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