feat: added htrace
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
using System;
|
||||
using HTraceSSGI.Scripts.Globals;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Public
|
||||
{
|
||||
[Serializable]
|
||||
public class DebugSettings
|
||||
{
|
||||
public bool ShowBowels = false;
|
||||
public bool ShowFullDebugLog = false;
|
||||
public LayerMask HTraceLayer = ~0;
|
||||
|
||||
public bool TestCheckBox1;
|
||||
public bool TestCheckBox2;
|
||||
public bool TestCheckBox3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b9df31ca246dfc47be48062d77712a0
|
||||
timeCreated: 1734159459
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/DebugSettings.cs
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,122 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
using System;
|
||||
using HTraceSSGI.Scripts.Extensions;
|
||||
using HTraceSSGI.Scripts.Globals;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Public
|
||||
{
|
||||
[Serializable]
|
||||
public class DenoisingSettings
|
||||
{
|
||||
// ----------------------------------------------- DENOISING -----------------------------------------------
|
||||
|
||||
[SerializeField]
|
||||
public BrightnessClamp BrightnessClamp = BrightnessClamp.Automatic;
|
||||
|
||||
[SerializeField]
|
||||
private float _maxValueBrightnessClamp
|
||||
= 1.0f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[1.0;30.0]</value>
|
||||
[HExtensions.HRangeAttribute(1.0f,30.0f)]
|
||||
public float MaxValueBrightnessClamp
|
||||
{
|
||||
get => _maxValueBrightnessClamp;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _maxValueBrightnessClamp) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_maxValueBrightnessClamp = HExtensions.Clamp(value, typeof(DenoisingSettings), nameof(DenoisingSettings.MaxValueBrightnessClamp));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _maxDeviationBrightnessClamp
|
||||
= 3.0f;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[1.0;5.0]</value>
|
||||
[HExtensions.HRangeAttribute(1.0f,5.0f)]
|
||||
public float MaxDeviationBrightnessClamp
|
||||
{
|
||||
get => _maxDeviationBrightnessClamp;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _maxDeviationBrightnessClamp) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_maxDeviationBrightnessClamp = HExtensions.Clamp(value, typeof(DenoisingSettings), nameof(DenoisingSettings.MaxDeviationBrightnessClamp));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------- ReSTIR Validation -----------------------------------------------
|
||||
|
||||
[SerializeField]
|
||||
public bool HalfStepValidation = false;
|
||||
|
||||
[SerializeField]
|
||||
public bool SpatialOcclusionValidation = true;
|
||||
|
||||
[SerializeField]
|
||||
public bool TemporalLightingValidation = true;
|
||||
|
||||
[SerializeField]
|
||||
public bool TemporalOcclusionValidation = true;
|
||||
|
||||
|
||||
// ----------------------------------------------- Spatial -----------------------------------------------
|
||||
|
||||
[SerializeField]
|
||||
private float _spatialRadius = 0.6f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float SpatialRadius
|
||||
{
|
||||
get => _spatialRadius;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _spatialRadius) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_spatialRadius = HExtensions.Clamp(value, typeof(DenoisingSettings), nameof(DenoisingSettings.SpatialRadius));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _adaptivity = 0.9f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float Adaptivity
|
||||
{
|
||||
get => _adaptivity;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _adaptivity) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_adaptivity = HExtensions.Clamp(value, typeof(DenoisingSettings), nameof(DenoisingSettings.Adaptivity));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
public bool RecurrentBlur = false;
|
||||
|
||||
[SerializeField]
|
||||
public bool FireflySuppression = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 360288ad30824b8eaa4113b727ffb011
|
||||
timeCreated: 1741602380
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/DenoisingSettings.cs
|
||||
uploadId: 840002
|
||||
129
Assets/Plugins/HTraceSSGI/Scripts/Data/Public/GeneralSettings.cs
Normal file
129
Assets/Plugins/HTraceSSGI/Scripts/Data/Public/GeneralSettings.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
using System;
|
||||
using HTraceSSGI.Scripts.Extensions;
|
||||
using UnityEngine;
|
||||
using HTraceSSGI.Scripts.Globals;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Public
|
||||
{
|
||||
[Serializable]
|
||||
public class GeneralSettings
|
||||
{
|
||||
public DebugMode DebugMode = DebugMode.None;
|
||||
public HBuffer HBuffer = HBuffer.Multi;
|
||||
|
||||
[SerializeField]
|
||||
public bool MetallicIndirectFallback = false;
|
||||
[SerializeField]
|
||||
public bool AmbientOverride = true;
|
||||
|
||||
public bool Multibounce = true;
|
||||
|
||||
#if UNITY_2023_3_OR_NEWER
|
||||
public RenderingLayerMask ExcludeCastingMask = 0;
|
||||
public RenderingLayerMask ExcludeReceivingMask = 0;
|
||||
#endif
|
||||
|
||||
[SerializeField]
|
||||
public FallbackType FallbackType = FallbackType.None;
|
||||
|
||||
[SerializeField]
|
||||
private float _skyIntensity = 0.5f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float SkyIntensity
|
||||
{
|
||||
get => _skyIntensity;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _skyIntensity) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_skyIntensity = HExtensions.Clamp(value, typeof(GeneralSettings), nameof(GeneralSettings.SkyIntensity));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _viewBias = 0.0f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;2.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,2.0f)]
|
||||
public float ViewBias
|
||||
{
|
||||
get => _viewBias;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _viewBias) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_viewBias = HExtensions.Clamp(value, typeof(GeneralSettings), nameof(GeneralSettings.ViewBias));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _normalBias = 0.33f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;4.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,2.0f)]
|
||||
public float NormalBias
|
||||
{
|
||||
get => _normalBias;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _normalBias) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_normalBias = HExtensions.Clamp(value, typeof(GeneralSettings), nameof(GeneralSettings.NormalBias));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _samplingNoise = 0.1f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float SamplingNoise
|
||||
{
|
||||
get => _samplingNoise;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _samplingNoise) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_samplingNoise = HExtensions.Clamp(value, typeof(GeneralSettings), nameof(GeneralSettings.SamplingNoise));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _intensityMultiplier = 1f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float IntensityMultiplier
|
||||
{
|
||||
get => _intensityMultiplier;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _intensityMultiplier) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_intensityMultiplier = HExtensions.Clamp(value, typeof(GeneralSettings), nameof(GeneralSettings.IntensityMultiplier));
|
||||
}
|
||||
}
|
||||
|
||||
public bool DenoiseFallback = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4af08f11ccfe6994a994a99e74d35b5f
|
||||
timeCreated: 1674799588
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/GeneralSettings.cs
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,246 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
using HTraceSSGI.Scripts.Data.Private;
|
||||
using HTraceSSGI.Scripts.Editor;
|
||||
using HTraceSSGI.Scripts.Globals;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using HTraceSSGI.Scripts.Infrastructure.URP;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Public
|
||||
{
|
||||
internal static class HTraceSSGIPresetData
|
||||
{
|
||||
public static void ApplyPresetVolume(HTraceSSGIVolumeEditorURP hTraceSSGIVolumeEditorUrp, HTraceSSGIPreset preset)
|
||||
{
|
||||
var stack = VolumeManager.instance.stack;
|
||||
HTraceSSGIVolume volume = stack?.GetComponent<HTraceSSGIVolume>();
|
||||
if (volume == null) return;
|
||||
|
||||
HTraceSSGIProfile profile = CreatePresetProfile(HTraceSSGISettings.ActiveProfile, preset);
|
||||
if (profile == null) return;
|
||||
|
||||
// General Settings
|
||||
hTraceSSGIVolumeEditorUrp.p_DebugMode.value.enumValueIndex = (int)profile.GeneralSettings.DebugMode;
|
||||
hTraceSSGIVolumeEditorUrp.p_DebugMode.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_FallbackType.value.enumValueIndex = (int)profile.GeneralSettings.FallbackType;
|
||||
hTraceSSGIVolumeEditorUrp.p_FallbackType.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_SkyIntensity.value.floatValue = profile.GeneralSettings.SkyIntensity;
|
||||
hTraceSSGIVolumeEditorUrp.p_SkyIntensity.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_DenoiseFallback.value.boolValue = profile.GeneralSettings.DenoiseFallback;
|
||||
hTraceSSGIVolumeEditorUrp.p_DenoiseFallback.overrideState.boolValue = true;
|
||||
|
||||
// Visuals
|
||||
hTraceSSGIVolumeEditorUrp.p_BackfaceLighting.value.floatValue = profile.SSGISettings.BackfaceLighting;
|
||||
hTraceSSGIVolumeEditorUrp.p_BackfaceLighting.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_MaxRayLength.value.floatValue = profile.SSGISettings.MaxRayLength;
|
||||
hTraceSSGIVolumeEditorUrp.p_MaxRayLength.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_ThicknessMode.value.enumValueIndex = (int)profile.SSGISettings.ThicknessMode;
|
||||
hTraceSSGIVolumeEditorUrp.p_ThicknessMode.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_Thickness.value.floatValue = profile.SSGISettings.Thickness;
|
||||
hTraceSSGIVolumeEditorUrp.p_Thickness.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_Falloff.value.floatValue = profile.SSGISettings.Falloff;
|
||||
hTraceSSGIVolumeEditorUrp.p_Falloff.overrideState.boolValue = true;
|
||||
|
||||
// Quality - Tracing
|
||||
hTraceSSGIVolumeEditorUrp.p_RayCount.value.intValue = profile.SSGISettings.RayCount;
|
||||
hTraceSSGIVolumeEditorUrp.p_RayCount.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_StepCount.value.intValue = profile.SSGISettings.StepCount;
|
||||
hTraceSSGIVolumeEditorUrp.p_StepCount.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_RefineIntersection.value.boolValue = profile.SSGISettings.RefineIntersection;
|
||||
hTraceSSGIVolumeEditorUrp.p_RefineIntersection.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_FullResolutionDepth.value.boolValue = profile.SSGISettings.FullResolutionDepth;
|
||||
hTraceSSGIVolumeEditorUrp.p_FullResolutionDepth.overrideState.boolValue = true;
|
||||
|
||||
// Quality - Rendering
|
||||
hTraceSSGIVolumeEditorUrp.p_Checkerboard.value.boolValue = profile.SSGISettings.Checkerboard;
|
||||
hTraceSSGIVolumeEditorUrp.p_Checkerboard.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_RenderScale.value.floatValue = profile.SSGISettings.RenderScale;
|
||||
hTraceSSGIVolumeEditorUrp.p_RenderScale.overrideState.boolValue = true;
|
||||
|
||||
// Denoising
|
||||
hTraceSSGIVolumeEditorUrp.p_BrightnessClamp.value.enumValueIndex = (int)profile.DenoisingSettings.BrightnessClamp;
|
||||
hTraceSSGIVolumeEditorUrp.p_BrightnessClamp.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_MaxValueBrightnessClamp.value.floatValue = profile.DenoisingSettings.MaxValueBrightnessClamp;
|
||||
hTraceSSGIVolumeEditorUrp.p_MaxValueBrightnessClamp.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_MaxDeviationBrightnessClamp.value.floatValue = profile.DenoisingSettings.MaxDeviationBrightnessClamp;
|
||||
hTraceSSGIVolumeEditorUrp.p_MaxDeviationBrightnessClamp.overrideState.boolValue = true;
|
||||
|
||||
// Denoising - Temporal Validation
|
||||
hTraceSSGIVolumeEditorUrp.p_HalfStepValidation.value.boolValue = profile.DenoisingSettings.HalfStepValidation;
|
||||
hTraceSSGIVolumeEditorUrp.p_HalfStepValidation.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_SpatialOcclusionValidation.value.boolValue = profile.DenoisingSettings.SpatialOcclusionValidation;
|
||||
hTraceSSGIVolumeEditorUrp.p_SpatialOcclusionValidation.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_TemporalLightingValidation.value.boolValue = profile.DenoisingSettings.TemporalLightingValidation;
|
||||
hTraceSSGIVolumeEditorUrp.p_TemporalLightingValidation.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_TemporalOcclusionValidation.value.boolValue = profile.DenoisingSettings.TemporalOcclusionValidation;
|
||||
hTraceSSGIVolumeEditorUrp.p_TemporalOcclusionValidation.overrideState.boolValue = true;
|
||||
|
||||
// Denoising - Spatial Filter
|
||||
hTraceSSGIVolumeEditorUrp.p_SpatialRadius.value.floatValue = profile.DenoisingSettings.SpatialRadius;
|
||||
hTraceSSGIVolumeEditorUrp.p_SpatialRadius.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_Adaptivity.value.floatValue = profile.DenoisingSettings.Adaptivity;
|
||||
hTraceSSGIVolumeEditorUrp.p_Adaptivity.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_RecurrentBlur.value.boolValue = profile.DenoisingSettings.RecurrentBlur;
|
||||
hTraceSSGIVolumeEditorUrp.p_RecurrentBlur.overrideState.boolValue = true;
|
||||
|
||||
hTraceSSGIVolumeEditorUrp.p_FireflySuppression.value.boolValue = profile.DenoisingSettings.FireflySuppression;
|
||||
hTraceSSGIVolumeEditorUrp.p_FireflySuppression.overrideState.boolValue = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a profile from the specified preset type.
|
||||
/// </summary>
|
||||
public static HTraceSSGIProfile CreatePresetProfile(HTraceSSGIProfile activeProfile, HTraceSSGIPreset preset)
|
||||
{
|
||||
switch (preset)
|
||||
{
|
||||
case HTraceSSGIPreset.Performance:
|
||||
return CreatePerformancePreset(activeProfile);
|
||||
case HTraceSSGIPreset.Optimized:
|
||||
return CreateOptimizedPreset(activeProfile);
|
||||
case HTraceSSGIPreset.Balanced:
|
||||
return CreateBalancedPreset(activeProfile);
|
||||
case HTraceSSGIPreset.Quality:
|
||||
return CreateQualityPreset(activeProfile);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static HTraceSSGIProfile CreatePerformancePreset(HTraceSSGIProfile activeProfile)
|
||||
{
|
||||
var profile = Object.Instantiate(activeProfile);
|
||||
|
||||
// Tracing
|
||||
profile.SSGISettings.RayCount = 2;
|
||||
profile.SSGISettings.StepCount = 28;
|
||||
profile.SSGISettings.RefineIntersection = false;
|
||||
profile.SSGISettings.FullResolutionDepth = false;
|
||||
|
||||
// Rendering
|
||||
profile.SSGISettings.Checkerboard = true;
|
||||
profile.SSGISettings.RenderScale = 0.5f;
|
||||
|
||||
// ReSTIR Validation
|
||||
profile.DenoisingSettings.HalfStepValidation = true;
|
||||
profile.DenoisingSettings.SpatialOcclusionValidation = true;
|
||||
profile.DenoisingSettings.TemporalLightingValidation = false;
|
||||
profile.DenoisingSettings.TemporalOcclusionValidation = false;
|
||||
|
||||
// Spatial Filter
|
||||
profile.DenoisingSettings.SpatialRadius = 0.65f;
|
||||
profile.DenoisingSettings.Adaptivity = 0.7f;
|
||||
profile.DenoisingSettings.RecurrentBlur = true;
|
||||
profile.DenoisingSettings.FireflySuppression = false;
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
public static HTraceSSGIProfile CreateOptimizedPreset(HTraceSSGIProfile activeProfile)
|
||||
{
|
||||
var profile = Object.Instantiate(activeProfile);
|
||||
|
||||
// Tracing
|
||||
profile.SSGISettings.RayCount = 3;
|
||||
profile.SSGISettings.StepCount = 30;
|
||||
profile.SSGISettings.RefineIntersection = true;
|
||||
profile.SSGISettings.FullResolutionDepth = false;
|
||||
|
||||
// Rendering
|
||||
profile.SSGISettings.Checkerboard = true;
|
||||
profile.SSGISettings.RenderScale = 0.75f;
|
||||
|
||||
// ReSTIR Validation
|
||||
profile.DenoisingSettings.HalfStepValidation = true;
|
||||
profile.DenoisingSettings.SpatialOcclusionValidation = true;
|
||||
profile.DenoisingSettings.TemporalLightingValidation = true;
|
||||
profile.DenoisingSettings.TemporalOcclusionValidation = true;
|
||||
|
||||
// Spatial Filter
|
||||
profile.DenoisingSettings.SpatialRadius = 0.6f;
|
||||
profile.DenoisingSettings.Adaptivity = 0.8f;
|
||||
profile.DenoisingSettings.RecurrentBlur = true;
|
||||
profile.DenoisingSettings.FireflySuppression = true;
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
public static HTraceSSGIProfile CreateBalancedPreset(HTraceSSGIProfile activeProfile)
|
||||
{
|
||||
var profile = Object.Instantiate(activeProfile);
|
||||
|
||||
// Tracing
|
||||
profile.SSGISettings.RayCount = 3;
|
||||
profile.SSGISettings.StepCount = 32;
|
||||
profile.SSGISettings.RefineIntersection = true;
|
||||
profile.SSGISettings.FullResolutionDepth = true;
|
||||
|
||||
// Rendering
|
||||
profile.SSGISettings.Checkerboard = true;
|
||||
profile.SSGISettings.RenderScale = 1.0f;
|
||||
|
||||
// ReSTIR Validation
|
||||
profile.DenoisingSettings.HalfStepValidation = true;
|
||||
profile.DenoisingSettings.SpatialOcclusionValidation = true;
|
||||
profile.DenoisingSettings.TemporalLightingValidation = true;
|
||||
profile.DenoisingSettings.TemporalOcclusionValidation = true;
|
||||
|
||||
// Spatial Filter
|
||||
profile.DenoisingSettings.SpatialRadius = 0.6f;
|
||||
profile.DenoisingSettings.Adaptivity = 0.9f;
|
||||
profile.DenoisingSettings.RecurrentBlur = false;
|
||||
profile.DenoisingSettings.FireflySuppression = true;
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
public static HTraceSSGIProfile CreateQualityPreset(HTraceSSGIProfile activeProfile)
|
||||
{
|
||||
var profile = Object.Instantiate(activeProfile);
|
||||
|
||||
// Tracing
|
||||
profile.SSGISettings.RayCount = 4;
|
||||
profile.SSGISettings.StepCount = 36;
|
||||
profile.SSGISettings.RefineIntersection = true;
|
||||
profile.SSGISettings.FullResolutionDepth = true;
|
||||
|
||||
// Rendering
|
||||
profile.SSGISettings.Checkerboard = false;
|
||||
profile.SSGISettings.RenderScale = 1.0f;
|
||||
|
||||
// ReSTIR Validation
|
||||
profile.DenoisingSettings.HalfStepValidation = false;
|
||||
profile.DenoisingSettings.SpatialOcclusionValidation = true;
|
||||
profile.DenoisingSettings.TemporalLightingValidation = true;
|
||||
profile.DenoisingSettings.TemporalOcclusionValidation = true;
|
||||
|
||||
// Spatial Filter
|
||||
profile.DenoisingSettings.SpatialRadius = 0.6f;
|
||||
profile.DenoisingSettings.Adaptivity = 0.9f;
|
||||
profile.DenoisingSettings.RecurrentBlur = false;
|
||||
profile.DenoisingSettings.FireflySuppression = true;
|
||||
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a3e4f1b8c9d2a5e6f0b1c2d3e4f5a6b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/HTraceSSGIPresetData.cs
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,91 @@
|
||||
using HTraceSSGI.Scripts.Data.Public;
|
||||
using HTraceSSGI.Scripts.Editor;
|
||||
using HTraceSSGI.Scripts.Globals;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Private
|
||||
{
|
||||
[CreateAssetMenu(fileName = "HTraceSSGI Profile", menuName = "HTrace/SSGI Profile", order = 251)]
|
||||
[HelpURL(HNames.HTRACE_SSGI_DOCUMENTATION_LINK)]
|
||||
public class HTraceSSGIProfile : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
public GeneralSettings GeneralSettings = new GeneralSettings();
|
||||
[SerializeField]
|
||||
public SSGISettings SSGISettings = new SSGISettings();
|
||||
[SerializeField]
|
||||
public DenoisingSettings DenoisingSettings = new DenoisingSettings();
|
||||
[SerializeField]
|
||||
public DebugSettings DebugSettings = new DebugSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Applies a preset configuration to this profile.
|
||||
/// This will overwrite all current settings with the preset values.
|
||||
/// </summary>
|
||||
/// <param name="preset">The preset type to apply</param>
|
||||
public void ApplyPreset(HTraceSSGIPreset preset)
|
||||
{
|
||||
var presetProfile = HTraceSSGIPresetData.CreatePresetProfile(this, preset);
|
||||
if (presetProfile == null)
|
||||
return;
|
||||
|
||||
// Copy all settings from preset profile
|
||||
CopySettingsFrom(presetProfile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies all settings from another profile to this profile.
|
||||
/// </summary>
|
||||
/// <param name="sourceProfile">The profile to copy settings from</param>
|
||||
public void CopySettingsFrom(HTraceSSGIProfile sourceProfile)
|
||||
{
|
||||
if (sourceProfile == null)
|
||||
return;
|
||||
|
||||
// Copy General Settings
|
||||
GeneralSettings.DebugMode = sourceProfile.GeneralSettings.DebugMode;
|
||||
GeneralSettings.HBuffer = sourceProfile.GeneralSettings.HBuffer;
|
||||
GeneralSettings.MetallicIndirectFallback = sourceProfile.GeneralSettings.MetallicIndirectFallback;
|
||||
GeneralSettings.AmbientOverride = sourceProfile.GeneralSettings.AmbientOverride;
|
||||
GeneralSettings.Multibounce = sourceProfile.GeneralSettings.Multibounce;
|
||||
#if UNITY_2023_3_OR_NEWER
|
||||
GeneralSettings.ExcludeCastingMask = sourceProfile.GeneralSettings.ExcludeCastingMask;
|
||||
GeneralSettings.ExcludeReceivingMask = sourceProfile.GeneralSettings.ExcludeReceivingMask;
|
||||
#endif
|
||||
GeneralSettings.FallbackType = sourceProfile.GeneralSettings.FallbackType;
|
||||
GeneralSettings.SkyIntensity = sourceProfile.GeneralSettings.SkyIntensity;
|
||||
GeneralSettings.ViewBias = sourceProfile.GeneralSettings.ViewBias;
|
||||
GeneralSettings.NormalBias = sourceProfile.GeneralSettings.NormalBias;
|
||||
GeneralSettings.SamplingNoise = sourceProfile.GeneralSettings.SamplingNoise;
|
||||
GeneralSettings.IntensityMultiplier = sourceProfile.GeneralSettings.IntensityMultiplier;
|
||||
GeneralSettings.DenoiseFallback = sourceProfile.GeneralSettings.DenoiseFallback;
|
||||
|
||||
// Copy SSGI Settings
|
||||
SSGISettings.BackfaceLighting = sourceProfile.SSGISettings.BackfaceLighting;
|
||||
SSGISettings.MaxRayLength = sourceProfile.SSGISettings.MaxRayLength;
|
||||
SSGISettings.ThicknessMode = sourceProfile.SSGISettings.ThicknessMode;
|
||||
SSGISettings.Thickness = sourceProfile.SSGISettings.Thickness;
|
||||
SSGISettings.Intensity = sourceProfile.SSGISettings.Intensity;
|
||||
SSGISettings.Falloff = sourceProfile.SSGISettings.Falloff;
|
||||
SSGISettings.RayCount = sourceProfile.SSGISettings.RayCount;
|
||||
SSGISettings.StepCount = sourceProfile.SSGISettings.StepCount;
|
||||
SSGISettings.RefineIntersection = sourceProfile.SSGISettings.RefineIntersection;
|
||||
SSGISettings.FullResolutionDepth = sourceProfile.SSGISettings.FullResolutionDepth;
|
||||
SSGISettings.Checkerboard = sourceProfile.SSGISettings.Checkerboard;
|
||||
SSGISettings.RenderScale = sourceProfile.SSGISettings.RenderScale;
|
||||
|
||||
// Copy Denoising Settings
|
||||
DenoisingSettings.BrightnessClamp = sourceProfile.DenoisingSettings.BrightnessClamp;
|
||||
DenoisingSettings.MaxValueBrightnessClamp = sourceProfile.DenoisingSettings.MaxValueBrightnessClamp;
|
||||
DenoisingSettings.MaxDeviationBrightnessClamp = sourceProfile.DenoisingSettings.MaxDeviationBrightnessClamp;
|
||||
DenoisingSettings.HalfStepValidation = sourceProfile.DenoisingSettings.HalfStepValidation;
|
||||
DenoisingSettings.SpatialOcclusionValidation = sourceProfile.DenoisingSettings.SpatialOcclusionValidation;
|
||||
DenoisingSettings.TemporalLightingValidation = sourceProfile.DenoisingSettings.TemporalLightingValidation;
|
||||
DenoisingSettings.TemporalOcclusionValidation = sourceProfile.DenoisingSettings.TemporalOcclusionValidation;
|
||||
DenoisingSettings.SpatialRadius = sourceProfile.DenoisingSettings.SpatialRadius;
|
||||
DenoisingSettings.Adaptivity = sourceProfile.DenoisingSettings.Adaptivity;
|
||||
DenoisingSettings.RecurrentBlur = sourceProfile.DenoisingSettings.RecurrentBlur;
|
||||
DenoisingSettings.FireflySuppression = sourceProfile.DenoisingSettings.FireflySuppression;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cfa758cbcc84a509b4fbdd3a170a992
|
||||
timeCreated: 1745928800
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/HTraceSSGIProfile.cs
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,29 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
using HTraceSSGI.Scripts.Data.Private;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Public
|
||||
{
|
||||
/// <summary>
|
||||
/// Change global HTrace SSGI settings, only for UseVolumes is disabled in HTrace SSGI Renderer Feature
|
||||
/// </summary>
|
||||
public static class HTraceSSGISettings
|
||||
{
|
||||
private static HTraceSSGIProfile _cachedProfile;
|
||||
|
||||
public static HTraceSSGIProfile ActiveProfile
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cachedProfile;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetProfile(HTraceSSGIProfile profile)
|
||||
{
|
||||
_cachedProfile = profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8283f6a3aff4a17b9edd5dfb9349cbe
|
||||
timeCreated: 1761683456
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/HTraceSSGISettings.cs
|
||||
uploadId: 840002
|
||||
187
Assets/Plugins/HTraceSSGI/Scripts/Data/Public/SSGISettings.cs
Normal file
187
Assets/Plugins/HTraceSSGI/Scripts/Data/Public/SSGISettings.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
using System;
|
||||
using HTraceSSGI.Scripts.Extensions;
|
||||
using HTraceSSGI.Scripts.Globals;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HTraceSSGI.Scripts.Data.Public
|
||||
{
|
||||
[Serializable]
|
||||
public class SSGISettings
|
||||
{
|
||||
// ----------------------------------------------- Visuals -----------------------------------------------
|
||||
|
||||
[SerializeField]
|
||||
private float _backfaceLighting = 0f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float BackfaceLighting
|
||||
{
|
||||
get => _backfaceLighting;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _backfaceLighting) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_backfaceLighting = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.BackfaceLighting));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _maxRayLength = 100f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;infinity]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,float.MaxValue)]
|
||||
public float MaxRayLength
|
||||
{
|
||||
get => _maxRayLength;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _maxRayLength) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_maxRayLength = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.MaxRayLength));
|
||||
}
|
||||
}
|
||||
|
||||
public ThicknessMode ThicknessMode = ThicknessMode.Relative;
|
||||
|
||||
[SerializeField]
|
||||
private float _thickness = 0.35f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.0f,1.0f)]
|
||||
public float Thickness
|
||||
{
|
||||
get => _thickness;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _thickness) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_thickness = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.Thickness));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _intensity = 1f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.1;5.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.1f,5.0f)]
|
||||
public float Intensity
|
||||
{
|
||||
get => _intensity;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _intensity) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_intensity = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.Intensity));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _falloff = 0.0f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.0;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0f,1.0f)]
|
||||
public float Falloff
|
||||
{
|
||||
get => _falloff;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _falloff) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_falloff = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.Falloff));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------- Quality -----------------------------------------------
|
||||
// ----------------------------------------------- Tracing -----------------------------------------------
|
||||
|
||||
[SerializeField]
|
||||
private int _rayCount = 4;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[2;16]</value>
|
||||
[HExtensions.HRangeAttribute(2,16)]
|
||||
public int RayCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _rayCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _rayCount)
|
||||
return;
|
||||
|
||||
_rayCount = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.RayCount));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private int _stepCount = 32;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[8;64]</value>
|
||||
[HExtensions.HRangeAttribute(8,128)]
|
||||
public int StepCount
|
||||
{
|
||||
get => _stepCount;
|
||||
set
|
||||
{
|
||||
if (value == _stepCount)
|
||||
return;
|
||||
|
||||
_stepCount = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.StepCount));
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
public bool RefineIntersection = true;
|
||||
|
||||
[SerializeField]
|
||||
public bool FullResolutionDepth = true;
|
||||
|
||||
// ----------------------------------------------- Rendering -----------------------------------------------
|
||||
|
||||
[SerializeField]
|
||||
public bool Checkerboard = false;
|
||||
|
||||
[SerializeField]
|
||||
private float _renderScale = 1f;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value>[0.5;1.0]</value>
|
||||
[HExtensions.HRangeAttribute(0.5f,1.0f)]
|
||||
public float RenderScale
|
||||
{
|
||||
get => _renderScale;
|
||||
set
|
||||
{
|
||||
if (Mathf.Abs(value - _renderScale) < Mathf.Epsilon)
|
||||
return;
|
||||
|
||||
_renderScale = HExtensions.Clamp(value, typeof(SSGISettings), nameof(SSGISettings.RenderScale));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae21e1c951f5f51488fabe310b39c1e8
|
||||
timeCreated: 1731130646
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Scripts/Data/Public/SSGISettings.cs
|
||||
uploadId: 840002
|
||||
Reference in New Issue
Block a user