Scripting Support (C#)
advanced scriptingShiny SSR 2 · Scripting Support (C#)
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 reflectionStyleReflection style: ShinyReflections or DarkReflections. Default: ShinyReflections.
ClampedFloatParameter reflectionsMultiplierGlobal reflection intensity multiplier (0–2). Default: 0 (disabled).
BoolParameter showInSceneViewShow reflections in the Scene View. Default: true.
ReflectionsWorkflowParameter reflectionsWorkflowWorkflow mode: SmoothnessOnly (single value for intensity and roughness) or MetallicAndSmoothness (full PBR). Default: SmoothnessOnly.
Raytracing
ClampedIntParameter sampleCountMaximum samples during the ray-march loop (4–256). Default: 16.
FloatParameter maxRayLengthMaximum reflection distance. Default: 24.
FloatParameter thicknessAssumed geometry thickness in the depth buffer before binary search. Default: 0.3.
ClampedIntParameter binarySearchIterationsRefinement steps when a hit is found (0–16). Default: 6.
BoolParameter refineThicknessIncrease accuracy after binary search by discarding points farther than thicknessFine. Default: false.
ClampedFloatParameter thicknessFinePost-binary-search thickness threshold (0.005–1). Default: 0.05.
ClampedFloatParameter jitterRandom offset to smooth edges (0–1). Default: 0.3.
BoolParameter animatedJitterAnimate jitter every frame for per-pixel temporal redistribution. Default: false.
BoolParameter computeBackFacesPerform a depth pre-pass to compute true thickness instead of assuming a fixed value. More accurate but expensive. Default: false.
ClampedFloatParameter thicknessMinimumMinimum allowed thickness for any geometry when using back-face computation (0–1). Default: 0.16.
LayerMaskParameter computeBackFacesLayerMaskWhich objects to include in the back-faces depth pass. Default: all layers.
Resolution & Filtering
ClampedIntParameter downsamplingResolution downsampling for the final reflections (1–4). Default: 1.
FloatParameter depthBiasBias applied to depth checking. Increase if reflections disappear at distance. Default: 0.03.
BoolParameter temporalFilterTemporal filter to reduce flickering. Default: false.
FloatParameter temporalFilterResponseSpeedHow fast the temporal history buffer is discarded. Default: 1.
DepthPrecisionParameter depthPrecisionDepth precision of the downscaled depth buffer: Half or Full. Full provides better accuracy but uses more memory. Default: Half.
BoolParameter lowPrecisionUse ARGB32 (LDR) instead of ARGBHalf (HDR) buffers. Default: false.
BoolParameter stopNaNPrevent out-of-range colors when composing reflections. Performs an extra ping-pong copy. Default: false.
Reflection Intensity
ClampedFloatParameter smoothnessThresholdMinimum smoothness to receive reflections (0–1). Default: 0.
ClampedFloatParameter reflectionsMinIntensityFloor for reflection intensity (0–1). Default: 0.
ClampedFloatParameter reflectionsMaxIntensityCap for reflection intensity (0–1). Default: 1.
ClampedFloatParameter hdrClampClamps HDR reflection values to prevent overly bright spots (0.01–10). Default: 3.
AnimationCurveParameter reflectionsIntensityCurveReflection intensity mapping curve. Default: linear (0,0)–(1,1).
AnimationCurveParameter reflectionsSmoothnessCurveReflection smoothness mapping curve. Default: ease-in curve.
ClampedFloatParameter fresnelView-angle-based intensity reduction (0–1). 1 = physically realistic. Default: 0.75.
FloatParameter decayReflection intensity falloff with distance from reflective point. Default: 2.
ClampedFloatParameter metallicBoostImproves appearance of metallic surfaces in deferred (0–0.3). Default: 0.
ClampedFloatParameter metallicBoostThresholdMetallic threshold for the boost effect (0–1). Default: 0.
BoolParameter specularControlReduces intensity of specular reflections to prevent flickering. Default: true.
FloatParameter specularSoftenPowerPower of the specular softening filter. Default: 15.
Skybox
SkyboxReflectionModeParameter skyboxReflectionModeHow skybox reflections are rendered: Disabled, VisibleSkyOnly, Cubemap (auto-captured), or CustomCubemap. Default: Disabled.
ClampedFloatParameter skyboxIntensitySkybox reflection intensity (0–1). Default: 0.
SkyboxResolutionParameter skyboxResolutionResolution of the skybox cubemap snapshot (16–8192). Default: 1024.
SkyboxUpdateModeParameter skyboxUpdateModeHow often the skybox cubemap is baked: OnStart, Interval, or Continuous. Default: OnStart.
FloatParameter skyboxUpdateIntervalSeconds between each skybox snapshot when using Interval mode. Default: 3.
SkyboxContributionPassParameter skyboxContributionPassWhere skybox contribution is applied: Deferred, Forward, or Both. Default: Forward.
TextureParameter skyboxCustomCubemapUser-defined cubemap for skybox reflections. Default: null.
BoolParameter skyboxHDRCreate the skybox cubemap with DefaultHDR color format. Default: false.
LayerMaskParameter skyboxCullingMaskCulling mask for baking the skybox cubemap. 0 captures only the default skybox. Default: 0.
Distance Attenuation
FloatParameter nearCameraAttenuationStartDistance in meters where near-camera attenuation begins. Default: 0.
FloatParameter nearCameraAttenuationRangeRange in meters over which near-camera attenuation fades. Default: 1.
FloatParameter farCameraAttenuationStartDistance in meters where far-camera attenuation begins. Default: 900.
FloatParameter farCameraAttenuationRangeRange in meters over which far-camera attenuation fades. Default: 100.
Custom Bounds
BoolParameter useCustomBoundsRestrict reflections to a specific volume. Default: false.
Vector3Parameter boundsMinMinimum corner of the reflection bounds. Default: (-10000, -10000, -10000).
Vector3Parameter boundsMaxMaximum corner of the reflection bounds. Default: (10000, 10000, 10000).
Vignette
ClampedFloatParameter vignetteSizeAttenuation range on screen borders (0.5–2). Default: 1.1.
ClampedFloatParameter vignettePowerAttenuation gradient power (0.1–10). Default: 1.5.
VignetteModeParameter vignetteModeVignette falloff shape: Edge (box distance to edges) or Radial (distance from center). Default: Edge.
Blur
FloatParameter fuzzynessDistance-based ray dispersion (blur multiplier). Default: 0.
FloatParameter contactHardeningSharpens reflections near objects. Default: 0.
ClampedFloatParameter minimumBlurMinimum blur intensity (0–4). Default: 0.25.
ClampedIntParameter blurDownsamplingBlur buffer resolution downsampling (1–8). Default: 1.
Vector2Parameter blurStrengthDirectional blur strength per axis (x, y). Default: (1, 1).
BoolParameter edgeAwareBlurReduce blur across geometry edges (edge-aware weighting). Default: false.
Stencil
BoolParameter stencilCheckEnable stencil mask to exclude reflections on specific pixels. Default: false.
IntParameter stencilValueStencil reference value. Default: 1.
CompareFunctionParameter stencilCompareFunctionStencil comparison function. Default: NotEqual.
Deferred Options
BoolParameter useReflectionsScriptsUse Reflections scripts when rendering in deferred. Useful for transparent objects like puddles. Default: false.
LayerMaskParameter reflectionsScriptsLayerMaskWhich Reflections scripts to use in deferred. Default: all layers.
BoolParameter skipDeferredPassSkip the full-screen deferred pass, computing reflections only on surfaces with Reflections scripts. Default: false.
ClampedFloatParameter opaqueReflectionsBlendingImprove blending of opaque reflections with reflections on transparent objects in deferred (0–64). Default: 0.
Transparency
BoolParameter transparencySupportInclude transparent objects in reflections. Default: false.
LayerMaskParameter transparentLayerMaskWhich layers are considered transparent. Default: 1.
Debug
DebugViewParameter debugViewOutput mode: Final, OnlyReflections, SideBySideComparison, Depth, or DeferredNormals. Default: Final.
MinFloatParameter debugDepthMultiplierDepth multiplier for the depth debug view. Default: 0.1.
ClampedFloatParameter separationPosPosition 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;
}
}Suggest an improvement
Help us improve this documentation page.