DepthOfFieldModel.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class DepthOfFieldModel : PostProcessingModel
  6. {
  7. public DepthOfFieldModel.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 = DepthOfFieldModel.Settings.defaultSettings;
  21. }
  22. [SerializeField]
  23. private DepthOfFieldModel.Settings m_Settings = DepthOfFieldModel.Settings.defaultSettings;
  24. public enum KernelSize
  25. {
  26. Small,
  27. Medium,
  28. Large,
  29. VeryLarge
  30. }
  31. [Serializable]
  32. public struct Settings
  33. {
  34. public static DepthOfFieldModel.Settings defaultSettings
  35. {
  36. get
  37. {
  38. return new DepthOfFieldModel.Settings
  39. {
  40. focusDistance = 10f,
  41. aperture = 5.6f,
  42. focalLength = 50f,
  43. useCameraFov = false,
  44. kernelSize = DepthOfFieldModel.KernelSize.Medium
  45. };
  46. }
  47. }
  48. [Min(0.1f)]
  49. [Tooltip("Distance to the point of focus.")]
  50. public float focusDistance;
  51. [Range(0.05f, 32f)]
  52. [Tooltip("Ratio of aperture (known as f-stop or f-number). The smaller the value is, the shallower the depth of field is.")]
  53. public float aperture;
  54. [Range(1f, 300f)]
  55. [Tooltip("Distance between the lens and the film. The larger the value is, the shallower the depth of field is.")]
  56. public float focalLength;
  57. [Tooltip("Calculate the focal length automatically from the field-of-view value set on the camera. Using this setting isn't recommended.")]
  58. public bool useCameraFov;
  59. [Tooltip("Convolution kernel size of the bokeh filter, which determines the maximum radius of bokeh. It also affects the performance (the larger the kernel is, the longer the GPU time is required).")]
  60. public DepthOfFieldModel.KernelSize kernelSize;
  61. }
  62. }
  63. }