AmbientOcclusionModel.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class AmbientOcclusionModel : PostProcessingModel
  6. {
  7. public enum SampleCount
  8. {
  9. Lowest = 3,
  10. Low = 6,
  11. Medium = 10,
  12. High = 16
  13. }
  14. [Serializable]
  15. public struct Settings
  16. {
  17. [Range(0, 4), Tooltip("Degree of darkness produced by the effect.")]
  18. public float intensity;
  19. [Min(1e-4f), Tooltip("Radius of sample points, which affects extent of darkened areas.")]
  20. public float radius;
  21. [Tooltip("Number of sample points, which affects quality and performance.")]
  22. public SampleCount sampleCount;
  23. [Tooltip("Halves the resolution of the effect to increase performance at the cost of visual quality.")]
  24. public bool downsampling;
  25. [Tooltip("Forces compatibility with Forward rendered objects when working with the Deferred rendering path.")]
  26. public bool forceForwardCompatibility;
  27. [Tooltip("Enables the ambient-only mode in that the effect only affects ambient lighting. This mode is only available with the Deferred rendering path and HDR rendering.")]
  28. public bool ambientOnly;
  29. [Tooltip("Toggles the use of a higher precision depth texture with the forward rendering path (may impact performances). Has no effect with the deferred rendering path.")]
  30. public bool highPrecision;
  31. public static Settings defaultSettings
  32. {
  33. get
  34. {
  35. return new Settings
  36. {
  37. intensity = 1f,
  38. radius = 0.3f,
  39. sampleCount = SampleCount.Medium,
  40. downsampling = true,
  41. forceForwardCompatibility = false,
  42. ambientOnly = false,
  43. highPrecision = false
  44. };
  45. }
  46. }
  47. }
  48. [SerializeField]
  49. Settings m_Settings = Settings.defaultSettings;
  50. public Settings settings
  51. {
  52. get { return m_Settings; }
  53. set { m_Settings = value; }
  54. }
  55. public override void Reset()
  56. {
  57. m_Settings = Settings.defaultSettings;
  58. }
  59. }
  60. }