37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
[Serializable]
|
|
[VolumeComponentMenu("Post-processing/Bansonic/Global Distortion")]
|
|
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
|
|
public sealed class GlobalDistortionVolume : VolumeComponent, IPostProcessComponent
|
|
{
|
|
[Tooltip("Base distortion intensity from the volume profile.")]
|
|
public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
|
|
|
|
[Tooltip("Noise contribution to the UV distortion.")]
|
|
public ClampedFloatParameter noiseStrength = new ClampedFloatParameter(0.16f, 0f, 1f);
|
|
|
|
[Tooltip("Radial pull strength from the distortion center.")]
|
|
public ClampedFloatParameter radialStrength = new ClampedFloatParameter(0.35f, 0f, 2f);
|
|
|
|
[Tooltip("Noise tiling scale.")]
|
|
public ClampedFloatParameter noiseScale = new ClampedFloatParameter(12f, 0.1f, 80f);
|
|
|
|
[Tooltip("Distortion center in viewport coordinates.")]
|
|
public Vector2Parameter center = new Vector2Parameter(new Vector2(0.5f, 0.5f));
|
|
|
|
[Tooltip("How quickly distortion fades towards screen edges.")]
|
|
public ClampedFloatParameter edgeFade = new ClampedFloatParameter(1.25f, 0.1f, 8f);
|
|
|
|
[Tooltip("Whether this effect should run in SceneView cameras.")]
|
|
public BoolParameter affectSceneView = new BoolParameter(false);
|
|
|
|
public bool IsActive() => intensity.value > 0.0001f;
|
|
|
|
[Obsolete("Unused #from(2023.1)", false)]
|
|
public bool IsTileCompatible() => false;
|
|
}
|