57 lines
2.9 KiB
C#
57 lines
2.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
namespace Ilumisoft.Rendering
|
|
{
|
|
[Serializable]
|
|
[DisplayInfo(name = "Outline")]
|
|
[VolumeComponentMenu("Post-processing/Outline")]
|
|
[VolumeRequiresRendererFeatures(typeof(OutlineRendererFeature))]
|
|
public class OutlineVolumeComponent : VolumeComponent
|
|
{
|
|
[Header("Outline Settings")]
|
|
[Tooltip("The width of the outline in pixels. A value of 0 will disable outlines.")]
|
|
public ClampedIntParameter thickness = new ClampedIntParameter(1, 0, 4);
|
|
|
|
[Tooltip("The color used for the outline.")]
|
|
public ColorParameter outlineColor = new ColorParameter(Color.black);
|
|
|
|
[Header("Edge Detection Sensitivity")]
|
|
[Tooltip("Depth sensitivity for edge detection. Defines the lower and upper threshold used in the smoothstep function. Smaller values make the effect more sensitive to depth differences.")]
|
|
public FloatRangeParameter depthSmoothstep = new FloatRangeParameter(new Vector2(0.1f, 0.2f), 0, 1);
|
|
|
|
[Tooltip("Normal sensitivity for edge detection. Defines the lower and upper threshold used in the smoothstep function. Smaller values make the effect more sensitive to surface angle changes.")]
|
|
public FloatRangeParameter normalSmoothstep = new FloatRangeParameter(new Vector2(0.2f, 0.7f), 0, 1);
|
|
|
|
[Header("Background Fill (Optional)")]
|
|
|
|
[Tooltip("Enable fill of the background color.")]
|
|
public BoolParameter backgroundFill = new BoolParameter(false);
|
|
|
|
[Tooltip("Optional background color fill. Only visible if 'Background Fill' is enabled.")]
|
|
public ColorParameter backgroundColor = new ColorParameter(Color.white);
|
|
|
|
[Tooltip("Controls how much detail from the original images luminance is preserved in the background fill. A value of 0 results in a flat fill, 1 keeps full luminance detail.")]
|
|
public ClampedFloatParameter luminanceDetail = new ClampedFloatParameter(1, 0, 1);
|
|
|
|
[Tooltip("Applies a contrast adjustment to the luminance before blending with the fill color. Higher values increase the brightness difference between dark and light areas.")]
|
|
public MinFloatParameter luminanceContrast = new MinFloatParameter(1, 0);
|
|
|
|
[Header("Distance-Based Fading")]
|
|
[Tooltip("Enable distance-based fading of the outline effect.")]
|
|
public BoolParameter distanceFade = new BoolParameter(false);
|
|
|
|
[Tooltip("The distance from the camera (in metres) at which outline fading begins. Only used if Distance Fade is enabled.")]
|
|
public MinFloatParameter fadeStart = new MinFloatParameter(0, 0);
|
|
|
|
[Tooltip("How far from the fade start point (in metres) the outlines will fully fade out. Only used if Distance Fade is enabled.")]
|
|
public MinFloatParameter fadeDistance = new MinFloatParameter(100, 0);
|
|
|
|
protected override void OnEnable()
|
|
{
|
|
base.OnEnable();
|
|
}
|
|
}
|
|
} |