Scripting Support (C#)
advanced scriptingRadiant GI (Built-in) · Scripting Support (C#)
RadiantGlobalIllumination — a MonoBehaviour in the RadiantGI namespace. Attach it to the camera game object.
Getting Started
Add using RadiantGI; at the top of your script. Get the component from your camera:
using RadiantGI;
RadiantGlobalIllumination gi = Camera.main.GetComponent<RadiantGlobalIllumination>();
gi.indirectIntensity = 1.5f;
gi.rayCount = 2;
RadiantGlobalIllumination
Indirect Lighting
float indirectIntensityIntensity of the indirect lighting. Set to 0 to disable the effect.
float indirectMaxSourceBrightnessMaximum brightness of the indirect source (default 8).
float indirectDistanceAttenuationDistance attenuation applied to indirect lighting (0–1). Reduces indirect contribution at distance.
float normalMapInfluenceInfluence of the surface normal map when receiving indirect lighting (0–1, default 1).
float lumaInfluenceIn forward rendering, uses pixel luma to enhance results based on perceptual brightness. Set to 0 to disable.
bool includeForwardInclude forward rendering path materials that render in opaque queue when camera is rendering in deferred.
Near Field Obscurance (NFO)
float nearFieldObscuranceIntensity of the near field obscurance effect. Darkens surfaces occluded by other nearby surfaces.
float nearFieldObscuranceSpreadSpread / radius of the NFO effect (0.01–1, default 0.2).
float nearFieldObscuranceMaxCameraDistanceMaximum camera distance of the NFO effect (default 125).
float nearFieldObscuranceOccluderDistanceDistance threshold of the occluder (0–1, default 0.825).
Color nearFieldObscuranceTintColorTint color of the NFO effect (default black).
Organic Light
float organicLightIntensity of organic light (0–1). Injects procedural light variations into G-buffers for a more natural lit environment.
float organicLightThresholdThreshold of organic light noise calculation (0–1, default 0.5).
float organicLightSpreadOrganic light spread (0.9–1, default 0.98).
float organicLightNormalsInfluencePreserves normal map effect on textures under organic light (0–1, default 0.95).
Color organicLightTintColorTint color of organic light (default white).
Vector3 organicLightAnimationSpeedAnimation speed of the organic light pattern along each axis.
bool organicLightDistanceScalingReduces organic light pattern repetition at distance.
Ray Marching
int rayCountNumber of rays per pixel (1–4, default 1).
float rayMaxLengthMaximum ray length (default 8). Increasing may require more samples to maintain quality.
int rayMaxSamplesMaximum samples taken during ray march (default 32).
float rayJitterRandom offset added to ray direction to reduce banding. Useful with low sample counts.
float thicknessAssumed thickness for any geometry, used to determine if a ray crosses a surface (default 1).
bool rayBinarySearchImproves ray march accuracy by using binary search (default true).
bool rayBounceAdd one additional ray bounce for more accurate GI.
Fallback & Emitters
bool fallbackReuseRaysIf a ray misses a target, reuse rays from previous frames.
float rayReuseIntensity of the previous color used when a ray misses (0–1).
bool fallbackReflectionProbesIf a ray misses, use nearby reflection probes as fallback.
float probesIntensityGlobal probe intensity multiplier (default 1). Each probe also has its own intensity.
bool fallbackReflectiveShadowMapIf a ray misses, use reflective shadow map data from the main directional light. Requires RadiantShadowMap script on the light.
float reflectiveShadowMapIntensityIntensity of the reflective shadow map fallback (0–1, default 0.8).
bool virtualEmittersEnable user-defined light emitters in the scene.
Performance
float downsamplingReduces resolution of all GI stages (1–4, default 1). Higher values improve performance at the cost of quality.
int raytracerAccuracyRaytracing accuracy (1–8, default 8). Lower values shrink the depth buffer used during raytracing.
int smoothingNumber of extra blur passes (0–4, default 3).
NormalsQuality normalsQualityControls normals quality: High (default) or ApproximatedFromDepth.
Temporal Reprojection
bool temporalReprojectionUses motion vectors to blend into a history buffer to reduce flickering. Only applies in play mode (default true).
float temporalResponseSpeedReaction speed to screen changes (default 12). Higher values reduce ghosting but also smoothing.
float temporalCameraTranslationResponseReaction speed to camera position changes (default 100). Higher values reduce ghosting when the camera moves.
float temporalDepthRejectionDepth difference threshold to discard history buffer when reusing rays (default 1).
float temporalChromaThresholdAllowed color difference between history and current GI buffers (0–2, default 0.2).
Output
float brightnessThresholdComputes GI emitted by objects with a minimum luminosity.
float brightnessMaxMaximum GI brightness (default 8).
float specularContributionAmount of GI added to specular surfaces (0–1, default 0.5). Reduce to avoid overexposure of shiny materials.
float sourceBrightnessBrightness of the original image (0–2, default 1). Reduce to make GI more prominent.
float giWeightIncreases final GI contribution versus source color pixel. Higher values reduce source pixel intensity based on received GI.
float nearCameraAttenuationAttenuates GI brightness from nearby surfaces.
float saturationAdjusted color saturation for the computed GI (0–2, default 1).
Volume & Stencil
LayerMask volumeMaskUsed to filter which RadiantVolume should be used with this camera.
bool limitToVolumeBoundsApplies GI only inside the post-processing volume bounds. Use only if the volume is local.
bool stencilCheckEnables stencil check during GI composition. Lets you exclude GI over objects that use the stencil buffer.
int stencilValueStencil reference value used during the stencil check.
CompareFunction stencilCompareFunctionStencil comparison function (default NotEqual).
Debug & Compare
DebugView debugViewSelects debug visualization mode: None, Albedo, Normals, Specular, Depth, DownscaledHalf, DownscaledQuarter, UpscaleToHalf, Raycast, FinalGI, ReflectiveShadowMap, TemporalAccumulationBuffer.
float debugDepthMultiplierDepth values multiplier for the Depth debug view (default 10).
bool compareModeEnable split-screen comparison mode.
bool compareSameSideWhether the comparison shows on the same side.
float comparePanningPanning offset for the compare view (0–0.5, default 0.25).
float compareLineAngleAngle of the compare divider line (default 1.4).
float compareLineWidthWidth of the compare divider line (0.0001–0.05, default 0.002).
bool showInEditModeRenders the effect in edit mode when not in play mode (default true).
bool showInSceneViewRenders the effect in the Scene View (default true).
Static Members
static int computedGIRTIdentifier for the computed GI render texture.
static bool needRTRefreshSet to true to force render target refresh on the next frame.
static bool isRenderingInDeferredWhether the current camera is rendering in deferred mode.
Methods
bool IsActive()Returns true if indirectIntensity > 0 or compareMode is enabled.
static void RegisterReflectionProbe(ReflectionProbe probe)Registers a reflection probe for fallback use when rays miss.
static void UnregisterReflectionProbe(ReflectionProbe probe)Unregisters a previously registered reflection probe.
static void RegisterVirtualEmitter(RadiantVirtualEmitter emitter)Registers a virtual emitter for GI contribution.
static void UnregisterVirtualEmitter(RadiantVirtualEmitter emitter)Unregisters a virtual emitter.
static void RegisterVolume(RadiantVolume volume)Registers a RadiantVolume for this camera.
static void UnregisterVolume(RadiantVolume volume)Unregisters a RadiantVolume.
Code Examples
using RadiantGI;
// Get the component from camera
var gi = Camera.main.GetComponent<RadiantGlobalIllumination>();
// Enable indirect lighting
gi.indirectIntensity = 1.5f;
gi.rayCount = 2;
gi.rayMaxSamples = 48;
// Enable near field obscurance
gi.nearFieldObscurance = 0.5f;
gi.nearFieldObscuranceSpread = 0.3f;
// Enable organic light
gi.organicLight = 0.4f;
gi.organicLightTintColor = new Color(1f, 0.95f, 0.9f);
gi.organicLightAnimationSpeed = new Vector3(0.1f, 0.05f, 0.1f);
// Register a custom reflection probe
RadiantGlobalIllumination.RegisterReflectionProbe(myProbe);
// Register a virtual emitter
RadiantGlobalIllumination.RegisterVirtualEmitter(myEmitter);Suggest an improvement
Help us improve this documentation page.