Runtime API
The runtime API is available through the HTraceAO.Runtime assembly and is used by all supported render pipelines.
HTraceAOSettings
Namespace: IPGames.HTraceAO.Runtime.Data.Public
public class HTraceAOSettingsHTraceAOSettings exposes the profile currently used by HTrace AO.
| Member | Type | Access | Description |
|---|---|---|---|
ActiveProfile | HTraceAOProfile | get | Returns the active global profile, or null when no profile has been registered yet. |
SetActiveProfile(HTraceAOProfile profile) | void | Static | Sets the global profile used by HTrace AO. Pass null to clear the active profile. |
The runtime resource reference is internal. Assign a profile through the HTrace component in the Inspector, or replace the active profile at runtime with SetActiveProfile.
using IPGames.HTraceAO.Runtime.Data.Profile;
using IPGames.HTraceAO.Runtime.Data.Public;
using UnityEngine;
public sealed class HTraceAOProfileSwitcher : MonoBehaviour
{
[SerializeField] private HTraceAOProfile QualityProfile;
public void ApplyProfile()
{
HTraceAOSettings.SetActiveProfile(QualityProfile);
}
}SetActiveProfile changes the global reference immediately. An enabled pipeline component can register its serialized profile again during its lifecycle, and the URP Volume workflow rebuilds the active profile from the blended Volume settings.
using IPGames.HTraceAO.Runtime.Data.Profile;
using IPGames.HTraceAO.Runtime.Data.Public;
using IPGames.HTraceAO.Runtime.Globals;
using UnityEngine;
public sealed class HTraceAOQualityController : MonoBehaviour
{
public void ApplyHighQualityGTAO()
{
HTraceAOProfile profile = HTraceAOSettings.ActiveProfile;
if (profile == null)
return;
profile.GeneralSettings.AmbientOcclusionMode = AmbientOcclusionMode.GTAO;
profile.GeneralSettings.Intensity = 1.5f;
profile.GTAOSettings.Resolution = GTAOResolutionMode.Full;
profile.GTAOSettings.SliceCount = 4;
profile.GTAOSettings.StepCount = 32;
profile.GTAOSettings.Denoising = GTAODenoisingMode.SpatioTemporal;
}
}The URP Volume workflow rebuilds the active profile from the blended HTraceAOVolume. In that workflow, change the Volume parameters instead of writing the corresponding ActiveProfile fields. See Universal Render Pipeline.
HTraceAOProfile
Namespace: IPGames.HTraceAO.Runtime.Data.Profile
public class HTraceAOProfile : ScriptableObject| Field | Type | Description |
|---|---|---|
GeneralSettings | GeneralSettings | General mode, intensity, output, and pipeline-integration settings. |
SSAOSettings | SSAOSettings | SSAO visual, quality, masking, and debug settings. |
GTAOSettings | GTAOSettings | GTAO tracing, quality, masking, denoising, and debug settings. |
RTAOSettings | RTAOSettings | RTAO tracing, culling, denoising, and debug settings. |
DebugSettings | DebugSettings | Internal diagnostics exposed for development builds. These fields are not part of the stable gameplay-facing API. |
CopySettingsFrom(HTraceAOProfile) is an Editor-only utility and is unavailable in player builds.
GeneralSettings
Namespace: IPGames.HTraceAO.Runtime.Data.Public
| Member | Type | Range or values | Availability |
|---|---|---|---|
AmbientOcclusionMode | AmbientOcclusionMode | SSAO, GTAO, RTAO | RTAO is not available in the Built-in Render Pipeline integration. |
Intensity | float | 0–4 | All pipelines. The property clamps assigned values. |
DirectLightOcclusion | float | 0–1 | All pipelines. The property clamps assigned values. |
Fadeout | float | 0 disables fadeout; positive values are distances in meters | All pipelines. |
OutputDithering | bool | true, false | Used by the HDRP output path. |
OutputDitheringAnimate | bool | true, false | Used when output dithering is enabled. |
HBuffer | HBuffer | Multi, Depth, Normal, MotionMask, MotionVectors | Selects the buffer shown by a main-buffers debug mode. |
InjectionPoint | URPInjectionPoint | BeforeOpaque, BeforeLighting, AfterOpaque | Available in URP. |
ReconstructNormals | bool | true, false | Available in URP. |
Changing AmbientOcclusionMode at runtime is supported. URP recreates the required render-pass set when the mode changes; HDRP enables the matching custom pass.
SSAOSettings
Namespace: IPGames.HTraceAO.Runtime.Data.Public
| Member | Type | Range or values | Notes |
|---|---|---|---|
DebugModeSSAO | DebugModeSSAO | None, Depth, AmbientOcclusion | Selects the SSAO debug output. |
Thickness | float | 0–1 | The property clamps assigned values. |
Radius | int | 1–4 | The property clamps assigned values. |
ExcludeCasting | RenderingLayerMask | Any rendering-layer mask | Available on Unity 2023.3 or newer. |
ExcludeReceiving | RenderingLayerMask | Any rendering-layer mask | Available on Unity 2023.3 or newer. |
ExcludedIntensity | float | 0–1 | AO strength on excluded receivers. |
GTAOSettings
Namespace: IPGames.HTraceAO.Runtime.Data.Public
Tracing and Quality
| Member | Type | Range or values | Description |
|---|---|---|---|
DebugMode | DebugModeGTAO | None, MainBuffers, AmbientOcclusion, TemporalDisocclusion | Selects the GTAO debug output. |
Thickness | float | 0.05–1 | Virtual object thickness. |
WorldSpaceRadius | float | 0.1–5 | Maximum occluder-search distance in meters. |
ScreenSpaceRadius | int | 1–256 | Minimum search coverage in screen pixels. |
SliceCount | int | 1–4 | Number of tracing directions. |
StepCount | int | 8–32 | Number of steps per direction. |
Resolution | GTAOResolutionMode | Full, Half, Quarter | GTAO rendering resolution. |
TracingMode | GTAOTracingMode | HorizonSearch, VisibilityBitmasks | Occlusion evaluation algorithm. |
DepthFormat | GTAODepthFormat | R16 | Internal GTAO depth precision. |
ThicknessMode | GTAOThicknessMode | Linear, Uniform | Used by Visibility Bitmasks. |
UseAttenuation | bool | true, false | Enables distance attenuation during evaluation. |
VisibilityBitmasks | bool | Read-only | Returns whether TracingMode is VisibilityBitmasks. |
Denoising
| Member | Type | Range or values | Description |
|---|---|---|---|
Denoising | GTAODenoisingMode | None, SpatialOnly, TemporalOnly, SpatioTemporal | Selects the enabled denoising stages. |
UseSimpleRejection | bool | true, false | Uses the simpler temporal history-rejection path. |
TemporalRejection | float | 0–1 | Temporal rejection strength. |
SampleCountTemporal | int | 0–12 | Number of temporally accumulated samples. |
ReprojectionFilter | ReprojectionFilter | Linear, Bicubic | Temporal-history sampling filter. |
UseNormalWeightingTemporal | bool | true, false | Uses normal differences during reprojection. |
SpatialFilterType | SpatialFilterType | Disk, Box | Spatial filter implementation. |
FilterRadius | float | 0–1 input | Normalized disk-filter radius. The getter returns the internal remapped radius. |
FilterAdaptivity | float | 0–1 | Reduces filtering in high-contrast occluded areas. |
BoxPassCount | int | 1–3 | Number of box-filter passes. |
DoubleSampleCount | bool | true, false | Doubles spatial-filter sample taps. |
Rendering-layer Masks
The following members are available on Unity 2023.3 or newer.
| Member | Type | Range | Description |
|---|---|---|---|
ExcludeCasting | RenderingLayerMask | Any rendering-layer mask | Excludes matching renderers from casting GTAO. |
ExcludeReceiving | RenderingLayerMask | Any rendering-layer mask | Excludes matching renderers from receiving GTAO. |
EarlyOutExcludedReceivers | bool | true, false | Skips work for excluded receivers. |
ExcludedIntensity | float | 0–1 | GTAO strength on excluded receivers. |
RTAOSettings
Namespace: IPGames.HTraceAO.Runtime.Data.Public
RTAO requires a supported Unity version, graphics API, and ray-tracing-capable device. The class can still be present in assemblies where the mode itself is unavailable; check the current pipeline requirements before selecting it.
Tracing and Quality
| Member | Type | Range or values | Description |
|---|---|---|---|
DebugMode | DebugModeRTAO | None, MainBuffers, AmbientOcclusion, TemporalDisocclusion, ShadingRateVisualization, HardwareRayTracingScene | Selects the RTAO debug output. |
DebugSceneMismatch | bool | true, false | Highlights raster/ray-tracing scene mismatches in the RTAS debug view. |
WorldSpaceRadius | float | 0.1–5 | Maximum ray length in meters. |
MaxRayBias | float | 0.001–0.05 | Maximum ray origin offset. |
SpecularOcclusion | float | 0–1 | Used by HDRP native RTAO integration. |
TracingMode | TracingMode | NativeRayTracing, InlineRayTracing | Both modes are available in supported HDRP versions. URP uses inline ray tracing. |
RayCount | int | 1–8 | Rays traced per evaluated pixel. |
SampleRebalancing | bool | true, false | Stochastically redistributes ray work. |
CullBackfaces | bool | true, false | Excludes backfacing triangles from inline ray hits. |
CullAlphaCutout | bool | true, false | Excludes alpha-cutout geometry from HTrace's RTAS. |
CullingMask | LayerMask | Any Unity layer mask | Excludes layers from HTrace's RTAS. |
Resolution | ResolutionMode | Full, Half, Quarter, Adaptive | RTAO rendering resolution. |
Screen-space Pretrace and RTAS Culling
| Member | Type | Range or values | Description |
|---|---|---|---|
ScreenSpacePretrace | bool | true, false | Traces screen-space depth before hardware ray tracing. |
PretraceMask | RenderingLayerMask | Any rendering-layer mask | Available on Unity 2023.3 or newer. |
PretraceSamples | int | 8–24 | Screen-space ray-march step count. |
PretraceDistance | float | 0.1–1 | Maximum screen-space pretrace distance in meters. |
PretraceThickness | float | 0.05–1 | Virtual depth thickness used by pretracing. |
CullingMode | CullingMode | None, Sphere, SolidAngle | HTrace RTAS culling method. |
CullingDistance | float | 1–10000 | Sphere-culling distance. |
MinSolidAngle | float | 0.01–180 | Solid-angle culling threshold. |
Denoising
| Member | Type | Range or values | Description |
|---|---|---|---|
Denoising | RTAODenoisingMode | None, SinglePass, DoublePass | Selects the spatial/temporal denoising path. |
SampleCountTemporal | int | 8–16 | Number of temporally accumulated samples. |
StaticRejection | float | 0–1 | Rejection strength for static occlusion on moving receivers. |
DynamicRejection | float | 0–1 | Rejection strength for occlusion cast by moving objects. |
ReprojectionFilter | ReprojectionFilter | Linear, Bicubic | Temporal-history sampling filter. |
UseNormalWeightingTemporal | bool | true, false | Uses normal differences during reprojection. |
DisocclusionBoost | bool | true, false | Adds samples in areas without valid history. |
FilterRadius | float | 0–1 input | Normalized spatial-filter radius. The getter returns the internal remapped radius. |
ContactOcclusion | float | 0–1 | Strength of the short-range contact pass. |
ContactOcclusionDenoise | bool | true, false | Denoises contact occlusion. |
ExcludeReceiving | RenderingLayerMask | Any rendering-layer mask | Available on Unity 2023.2 or newer. |
EarlyOutExcludedReceivers | bool | true, false | Available on Unity 2023.2 or newer. |
ExcludedIntensity | float | 0–1 | RTAO strength on excluded receivers. |
Runtime Safety
- Read
ActiveProfileonly after the pipeline-specific HTrace component has enabled. - Treat the active profile as a single global settings source. Multiple enabled HTrace components can replace the global reference with whichever component registers last.
- Prefer changing existing settings objects. Do not replace
GeneralSettings,GTAOSettings,RTAOSettings, orSSAOSettingswhile a frame is rendering. - Properties with documented ranges clamp assigned values. Public fields such as
Fadeoutand enum fields do not perform validation. - Select a non-debug mode before shipping. Debug modes replace or alter the visible output.