Scripting Support (C#)

advanced scripting

Shiny SSR 2 · Scripting Support (C#)

Class: ShinyScreenSpaceRaytracedReflections — a URP VolumeComponent in the ShinySSRR namespace. Add it as a Volume override and control all reflection settings at runtime.

Getting Started

Add a ShinyScreenSpaceRaytracedReflections override to a URP Volume. Access it via the standard Volume API:

using UnityEngine.Rendering;
using ShinySSRR;

var volume = GetComponent<Volume>();
if (volume.profile.TryGet<ShinyScreenSpaceRaytracedReflections>(out var ssr)) {
    ssr.reflectionsMultiplier.Override(1f);
    ssr.sampleCount.Override(48);
}

General

ReflectionStyleParameter reflectionStyle

Reflection style: ShinyReflections or DarkReflections. Default: ShinyReflections.

ClampedFloatParameter reflectionsMultiplier

Global reflection intensity multiplier (0–2). Default: 0 (disabled).

BoolParameter showInSceneView

Show reflections in the Scene View. Default: true.

ReflectionsWorkflowParameter reflectionsWorkflow

Workflow mode: SmoothnessOnly (single value for intensity and roughness) or MetallicAndSmoothness (full PBR). Default: SmoothnessOnly.

Raytracing

ClampedIntParameter sampleCount

Maximum samples during the ray-march loop (4–256). Default: 16.

FloatParameter maxRayLength

Maximum reflection distance. Default: 24.

FloatParameter thickness

Assumed geometry thickness in the depth buffer before binary search. Default: 0.3.

ClampedIntParameter binarySearchIterations

Refinement steps when a hit is found (0–16). Default: 6.

BoolParameter refineThickness

Increase accuracy after binary search by discarding points farther than thicknessFine. Default: false.

ClampedFloatParameter thicknessFine

Post-binary-search thickness threshold (0.005–1). Default: 0.05.

ClampedFloatParameter jitter

Random offset to smooth edges (0–1). Default: 0.3.

BoolParameter animatedJitter

Animate jitter every frame for per-pixel temporal redistribution. Default: false.

BoolParameter computeBackFaces

Perform a depth pre-pass to compute true thickness instead of assuming a fixed value. More accurate but expensive. Default: false.

ClampedFloatParameter thicknessMinimum

Minimum allowed thickness for any geometry when using back-face computation (0–1). Default: 0.16.

LayerMaskParameter computeBackFacesLayerMask

Which objects to include in the back-faces depth pass. Default: all layers.

Resolution & Filtering

ClampedIntParameter downsampling

Resolution downsampling for the final reflections (1–4). Default: 1.

FloatParameter depthBias

Bias applied to depth checking. Increase if reflections disappear at distance. Default: 0.03.

BoolParameter temporalFilter

Temporal filter to reduce flickering. Default: false.

FloatParameter temporalFilterResponseSpeed

How fast the temporal history buffer is discarded. Default: 1.

DepthPrecisionParameter depthPrecision

Depth precision of the downscaled depth buffer: Half or Full. Full provides better accuracy but uses more memory. Default: Half.

BoolParameter lowPrecision

Use ARGB32 (LDR) instead of ARGBHalf (HDR) buffers. Default: false.

BoolParameter stopNaN

Prevent out-of-range colors when composing reflections. Performs an extra ping-pong copy. Default: false.

Reflection Intensity

ClampedFloatParameter smoothnessThreshold

Minimum smoothness to receive reflections (0–1). Default: 0.

ClampedFloatParameter reflectionsMinIntensity

Floor for reflection intensity (0–1). Default: 0.

ClampedFloatParameter reflectionsMaxIntensity

Cap for reflection intensity (0–1). Default: 1.

ClampedFloatParameter hdrClamp

Clamps HDR reflection values to prevent overly bright spots (0.01–10). Default: 3.

AnimationCurveParameter reflectionsIntensityCurve

Reflection intensity mapping curve. Default: linear (0,0)–(1,1).

AnimationCurveParameter reflectionsSmoothnessCurve

Reflection smoothness mapping curve. Default: ease-in curve.

ClampedFloatParameter fresnel

View-angle-based intensity reduction (0–1). 1 = physically realistic. Default: 0.75.

FloatParameter decay

Reflection intensity falloff with distance from reflective point. Default: 2.

ClampedFloatParameter metallicBoost

Improves appearance of metallic surfaces in deferred (0–0.3). Default: 0.

ClampedFloatParameter metallicBoostThreshold

Metallic threshold for the boost effect (0–1). Default: 0.

BoolParameter specularControl

Reduces intensity of specular reflections to prevent flickering. Default: true.

FloatParameter specularSoftenPower

Power of the specular softening filter. Default: 15.

Skybox

SkyboxReflectionModeParameter skyboxReflectionMode

How skybox reflections are rendered: Disabled, VisibleSkyOnly, Cubemap (auto-captured), or CustomCubemap. Default: Disabled.

ClampedFloatParameter skyboxIntensity

Skybox reflection intensity (0–1). Default: 0.

SkyboxResolutionParameter skyboxResolution

Resolution of the skybox cubemap snapshot (16–8192). Default: 1024.

SkyboxUpdateModeParameter skyboxUpdateMode

How often the skybox cubemap is baked: OnStart, Interval, or Continuous. Default: OnStart.

FloatParameter skyboxUpdateInterval

Seconds between each skybox snapshot when using Interval mode. Default: 3.

SkyboxContributionPassParameter skyboxContributionPass

Where skybox contribution is applied: Deferred, Forward, or Both. Default: Forward.

TextureParameter skyboxCustomCubemap

User-defined cubemap for skybox reflections. Default: null.

BoolParameter skyboxHDR

Create the skybox cubemap with DefaultHDR color format. Default: false.

LayerMaskParameter skyboxCullingMask

Culling mask for baking the skybox cubemap. 0 captures only the default skybox. Default: 0.

Distance Attenuation

FloatParameter nearCameraAttenuationStart

Distance in meters where near-camera attenuation begins. Default: 0.

FloatParameter nearCameraAttenuationRange

Range in meters over which near-camera attenuation fades. Default: 1.

FloatParameter farCameraAttenuationStart

Distance in meters where far-camera attenuation begins. Default: 900.

FloatParameter farCameraAttenuationRange

Range in meters over which far-camera attenuation fades. Default: 100.

Custom Bounds

BoolParameter useCustomBounds

Restrict reflections to a specific volume. Default: false.

Vector3Parameter boundsMin

Minimum corner of the reflection bounds. Default: (-10000, -10000, -10000).

Vector3Parameter boundsMax

Maximum corner of the reflection bounds. Default: (10000, 10000, 10000).

Vignette

ClampedFloatParameter vignetteSize

Attenuation range on screen borders (0.5–2). Default: 1.1.

ClampedFloatParameter vignettePower

Attenuation gradient power (0.1–10). Default: 1.5.

VignetteModeParameter vignetteMode

Vignette falloff shape: Edge (box distance to edges) or Radial (distance from center). Default: Edge.

Blur

FloatParameter fuzzyness

Distance-based ray dispersion (blur multiplier). Default: 0.

FloatParameter contactHardening

Sharpens reflections near objects. Default: 0.

ClampedFloatParameter minimumBlur

Minimum blur intensity (0–4). Default: 0.25.

ClampedIntParameter blurDownsampling

Blur buffer resolution downsampling (1–8). Default: 1.

Vector2Parameter blurStrength

Directional blur strength per axis (x, y). Default: (1, 1).

BoolParameter edgeAwareBlur

Reduce blur across geometry edges (edge-aware weighting). Default: false.

Stencil

BoolParameter stencilCheck

Enable stencil mask to exclude reflections on specific pixels. Default: false.

IntParameter stencilValue

Stencil reference value. Default: 1.

CompareFunctionParameter stencilCompareFunction

Stencil comparison function. Default: NotEqual.

Deferred Options

BoolParameter useReflectionsScripts

Use Reflections scripts when rendering in deferred. Useful for transparent objects like puddles. Default: false.

LayerMaskParameter reflectionsScriptsLayerMask

Which Reflections scripts to use in deferred. Default: all layers.

BoolParameter skipDeferredPass

Skip the full-screen deferred pass, computing reflections only on surfaces with Reflections scripts. Default: false.

ClampedFloatParameter opaqueReflectionsBlending

Improve blending of opaque reflections with reflections on transparent objects in deferred (0–64). Default: 0.

Transparency

BoolParameter transparencySupport

Include transparent objects in reflections. Default: false.

LayerMaskParameter transparentLayerMask

Which layers are considered transparent. Default: 1.

Debug

DebugViewParameter debugView

Output mode: Final, OnlyReflections, SideBySideComparison, Depth, or DeferredNormals. Default: Final.

MinFloatParameter debugDepthMultiplier

Depth multiplier for the depth debug view. Default: 0.1.

ClampedFloatParameter separationPos

Position of the dividing line in side-by-side comparison (0–1). Default: 0.5.

Methods

void ApplyRaytracingPreset(RaytracingPreset preset)

Apply a quality preset that configures multiple raytracing parameters at once. Available presets: Fast, Medium, High, Superb, Ultra.

Code Examples

Configure Reflections at Runtime

using UnityEngine.Rendering;
using ShinySSRR;

var volume = GetComponent<Volume>();
if (volume.profile.TryGet<ShinyScreenSpaceRaytracedReflections>(out var ssr)) {
    // Enable reflections
    ssr.reflectionsMultiplier.Override(1f);

    // Apply a quality preset
    ssr.ApplyRaytracingPreset(RaytracingPreset.High);

    // Fine-tune settings
    ssr.fresnel.Override(0.9f);
    ssr.decay.Override(3f);
    ssr.fuzzyness.Override(0.5f);
    ssr.contactHardening.Override(1f);
}

Quality Settings

using UnityEngine.Rendering;
using ShinySSRR;

void SetReflectionQuality(Volume volume, string quality) {
    if (!volume.profile.TryGet<ShinyScreenSpaceRaytracedReflections>(out var ssr)) return;

    switch (quality) {
        case "low":
            ssr.ApplyRaytracingPreset(RaytracingPreset.Fast);
            ssr.downsampling.Override(2);
            break;
        case "high":
            ssr.ApplyRaytracingPreset(RaytracingPreset.Superb);
            ssr.skyboxReflectionMode.Override(SkyboxReflectionMode.Cubemap);
            ssr.skyboxIntensity.Override(0.5f);
            break;
    }
}
Was this page helpful?