MotionBlur.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. namespace UnityEngine.Rendering.Universal
  3. {
  4. public enum MotionBlurMode
  5. {
  6. CameraOnly,
  7. CameraAndObjects
  8. }
  9. public enum MotionBlurQuality
  10. {
  11. Low,
  12. Medium,
  13. High
  14. }
  15. [Serializable, VolumeComponentMenu("Post-processing/Motion Blur")]
  16. public sealed class MotionBlur : VolumeComponent, IPostProcessComponent
  17. {
  18. [Tooltip("The motion blur technique to use. If you don't need object motion blur, CameraOnly will result in better performance.")]
  19. public MotionBlurModeParameter mode = new MotionBlurModeParameter(MotionBlurMode.CameraOnly);
  20. [Tooltip("The quality of the effect. Lower presets will result in better performance at the expense of visual quality.")]
  21. public MotionBlurQualityParameter quality = new MotionBlurQualityParameter(MotionBlurQuality.Low);
  22. [Tooltip("The strength of the motion blur filter. Acts as a multiplier for velocities.")]
  23. public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
  24. [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.")]
  25. public ClampedFloatParameter clamp = new ClampedFloatParameter(0.05f, 0f, 0.2f);
  26. public bool IsActive() => intensity.value > 0f && mode == MotionBlurMode.CameraOnly;
  27. public bool IsTileCompatible() => false;
  28. }
  29. [Serializable]
  30. public sealed class MotionBlurModeParameter : VolumeParameter<MotionBlurMode> { public MotionBlurModeParameter(MotionBlurMode value, bool overrideState = false) : base(value, overrideState) { } }
  31. [Serializable]
  32. public sealed class MotionBlurQualityParameter : VolumeParameter<MotionBlurQuality> { public MotionBlurQualityParameter(MotionBlurQuality value, bool overrideState = false) : base(value, overrideState) { } }
  33. }