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.

LensDistortion.cs 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. namespace UnityEngine.Rendering.Universal
  3. {
  4. /// <summary>
  5. /// A volume component that holds settings for the Lens Distortion effect.
  6. /// </summary>
  7. [Serializable, VolumeComponentMenu("Post-processing/Lens Distortion")]
  8. [SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
  9. [URPHelpURL("Post-Processing-Lens-Distortion")]
  10. public sealed class LensDistortion : VolumeComponent, IPostProcessComponent
  11. {
  12. /// <summary>
  13. /// Total distortion amount.
  14. /// </summary>
  15. [Tooltip("Total distortion amount.")]
  16. public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, -1f, 1f);
  17. /// <summary>
  18. /// Intensity multiplier on X axis. Set it to 0 to disable distortion on this axis.
  19. /// </summary>
  20. [Tooltip("Intensity multiplier on X axis. Set it to 0 to disable distortion on this axis.")]
  21. public ClampedFloatParameter xMultiplier = new ClampedFloatParameter(1f, 0f, 1f);
  22. /// <summary>
  23. /// Intensity multiplier on Y axis. Set it to 0 to disable distortion on this axis.
  24. /// </summary>
  25. [Tooltip("Intensity multiplier on Y axis. Set it to 0 to disable distortion on this axis.")]
  26. public ClampedFloatParameter yMultiplier = new ClampedFloatParameter(1f, 0f, 1f);
  27. /// <summary>
  28. /// Distortion center point. 0.5,0.5 is center of the screen
  29. /// </summary>
  30. [Tooltip("Distortion center point. 0.5,0.5 is center of the screen.")]
  31. public Vector2Parameter center = new Vector2Parameter(new Vector2(0.5f, 0.5f));
  32. /// <summary>
  33. /// Controls global screen scaling for the distortion effect. Use this to hide the screen borders when using high \"Intensity.\"
  34. /// </summary>
  35. [Tooltip("Controls global screen scaling for the distortion effect. Use this to hide the screen borders when using high \"Intensity.\"")]
  36. public ClampedFloatParameter scale = new ClampedFloatParameter(1f, 0.01f, 5f);
  37. /// <inheritdoc/>
  38. public bool IsActive()
  39. {
  40. return Mathf.Abs(intensity.value) > 0
  41. && (xMultiplier.value > 0f || yMultiplier.value > 0f);
  42. }
  43. /// <inheritdoc/>
  44. [Obsolete("Unused #from(2023.1)", false)]
  45. public bool IsTileCompatible() => false;
  46. }
  47. }