Scripting Support (C#)

advanced scripting

Beautify 3 (HDRP) · Scripting Support (C#)

Class: Beautify (namespace BeautifyHDRP) — HDRP Custom Post Process Volume Component.
This page documents the user-facing API (public parameters, enums, events, and methods). Internal rendering methods (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 intensity

Global effect intensity. Default: 0. Range: 0 to 1.

BoolParameter compareMode

Enable side-by-side comparison view. Default: false.

ClampedFloatParameter comparePanning

Compare view panning amount. Default: 0.25. Range: 0 to 0.5.

FloatParameter compareLineAngle

Angle of the compare divider line. Default: 1.4.

FloatParameter compareLineWidth

Width of the compare divider line. Default: 0.002.

BoolParameter compareSameSide

Show both sides with the same content. Default: true.

Sharpen

ClampedFloatParameter sharpen

Sharpening intensity. Default: 2. Range: 0 to 25.

ClampedFloatParameter sharpenDepthThreshold

Depth threshold for edge-aware sharpening. Default: 0.035. Range: 0 to 0.05.

ClampedFloatParameter sharpenMinDepth

Minimum depth for sharpening. Default: 0. Range: 0 to 1.

ClampedFloatParameter sharpenMaxDepth

Maximum depth for sharpening. Default: 0.999. Range: 0 to 1.

ClampedFloatParameter sharpenMinMaxDepthFallOff

Falloff for the sharpen depth range. Default: 0. Range: 0 to 1.

ClampedFloatParameter sharpenRelaxation

Reduces sharpening on bright areas. Default: 0.08. Range: 0 to 0.2.

ClampedFloatParameter sharpenClamp

Maximum sharpening clamp per pixel. Default: 0.45. Range: 0 to 1.

ClampedFloatParameter sharpenMotionSensibility

Reduces sharpening during camera motion. Default: 0.5. Range: 0 to 1.

Dithering

ClampedFloatParameter ditherStrength

Dithering intensity. Default: 0.006. Range: 0 to 0.03.

Tonemapping & Color Grading

BeautifyTonemapOperatorParameter tonemap

Tonemapping operator. Default: TonemapOperator.Linear.

FloatParameter tonemapExposure

Tonemapping exposure. Default: 1.

ClampedFloatParameter tonemapAGXGamma

AGX tonemapper gamma. Default: 2.5. Range: 0 to 5.

ClampedFloatParameter saturate

Color saturation. Default: 0.5. Range: -2 to 3.

FloatParameter brightness

Overall brightness. Default: 1.05.

ClampedFloatParameter contrast

Contrast adjustment. Default: 1.02. Range: 0.5 to 1.5.

ClampedFloatParameter hardlightIntensity

Hard light blend mode intensity. Default: 0.5. Range: 0 to 1.

ClampedFloatParameter hardlightBlend

Hard light blend factor. Default: 0. Range: 0 to 1.

ClampedFloatParameter daltonize

Color blindness compensation intensity. Default: 0. Range: 0 to 2.

LUT

TextureParameter lut

LUT texture for color grading. Default: null.

ClampedFloatParameter lutIntensity

LUT blend intensity. Default: 0. Range: 0 to 1.

Depth of Field

BoolParameter depthOfField

Enables depth of field. Default: false.

BeautifyDoFFocusModeParameter depthOfFieldFocusMode

Focus mode (FixedDistance, AutoFocus, FollowTarget). Default: DoFFocusMode.FixedDistance.

FloatParameter depthOfFieldDistance

Manual focus distance. Default: 10.

ClampedFloatParameter depthOfFieldFocusSpeed

Focus transition speed. Default: 1. Range: 0.001 to 5.

FloatParameter depthOfFieldAutofocusMinDistance

Minimum autofocus distance. Default: 0.

FloatParameter depthOfFieldAutofocusMaxDistance

Maximum autofocus distance. Default: 10000.

Vector2Parameter depthOfFieldAutofocusViewportPoint

Viewport point for autofocus raycast. Default: (0.5, 0.5).

FloatParameter depthOfFieldAutofocusDistanceShift

Offset added to autofocus distance. Default: 0.

BeautifyLayerMaskParameter depthOfFieldAutofocusLayerMask

Layer mask for autofocus raycasting. Default: -1 (everything).

BeautifyDoFCameraSettingsParameter depthOfFieldCameraSettings

Camera lens model (Classic or Real). Default: DoFCameraSettings.Classic.

ClampedFloatParameter depthOfFieldFocalLength

Classic mode: virtual camera focal length. Default: 0.05. Range: 0.005 to 0.5.

FloatParameter depthOfFieldAperture

Classic mode: virtual camera aperture. Default: 2.8.

ClampedFloatParameter depthOfFieldFocalLengthReal

Real mode: focal length in mm. Default: 50. Range: 1 to 300.

ClampedFloatParameter depthOfFieldFStop

Real mode: f-stop number. Default: 2. Range: 1 to 32.

ClampedFloatParameter depthOfFieldImageSensorHeight

Real mode: image sensor height in mm. Default: 24. Range: 1 to 48.

BoolParameter depthOfFieldForegroundBlur

Enables foreground blur. Default: true.

BoolParameter depthOfFieldForegroundBlurHQ

High-quality foreground blur. Default: false.

ClampedFloatParameter depthOfFieldForegroundBlurHQSpread

HQ foreground blur spread. Default: 4. Range: 0 to 32.

FloatParameter depthOfFieldForegroundDistance

Foreground blur distance. Default: 0.25.

BoolParameter depthOfFieldBokeh

Enables bokeh effect. Default: true.

ClampedFloatParameter depthOfFieldBokehThreshold

Bokeh brightness threshold. Default: 1. Range: 0.001 to 3.

ClampedFloatParameter depthOfFieldBokehIntensity

Bokeh intensity. Default: 2. Range: 0 to 8.

BeautifyDoFBokehCompositionParameter depthOfFieldBokehComposition

Bokeh composition mode (Integrated or Separated). Default: DoFBokehComposition.Integrated.

ClampedIntParameter depthOfFieldDownsampling

Downsampling for DoF pass. Default: 2. Range: 1 to 5.

ClampedIntParameter depthOfFieldMaxSamples

Maximum sample count for DoF blur. Default: 6. Range: 2 to 16.

FloatParameter depthOfFieldMaxBrightness

Maximum brightness in DoF pass. Default: 1000.

ClampedFloatParameter depthOfFieldMaxDistance

Maximum depth for DoF effect. Default: 1. Range: 0 to 1.

Vignette

ClampedFloatParameter vignettingOuterRing

Vignette outer ring size. Default: 0. Range: 0 to 1.

ClampedFloatParameter vignettingInnerRing

Vignette inner ring size. Default: 0. Range: 0 to 1.

ClampedFloatParameter vignettingFade

Vignette fade amount. Default: 0. Range: 0 to 1.

BoolParameter vignettingCircularShape

Use circular vignette shape. Default: false.

ClampedFloatParameter vignettingAspectRatio

Vignette aspect ratio. Default: 1. Range: 0 to 1.

ClampedFloatParameter vignettingBlink

Blink/close-eyes amount (0 = open, 1 = closed). Default: 0. Range: 0 to 1.

BeautifyBlinkStyleParameter vignettingBlinkStyle

Blink animation style (Cutscene or Human). Default: BlinkStyle.Cutscene.

Vector2Parameter vignettingCenter

Vignette center in viewport space. Default: (0.5, 0.5).

ColorParameter vignettingColor

Vignette tint color. Default: black.

TextureParameter vignettingMask

Vignette texture mask. Default: null.

Pixelate

IntParameter pixelateSize

Pixelation block size. Set to 1 for no pixelation. Default: 1.

Frost FX (HDRP Exclusive)

ClampedFloatParameter frostIntensity

Frost overlay intensity. Default: 0. Range: 0 to 1.5.

ClampedFloatParameter frostSpread

Frost screen coverage. Default: 1.2. Range: 1 to 5.

ClampedFloatParameter frostDistortion

Distortion through frosted areas. Default: 0.25. Range: 0 to 1.

TextureParameter frostTexture

Frost overlay texture. Default: null.

TextureParameter frostDistortTexture

Frost distortion normal map. Default: null.

ColorParameter frostTintColor

Frost overlay tint color. Default: white.

Blur

ClampedFloatParameter blurIntensity

Screen blur intensity. Default: 0. Range: 0 to 64.

Film Grain & Artifacts

BoolParameter filmGrain

Enables film grain, dirt spots, and scratches. Default: false.

ClampedFloatParameter filmGrainIntensity

Film grain intensity. Default: 0. Range: 0 to 1.

ClampedFloatParameter filmGrainResolution

Film grain resolution. Default: 0.85. Range: 0.001 to 1.

ClampedFloatParameter filmGrainLumaAttenuation

Reduces grain on bright areas. Default: 0.8. Range: 0 to 1.

ClampedFloatParameter filmGrainDirtSpotsAmount

Dirt spots frequency. Default: 0. Range: 0 to 1.

ClampedFloatParameter filmGrainDirtSpotsIntensity

Dirt spots visibility. Default: 0.2. Range: 0 to 1.

ClampedFloatParameter filmGrainScratchesAmount

Scratches frequency. Default: 0. Range: 0 to 1.

ClampedFloatParameter filmGrainScratchesIntensity

Scratches visibility. Default: 0.3. Range: 0 to 1.

BeautifySettings Class (Runtime API)

Class: 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 get

Returns a reference to the BeautifySettings component. Auto-creates on the Volume if it does not exist.

static Beautify sharedSettings get

Returns a reference to the current Beautify settings in the Volume profile. Changes modify the live effect directly.

static Beautify settings get

Returns 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 depthOfFieldTarget

The transform tracked by Depth of Field when DoFFocusMode.FollowTarget is selected.

Events

OnBeforeFocus

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 depthOfFieldCurrentFocalPointDistance

The 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);
}
Was this page helpful?