AmbientOcclusionModel.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class AmbientOcclusionModel : PostProcessingModel
  6. {
  7. public AmbientOcclusionModel.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 = AmbientOcclusionModel.Settings.defaultSettings;
  21. }
  22. [SerializeField]
  23. private AmbientOcclusionModel.Settings m_Settings = AmbientOcclusionModel.Settings.defaultSettings;
  24. public enum SampleCount
  25. {
  26. Lowest = 3,
  27. Low = 6,
  28. Medium = 10,
  29. High = 16
  30. }
  31. [Serializable]
  32. public struct Settings
  33. {
  34. public static AmbientOcclusionModel.Settings defaultSettings
  35. {
  36. get
  37. {
  38. return new AmbientOcclusionModel.Settings
  39. {
  40. intensity = 1f,
  41. radius = 0.3f,
  42. sampleCount = AmbientOcclusionModel.SampleCount.Medium,
  43. downsampling = true,
  44. forceForwardCompatibility = false,
  45. ambientOnly = false,
  46. highPrecision = false
  47. };
  48. }
  49. }
  50. [Range(0f, 4f)]
  51. [Tooltip("Degree of darkness produced by the effect.")]
  52. public float intensity;
  53. [Min(0.0001f)]
  54. [Tooltip("Radius of sample points, which affects extent of darkened areas.")]
  55. public float radius;
  56. [Tooltip("Number of sample points, which affects quality and performance.")]
  57. public AmbientOcclusionModel.SampleCount sampleCount;
  58. [Tooltip("Halves the resolution of the effect to increase performance at the cost of visual quality.")]
  59. public bool downsampling;
  60. [Tooltip("Forces compatibility with Forward rendered objects when working with the Deferred rendering path.")]
  61. public bool forceForwardCompatibility;
  62. [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.")]
  63. public bool ambientOnly;
  64. [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.")]
  65. public bool highPrecision;
  66. }
  67. }
  68. }