Scripting Support (C#)
advanced scriptingRadiant GI (URP) · Scripting Support (C#)
RadiantGlobalIllumination — a URP VolumeComponent in the RadiantGI.Universal namespace. Add it as a Volume override and control all GI settings at runtime.
Getting Started
Add a RadiantGlobalIllumination override to a URP Volume in your scene. Access it via script using the standard Volume API:
using UnityEngine.Rendering;
using RadiantGI.Universal;
var volume = GetComponent<Volume>();
if (volume.profile.TryGet<RadiantGlobalIllumination>(out var rgi)) {
rgi.indirectIntensity.Override(1.5f);
rgi.rayCount.Override(2);
}
Indirect Lighting
FloatParameter indirectIntensityIntensity of the indirect lighting. Default: 0 (disabled).
ClampedFloatParameter indirectDistanceAttenuationDistance attenuation applied to indirect lighting. Reduces intensity by square of distance (0–1). Default: 0.
FloatParameter indirectMaxSourceBrightnessClamps maximum brightness of surfaces emitting indirect light. Default: 15.
ClampedFloatParameter normalMapInfluenceHow much the surface normal map influences received indirect lighting (0–1). Default: 0.2.
BoolParameter rayBounceAdd one extra ray bounce using the previous frame’s GI result. Default: false.
Near Field Obscurance
FloatParameter nearFieldObscuranceIntensity of the near field obscurance effect. Darkens surfaces occluded by nearby geometry. Default: 0 (disabled).
ClampedFloatParameter nearFieldObscuranceSpreadSpread / radius of the effect (0.01–1). Default: 0.2.
FloatParameter nearFieldObscuranceMaxCameraDistanceMaximum distance from the camera at which the effect is visible. Default: 125.
ClampedFloatParameter nearFieldObscuranceOccluderDistanceDistance threshold of the occluder (0–1). Default: 0.825.
ColorParameter nearFieldObscuranceTintColorTint color of the obscurance effect. Default: black.
Organic Light
ClampedFloatParameter organicLightIntensity of organic/procedural light. Injects artificial light variations into g-buffers for a more natural-looking environment (0–1). Default: 0 (disabled).
ClampedFloatParameter organicLightThresholdThreshold of organic light noise calculation (0–1). Default: 0.5.
ClampedFloatParameter organicLightSpreadOrganic light spread (0.9–1). Default: 0.98.
ClampedFloatParameter organicLightNormalsInfluencePreserves normal map effect on textures when organic light is applied (0–1). Default: 0.95.
ColorParameter organicLightTintColorTint color for organic light. Default: white.
Vector3Parameter organicLightAnimationSpeedAnimation speed of the organic light pattern. Default: Vector3.zero.
BoolParameter organicLightDistanceScalingReduces organic light pattern repetition at distance. Default: false.
Ambient
ClampedFloatParameter unityAmbientLightingControls how much Unity ambient light is preserved. 0 = full subtraction, 1 = keep all ambient (0–1). Default: 1.
ClampedFloatParameter fallbackAmbientAmount of ambient lighting from Adaptive Probe Volumes and Sky. 0 = disabled (0–1). Default: 0.
Ray Marching
ClampedIntParameter rayCountNumber of rays per pixel (1–4). More rays = less noise but slower. Default: 1.
FloatParameter rayMaxLengthMaximum ray length. Increasing may require higher rayMaxSamples. Default: 8.
IntParameter rayMaxSamplesMaximum samples along the ray-march loop. Values of 24–32 usually give good results. Default: 32.
FloatParameter rayJitterRandomization of the ray starting position to reduce banding. Default: 0.3.
FloatParameter thicknessDepth tolerance for determining ray hits. Values of 0.1–0.3 work best. Default: 0.25.
Fallbacks
BoolParameter fallbackReuseRaysReuse rays from previous frames when a ray misses its target. Default: false.
ClampedFloatParameter rayReuseIntensity of previous-frame color reuse on ray miss (0–1). 0 = disabled. Default: 0.
BoolParameter fallbackReflectionProbesUse nearby reflection probes when a ray misses. Default: false.
MinFloatParameter probesIntensityGlobal probe intensity multiplier (each probe also has its own intensity). Default: 0.2.
BoolParameter fallbackReflectiveShadowMapUse reflective shadow map data from the main directional light on ray miss. Requires a RadiantShadowMap component on the directional light. Default: false.
ClampedFloatParameter reflectiveShadowMapIntensityIntensity multiplier for the reflective shadow map fallback (0–1). Default: 0.8.
ColorParameter fallbackDefaultAmbientDefault color used when all other fallbacks fail. Default: black.
Quality & Performance
ClampedFloatParameter downsamplingDownscales the input image for all render passes (1–4). 1 = full resolution. Default: 1.
ClampedIntParameter raytracerAccuracyRaytracer accuracy level (1–8). Lower values downscale the depth buffer for better GPU cache efficiency. Default: 8.
ClampedFloatParameter blurSpreadMultiplier for spatial blur spread. Increase to reduce flickering at lower resolutions (1–2). Default: 1.
Temporal Filter
ClampedIntParameter temporalStabilizationMaximum frames to accumulate in temporal history (6–16). Higher = more stable but may ghost. Default: 8.
FloatParameter temporalResponseSpeedHow fast the spatio-temporal filter reacts to screen changes. Lower = softer but more ghosting, higher = less smoothing. Default: 12.
MinFloatParameter darkThresholdBrightness threshold below which extra noise stabilization is applied. Default: 0.2.
MinFloatParameter darkThresholdMultiplierStability multiplier in dark areas. Higher = more stable darks. Default: 10.
Output & Brightness
MinFloatParameter sourceBrightnessBrightness of the original image. Reduce to make GI more visible. Default: 1.
FloatParameter brightnessThresholdMinimum brightness for a pixel to be considered as indirect light source. Default: 0.
FloatParameter brightnessMaxClamps the maximum brightness of the resulting GI contribution. Default: 8.
FloatParameter giWeightIncreases GI contribution vs source pixel color. Higher values reduce source pixel intensity based on received GI. Default: 0.
FloatParameter nearCameraAttenuationAttenuates GI brightness from nearby surfaces. Default: 0.
ClampedFloatParameter saturationColor saturation of the computed GI. 0 = grayscale (0–2). Default: 1.
Volume, Stencil & AO
BoolParameter limitToVolumeBoundsOnly apply GI within the boundaries of the current local volume. Useful for interior rooms. Default: false.
BoolParameter stencilCheckEnable stencil mask to exclude specific pixels from GI (e.g. UI, FPS weapons). Default: false.
IntParameter stencilValueStencil reference value for the stencil test. Default: 1.
CompareFunctionParameter stencilCompareFunctionComparison function for stencil testing. Default: NotEqual.
ClampedFloatParameter aoInfluenceHow much URP SSAO (or HBAO) influences indirect lighting (0–1). Default: 0.
ClampedFloatParameter occlusionIntensityIntensity of occlusion maps used to attenuate GI (0–1). Default: 0.5.
Transparency
BoolParameter transparencySupportInclude transparent objects in GI calculations. Choose by layer mask or add a RadiantTransparentSupport component to individual objects. Default: false.
LayerMaskParameter transparentLayerMaskWhich layers are considered transparent for GI. Default: 0 (none).
BoolParameter virtualEmittersEnable virtual emitter support. When enabled, RadiantVirtualEmitter components in the scene contribute indirect light. Default: false.
Debug & Compare
BoolParameter showInEditModeRender the effect while not in play mode (noisy without temporal reprojection). Default: true.
BoolParameter showInSceneViewRender the effect in the Scene View. Default: false.
BoolParameter compareModeShow a split-screen comparison of the scene with and without GI. Default: false.
ClampedFloatParameter comparePanningPanning position of the comparison line (0–0.5). Default: 0.25.
ClampedFloatParameter compareLineWidthWidth of the comparison line (0.0001–0.05). Default: 0.002.
DebugViewParameter debugViewSelects which debug buffer to visualize (None, Albedo, Normals, Depth, MotionVectors, Raycast, etc.). Default: None.
FloatParameter debugDepthMultiplierDepth values multiplier for the depth debug view. Default: 10.
FloatParameter debugMotionVectorMultiplierMotion vectors multiplier for the motion vectors debug view. Default: 1.
BoolParameter compareSameSideWhen enabled, shows the comparison on the same side instead of split screen. Default: false.
ClampedFloatParameter compareLineAngleAngle of the comparison line for split screen mode. Default: 1.4.
Selects which debug buffer to visualize (None, Albedo, Normals, Depth, MotionVectors, Raycast, RaycastAccumulated, Downscaled, ReflectiveShadowMap, TemporalAccumulationBuffer, FinalGI).
Multiplier for depth values in the depth debug view.
Multiplier for motion vectors in the motion vectors debug view.
When enabled, shows the comparison on the same side instead of split screen.
Angle of the comparison split line (-PI to PI).
Code Examples
Modify GI at Runtime
using UnityEngine.Rendering;
using RadiantGI.Universal;
var volume = GetComponent<Volume>();
if (volume.profile.TryGet<RadiantGlobalIllumination>(out var rgi)) {
// Increase indirect lighting
rgi.indirectIntensity.Override(2f);
rgi.rayCount.Override(2);
// Enable near field obscurance
rgi.nearFieldObscurance.Override(0.5f);
rgi.nearFieldObscuranceSpread.Override(0.3f);
// Enable organic light
rgi.organicLight.Override(0.4f);
rgi.organicLightTintColor.Override(Color.yellow);
}
Quality Presets
using UnityEngine.Rendering;
using RadiantGI.Universal;
void SetQuality(Volume volume, string quality) {
if (!volume.profile.TryGet<RadiantGlobalIllumination>(out var rgi)) return;
switch (quality) {
case "low":
rgi.rayCount.Override(1);
rgi.rayMaxSamples.Override(16);
rgi.downsampling.Override(2f);
rgi.raytracerAccuracy.Override(4);
break;
case "high":
rgi.rayCount.Override(2);
rgi.rayMaxSamples.Override(32);
rgi.downsampling.Override(1f);
rgi.raytracerAccuracy.Override(8);
break;
}
}Suggest an improvement
Help us improve this documentation page.