Scripting Support (C#)
advanced scriptingBeautify 3 (HDRP) · Scripting Support (C#)
Beautify (namespace BeautifyHDRP) — HDRP Custom Post Process Volume Component.
Setup, Render, Cleanup) and shader constants are intentionally omitted.
Getting Started
Beautify for HDRP integrates as a CustomPostProcessVolumeComponent. Add it to an HDRP Volume profile and access it at runtime:
using BeautifyHDRP;
using UnityEngine.Rendering;
var volume = GetComponent<Volume>();
if (volume.profile.TryGet<Beautify>(out var beautify)) {
beautify.sharpen.Override(4f);
beautify.saturate.Override(0.8f);
}
Parameters (Fields)
All members below are public Volume parameter fields on Beautify. Use .Override(value) at runtime to force a value, or set .value and .overrideState.
General Settings
ClampedFloatParameter intensityGlobal effect intensity. Default: 0. Range: 0 to 1.
BoolParameter compareModeEnable side-by-side comparison view. Default: false.
ClampedFloatParameter comparePanningCompare view panning amount. Default: 0.25. Range: 0 to 0.5.
FloatParameter compareLineAngleAngle of the compare divider line. Default: 1.4.
FloatParameter compareLineWidthWidth of the compare divider line. Default: 0.002.
BoolParameter compareSameSideShow both sides with the same content. Default: true.
Sharpen
ClampedFloatParameter sharpenSharpening intensity. Default: 2. Range: 0 to 25.
ClampedFloatParameter sharpenDepthThresholdDepth threshold for edge-aware sharpening. Default: 0.035. Range: 0 to 0.05.
ClampedFloatParameter sharpenMinDepthMinimum depth for sharpening. Default: 0. Range: 0 to 1.
ClampedFloatParameter sharpenMaxDepthMaximum depth for sharpening. Default: 0.999. Range: 0 to 1.
ClampedFloatParameter sharpenMinMaxDepthFallOffFalloff for the sharpen depth range. Default: 0. Range: 0 to 1.
ClampedFloatParameter sharpenRelaxationReduces sharpening on bright areas. Default: 0.08. Range: 0 to 0.2.
ClampedFloatParameter sharpenClampMaximum sharpening clamp per pixel. Default: 0.45. Range: 0 to 1.
ClampedFloatParameter sharpenMotionSensibilityReduces sharpening during camera motion. Default: 0.5. Range: 0 to 1.
Dithering
ClampedFloatParameter ditherStrengthDithering intensity. Default: 0.006. Range: 0 to 0.03.
Tonemapping & Color Grading
BeautifyTonemapOperatorParameter tonemapTonemapping operator. Default: TonemapOperator.Linear.
FloatParameter tonemapExposureTonemapping exposure. Default: 1.
ClampedFloatParameter tonemapAGXGammaAGX tonemapper gamma. Default: 2.5. Range: 0 to 5.
ClampedFloatParameter saturateColor saturation. Default: 0.5. Range: -2 to 3.
FloatParameter brightnessOverall brightness. Default: 1.05.
ClampedFloatParameter contrastContrast adjustment. Default: 1.02. Range: 0.5 to 1.5.
ClampedFloatParameter hardlightIntensityHard light blend mode intensity. Default: 0.5. Range: 0 to 1.
ClampedFloatParameter hardlightBlendHard light blend factor. Default: 0. Range: 0 to 1.
ClampedFloatParameter daltonizeColor blindness compensation intensity. Default: 0. Range: 0 to 2.
LUT
TextureParameter lutLUT texture for color grading. Default: null.
ClampedFloatParameter lutIntensityLUT blend intensity. Default: 0. Range: 0 to 1.
Depth of Field
BoolParameter depthOfFieldEnables depth of field. Default: false.
BeautifyDoFFocusModeParameter depthOfFieldFocusModeFocus mode (FixedDistance, AutoFocus, FollowTarget). Default: DoFFocusMode.FixedDistance.
FloatParameter depthOfFieldDistanceManual focus distance. Default: 10.
ClampedFloatParameter depthOfFieldFocusSpeedFocus transition speed. Default: 1. Range: 0.001 to 5.
FloatParameter depthOfFieldAutofocusMinDistanceMinimum autofocus distance. Default: 0.
FloatParameter depthOfFieldAutofocusMaxDistanceMaximum autofocus distance. Default: 10000.
Vector2Parameter depthOfFieldAutofocusViewportPointViewport point for autofocus raycast. Default: (0.5, 0.5).
FloatParameter depthOfFieldAutofocusDistanceShiftOffset added to autofocus distance. Default: 0.
BeautifyLayerMaskParameter depthOfFieldAutofocusLayerMaskLayer mask for autofocus raycasting. Default: -1 (everything).
BeautifyDoFCameraSettingsParameter depthOfFieldCameraSettingsCamera lens model (Classic or Real). Default: DoFCameraSettings.Classic.
ClampedFloatParameter depthOfFieldFocalLengthClassic mode: virtual camera focal length. Default: 0.05. Range: 0.005 to 0.5.
FloatParameter depthOfFieldApertureClassic mode: virtual camera aperture. Default: 2.8.
ClampedFloatParameter depthOfFieldFocalLengthRealReal mode: focal length in mm. Default: 50. Range: 1 to 300.
ClampedFloatParameter depthOfFieldFStopReal mode: f-stop number. Default: 2. Range: 1 to 32.
ClampedFloatParameter depthOfFieldImageSensorHeightReal mode: image sensor height in mm. Default: 24. Range: 1 to 48.
BoolParameter depthOfFieldForegroundBlurEnables foreground blur. Default: true.
BoolParameter depthOfFieldForegroundBlurHQHigh-quality foreground blur. Default: false.
ClampedFloatParameter depthOfFieldForegroundBlurHQSpreadHQ foreground blur spread. Default: 4. Range: 0 to 32.
FloatParameter depthOfFieldForegroundDistanceForeground blur distance. Default: 0.25.
BoolParameter depthOfFieldBokehEnables bokeh effect. Default: true.
ClampedFloatParameter depthOfFieldBokehThresholdBokeh brightness threshold. Default: 1. Range: 0.001 to 3.
ClampedFloatParameter depthOfFieldBokehIntensityBokeh intensity. Default: 2. Range: 0 to 8.
BeautifyDoFBokehCompositionParameter depthOfFieldBokehCompositionBokeh composition mode (Integrated or Separated). Default: DoFBokehComposition.Integrated.
ClampedIntParameter depthOfFieldDownsamplingDownsampling for DoF pass. Default: 2. Range: 1 to 5.
ClampedIntParameter depthOfFieldMaxSamplesMaximum sample count for DoF blur. Default: 6. Range: 2 to 16.
FloatParameter depthOfFieldMaxBrightnessMaximum brightness in DoF pass. Default: 1000.
ClampedFloatParameter depthOfFieldMaxDistanceMaximum depth for DoF effect. Default: 1. Range: 0 to 1.
Vignette
ClampedFloatParameter vignettingOuterRingVignette outer ring size. Default: 0. Range: 0 to 1.
ClampedFloatParameter vignettingInnerRingVignette inner ring size. Default: 0. Range: 0 to 1.
ClampedFloatParameter vignettingFadeVignette fade amount. Default: 0. Range: 0 to 1.
BoolParameter vignettingCircularShapeUse circular vignette shape. Default: false.
ClampedFloatParameter vignettingAspectRatioVignette aspect ratio. Default: 1. Range: 0 to 1.
ClampedFloatParameter vignettingBlinkBlink/close-eyes amount (0 = open, 1 = closed). Default: 0. Range: 0 to 1.
BeautifyBlinkStyleParameter vignettingBlinkStyleBlink animation style (Cutscene or Human). Default: BlinkStyle.Cutscene.
Vector2Parameter vignettingCenterVignette center in viewport space. Default: (0.5, 0.5).
ColorParameter vignettingColorVignette tint color. Default: black.
TextureParameter vignettingMaskVignette texture mask. Default: null.
Pixelate
IntParameter pixelateSizePixelation block size. Set to 1 for no pixelation. Default: 1.
Frost FX (HDRP Exclusive)
ClampedFloatParameter frostIntensityFrost overlay intensity. Default: 0. Range: 0 to 1.5.
ClampedFloatParameter frostSpreadFrost screen coverage. Default: 1.2. Range: 1 to 5.
ClampedFloatParameter frostDistortionDistortion through frosted areas. Default: 0.25. Range: 0 to 1.
TextureParameter frostTextureFrost overlay texture. Default: null.
TextureParameter frostDistortTextureFrost distortion normal map. Default: null.
ColorParameter frostTintColorFrost overlay tint color. Default: white.
Blur
ClampedFloatParameter blurIntensityScreen blur intensity. Default: 0. Range: 0 to 64.
Film Grain & Artifacts
BoolParameter filmGrainEnables film grain, dirt spots, and scratches. Default: false.
ClampedFloatParameter filmGrainIntensityFilm grain intensity. Default: 0. Range: 0 to 1.
ClampedFloatParameter filmGrainResolutionFilm grain resolution. Default: 0.85. Range: 0.001 to 1.
ClampedFloatParameter filmGrainLumaAttenuationReduces grain on bright areas. Default: 0.8. Range: 0 to 1.
ClampedFloatParameter filmGrainDirtSpotsAmountDirt spots frequency. Default: 0. Range: 0 to 1.
ClampedFloatParameter filmGrainDirtSpotsIntensityDirt spots visibility. Default: 0.2. Range: 0 to 1.
ClampedFloatParameter filmGrainScratchesAmountScratches frequency. Default: 0. Range: 0 to 1.
ClampedFloatParameter filmGrainScratchesIntensityScratches visibility. Default: 0.3. Range: 0 to 1.
BeautifySettings Class (Runtime API)
BeautifySettings (namespace BeautifyHDRP) — MonoBehavior companion.
BeautifySettings is a MonoBehaviour that provides static accessors, runtime helper methods, and the Depth of Field follow-target. Access it via the instance singleton:
using BeautifyHDRP;
// Get shared settings (modifies the profile directly)
Beautify b = BeautifySettings.sharedSettings;
b.sharpen.Override(5f);
// Or get a writable copy (instantiates the profile)
Beautify copy = BeautifySettings.settings;
copy.brightness.Override(1.2f);
// Trigger a blink
BeautifySettings.Blink(0.5f);
Static Properties
static BeautifySettings instance getReturns a reference to the BeautifySettings component. Auto-creates on the Volume if it does not exist.
static Beautify sharedSettings getReturns a reference to the current Beautify settings in the Volume profile. Changes modify the live effect directly.
static Beautify settings getReturns a copy of the current settings. Instantiates the profile so changes only affect this instance.
Static Methods
static void Blink(float duration, float maxValue = 1)Triggers a blink animation (vignette close-open effect) over the specified duration in seconds.
static void UnloadBeautify()Resets internal cached references. Call when switching scenes if settings are not properly reset.
Instance Fields
Transform depthOfFieldTargetThe transform tracked by Depth of Field when DoFFocusMode.FollowTarget is selected.
Events
Fired before the depth of field focus distance is applied. Your handler receives the current focus distance and returns the (optionally modified) distance to use.
// Signature: float handler(float currentFocusDistance)
BeautifySettings.instance.OnBeforeFocus = (float distance) => {
return Mathf.Clamp(distance, 1f, 100f);
};
Static Fields
static float depthOfFieldCurrentFocalPointDistanceThe current computed focal point distance. Read this to know the actual focus distance being used.
Code Examples
Override Volume Parameters
using BeautifyHDRP;
using UnityEngine.Rendering;
var volume = GetComponent<Volume>();
if (volume.profile.TryGet<Beautify>(out var beautify)) {
beautify.sharpen.Override(5f);
beautify.saturate.Override(0.8f);
beautify.contrast.Override(1.1f);
// Depth of field
beautify.depthOfField.Override(true);
beautify.depthOfFieldFocusMode.Override(Beautify.DoFFocusMode.AutoFocus);
// Frost (HDRP exclusive)
beautify.frostIntensity.Override(0.8f);
beautify.frostSpread.Override(2f);
beautify.frostTintColor.Override(new Color(0.8f, 0.9f, 1f));
}
Runtime Control via BeautifySettings
using BeautifyHDRP;
using UnityEngine;
public class BeautifyController : MonoBehaviour {
public Transform focusTarget;
void Start() {
// Set DoF target
BeautifySettings.instance.depthOfFieldTarget = focusTarget;
// Clamp focus distance
BeautifySettings.instance.OnBeforeFocus = (float dist) => {
return Mathf.Clamp(dist, 0.5f, 50f);
};
}
void Update() {
// Read current focus distance
float dist = BeautifySettings.depthOfFieldCurrentFocalPointDistance;
}
void TriggerBlink() {
BeautifySettings.Blink(0.5f);
}
}
Scene Transitions
using BeautifyHDRP;
using UnityEngine.SceneManagement;
void LoadNewScene(string sceneName) {
BeautifySettings.UnloadBeautify();
SceneManager.LoadScene(sceneName);
}Suggest an improvement
Help us improve this documentation page.