No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MotionBlur.cs 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System;
  2. namespace UnityEngine.Rendering.Universal
  3. {
  4. /// <summary>
  5. /// Option to control motion blur Mode.
  6. /// </summary>
  7. public enum MotionBlurMode
  8. {
  9. /// <summary>
  10. /// Use this if you don't need object motion blur.
  11. /// </summary>
  12. CameraOnly,
  13. /// <summary>
  14. /// Use this if you need object motion blur.
  15. /// </summary>
  16. CameraAndObjects
  17. }
  18. /// <summary>
  19. /// Options to control the quality the motion blur effect.
  20. /// </summary>
  21. public enum MotionBlurQuality
  22. {
  23. /// <summary>
  24. /// Use this to select low motion blur quality.
  25. /// </summary>
  26. Low,
  27. /// <summary>
  28. /// Use this to select medium motion blur quality.
  29. /// </summary>
  30. Medium,
  31. /// <summary>
  32. /// Use this to select high motion blur quality.
  33. /// </summary>
  34. High
  35. }
  36. /// <summary>
  37. /// A volume component that holds settings for the motion blur effect.
  38. /// </summary>
  39. [Serializable, VolumeComponentMenu("Post-processing/Motion Blur")]
  40. [SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
  41. [URPHelpURL("Post-Processing-Motion-Blur")]
  42. public sealed class MotionBlur : VolumeComponent, IPostProcessComponent
  43. {
  44. /// <summary>
  45. /// The motion blur technique to use. If you don't need object motion blur, CameraOnly will result in better performance.
  46. /// </summary>
  47. [Tooltip("The motion blur technique to use. If you don't need object motion blur, CameraOnly will result in better performance.")]
  48. public MotionBlurModeParameter mode = new MotionBlurModeParameter(MotionBlurMode.CameraOnly);
  49. /// <summary>
  50. /// The quality of the effect. Lower presets will result in better performance at the expense of visual quality.
  51. /// </summary>
  52. [Tooltip("The quality of the effect. Lower presets will result in better performance at the expense of visual quality.")]
  53. public MotionBlurQualityParameter quality = new MotionBlurQualityParameter(MotionBlurQuality.Low);
  54. /// <summary>
  55. /// Sets the intensity of the motion blur effect. Acts as a multiplier for velocities.
  56. /// </summary>
  57. [Tooltip("The strength of the motion blur filter. Acts as a multiplier for velocities.")]
  58. public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
  59. /// <summary>
  60. /// Sets the maximum length, as a fraction of the screen's full resolution, that the velocity resulting from Camera rotation can have.
  61. /// Lower values will improve performance.
  62. /// </summary>
  63. [Tooltip("Sets the maximum length, as a fraction of the screen's full resolution, that the velocity resulting from Camera rotation can have. Lower values will improve performance.")]
  64. public ClampedFloatParameter clamp = new ClampedFloatParameter(0.05f, 0f, 0.2f);
  65. /// <inheritdoc/>
  66. public bool IsActive() => intensity.value > 0f;
  67. /// <inheritdoc/>
  68. [Obsolete("Unused #from(2023.1)", false)]
  69. public bool IsTileCompatible() => false;
  70. }
  71. /// <summary>
  72. /// A <see cref="VolumeParameter"/> that holds a <see cref="MotionBlurMode"/> value.
  73. /// </summary>
  74. [Serializable]
  75. public sealed class MotionBlurModeParameter : VolumeParameter<MotionBlurMode>
  76. {
  77. /// <summary>
  78. /// Creates a new <see cref="MotionBlurModeParameter"/> instance.
  79. /// </summary>
  80. /// <param name="value">The initial value to store in the parameter.</param>
  81. /// <param name="overrideState">The initial override state for the parameter.</param>
  82. public MotionBlurModeParameter(MotionBlurMode value, bool overrideState = false) : base(value, overrideState) { }
  83. }
  84. /// <summary>
  85. /// A <see cref="VolumeParameter"/> that holds a <see cref="MotionBlurQuality"/> value.
  86. /// </summary>
  87. [Serializable]
  88. public sealed class MotionBlurQualityParameter : VolumeParameter<MotionBlurQuality>
  89. {
  90. /// <summary>
  91. /// Creates a new <see cref="MotionBlurQualityParameter"/> instance.
  92. /// </summary>
  93. /// <param name="value">The initial value to store in the parameter.</param>
  94. /// <param name="overrideState">The initial override state for the parameter.</param>
  95. public MotionBlurQualityParameter(MotionBlurQuality value, bool overrideState = false) : base(value, overrideState) { }
  96. }
  97. }