Scripting Support (C#)
advanced scriptingEdge Fusion (URP) · Scripting Support (C#)
EdgeFusion. The main component is EdgeFusion (a VolumeComponent). Per-object overrides use EdgeFusionObject (MonoBehaviour).
Getting Started
Add using EdgeFusion; at the top of your script. Edge Fusion uses the URP Volume system. Use .Override(value) instead of setting .value directly — this sets both the value and overrideState = true, which is required for the Volume to apply the parameter.
using EdgeFusion;
using UnityEngine.Rendering;
Volume volume = FindObjectOfType<Volume>();
if (volume.profile.TryGet<EdgeFusion.EdgeFusion>(out var ef)) {
ef.intensity.Override(0.8f);
ef.radius.Override(0.02f);
}
EdgeFusion (Volume Component)
Layer Selection
LayerMaskParameter blendLayersDefault layers that participate in edge fusion blending.
RenderingLayerMaskParameter renderingLayerFilterRendering layer filter for single-sided objects selected by Blend Layers.
BoolParameter blendWithOthersWhen enabled, geometry not selected by any layer setting also blends with marked objects (default true).
LayerMaskParameter doubleSidedLayersLayers rendered double-sided in the ObjectID pass.
RenderingLayerMaskParameter doubleSidedRenderingLayerFilterRendering layer filter for double-sided selection.
LayerMaskParameter specialGroupLayersLayers for GameObjects with special vertex shaders that should also blend.
RenderingLayerMaskParameter specialGroupRenderingLayerFilterRendering layer filter for special group selection.
Effect Settings
ClampedFloatParameter intensityOverall intensity of the edge fusion effect (0–1).
ClampedFloatParameter radiusDefault blur radius in world units / meters (0.0001–0.5, default 0.035).
BoolParameter enableIntraObjectFusionEnable fusion of edges within the same object based on normal/depth discontinuities.
BoolParameter intraObjectFusionPerObjectWhen enabled, intra-object fusion only runs on renderers with an EdgeFusionObject component that allows it.
BoolParameter concavityTestWhen enabled, only fuse concave edges. When disabled, both concave and convex edges are fused.
ClampedFloatParameter normalThresholdNormal threshold for detecting edges within the same object (0.001–0.95, default 0.6). Only used when intra-object fusion is enabled.
ClampedFloatParameter shadowProtectionThreshold for shadow detection and blending adjustment (0–0.01, default 0.0002).
Quality
ClampedIntParameter sampleCountNumber of samples for edge detection (4–32, default 24).
BoolParameter jitterEnables temporal jitter to reduce banding artifacts.
FloatParameter maxBlendDistanceMaximum distance for edge blending (default 50).
ClampedIntParameter binarySearchStepsNumber of binary search refinement steps when locating the nearest edge (1–10, default 7).
ClampedIntParameter earlyExitHitsMax number of edge hits before early exit (1–32, default 5).
ClampedFloatParameter maxScreenRadiusMaximum screen-space search radius (0.01–0.5, default 0.1).
MinFloatParameter msaaEdgeFixPowerAdjusts color sampling to reduce MSAA edge artifacts. Only applicable with MSAA enabled.
Noise
ClampedFloatParameter noiseIntensityIntensity of the 3D noise texture applied to blending (0–1).
ClampedFloatParameter noiseScaleScale of the 3D noise texture sampling (0.1–10, default 5). Higher values produce finer noise.
ClampedFloatParameter noiseContrastContrast of the noise applied to edge positions (0–1, default 0.75).
ID Exclusions
IdExclusionPair[] idExclusionPairsPairs of custom Object IDs that should not blend with each other. IDs 1–30 are user-assignable, 31 = terrain/non-blend-layer objects, 32 = special group.
Debug & Compare
DebugModeParameter debugModeSelects debug visualization: None, ObjectIds, Edges, Blending, Normals, Depth, SpecialGroup.
ClampedFloatParameter depthDebugMultiplierDepth visualization multiplier for the Depth debug mode (0.01–100, default 1).
BoolParameter compareModeEnable A/B comparison with a split line.
BoolParameter compareSameSidePans the split line horizontally over the same side.
ClampedFloatParameter comparePanningHorizontal panning of the split line (0–0.5, default 0.25).
ClampedFloatParameter compareLineAngleAngle of the compare divider line (default 1.4).
ClampedFloatParameter compareLineWidthWidth of the compare divider line (0.0001–0.05, default 0.002).
ColorParameter compareLineColorColor of the compare divider line (default white).
Methods
bool IsActive()Returns true if any blend/double-sided/special layers are set and intensity > 0.
EdgeFusionObject (Per-Object Component)
Properties
bool overrideRadiusEnable a custom blend radius for this specific object.
float customRadiusCustom blend radius in meters (0–0.5, default 0.05). Set to 0 to disable blending for this object.
bool overrideObjectIdEnable a custom Object ID for this object.
int customObjectIdCustom Object ID. Objects with the same ID are considered the same for inter-object detection.
bool useRandomIdUse a random Object ID instead of one derived from object position.
bool randomIdPerChildAssign a different random ID to each child renderer.
bool disallowIntraObjectFusionDisable intra-object fusion for this object while keeping inter-object fusion.
IncludeMode includeModeWhether to include only this object or also its children: OnlyThisObject (default) or IncludeChildren.
LayerMask childLayerMaskLayer mask filter for child renderers when includeMode is IncludeChildren.
List<Renderer> renderers read-onlyList of renderers managed by this component.
Material nonInstancingMaterialIf set, indicates a material on the managed renderers that does not support GPU instancing.
Methods
void Refresh()Rebuild the renderer list and update material properties. Call after modifying component settings at runtime.
Code Examples
using EdgeFusion;
using UnityEngine.Rendering;
// Adjust global edge fusion settings via Volume
Volume volume = FindObjectOfType<Volume>();
if (volume.profile.TryGet<EdgeFusion.EdgeFusion>(out var ef)) {
ef.intensity.Override(1.0f);
ef.radius.Override(0.02f);
ef.sampleCount.Override(24);
ef.enableIntraObjectFusion.Override(true);
ef.noiseIntensity.Override(0.3f);
ef.noiseScale.Override(8f);
}
// Override radius for a specific object
EdgeFusionObject efo = myObject.AddComponent<EdgeFusionObject>();
efo.overrideRadius = true;
efo.customRadius = 0.05f;
efo.includeMode = IncludeMode.IncludeChildren;
efo.Refresh();Suggest an improvement
Help us improve this documentation page.