GrainModel.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class GrainModel : PostProcessingModel
  6. {
  7. [Serializable]
  8. public struct Settings
  9. {
  10. [Tooltip("Enable the use of colored grain.")]
  11. public bool colored;
  12. [Range(0f, 1f), Tooltip("Grain strength. Higher means more visible grain.")]
  13. public float intensity;
  14. [Range(0.3f, 3f), Tooltip("Grain particle size.")]
  15. public float size;
  16. [Range(0f, 1f), Tooltip("Controls the noisiness response curve based on scene luminance. Lower values mean less noise in dark areas.")]
  17. public float luminanceContribution;
  18. public static Settings defaultSettings
  19. {
  20. get
  21. {
  22. return new Settings
  23. {
  24. colored = true,
  25. intensity = 0.5f,
  26. size = 1f,
  27. luminanceContribution = 0.8f
  28. };
  29. }
  30. }
  31. }
  32. [SerializeField]
  33. Settings m_Settings = Settings.defaultSettings;
  34. public Settings settings
  35. {
  36. get { return m_Settings; }
  37. set { m_Settings = value; }
  38. }
  39. public override void Reset()
  40. {
  41. m_Settings = Settings.defaultSettings;
  42. }
  43. }
  44. }