maint: added htrace ssgi

This commit is contained in:
Chris
2025-12-31 12:44:11 -05:00
parent 90caaa07c4
commit 3a766f7606
203 changed files with 17634 additions and 0 deletions

View File

@@ -0,0 +1,305 @@
#if UNITY_EDITOR
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor
{
public class HDEditorUtilsWrapper
{
#region Public Methods
public static bool EnsureFrameSetting(int frameSettingsField)
{
try
{
Type hdEditorUtilsType = GetHDEditorUtilsType();
if (hdEditorUtilsType == null)
{
return false;
}
Type frameSettingsFieldType = GetFrameSettingsFieldType();
if (frameSettingsFieldType == null)
{
return false;
}
object frameSettingsFieldEnum = Enum.ToObject(frameSettingsFieldType, frameSettingsField);
MethodInfo ensureFrameSettingMethod = hdEditorUtilsType.GetMethod("EnsureFrameSetting",
BindingFlags.NonPublic | BindingFlags.Static,
null,
new Type[] { frameSettingsFieldType },
null);
if (ensureFrameSettingMethod == null)
{
return false;
}
object result = ensureFrameSettingMethod.Invoke(null, new object[] { frameSettingsFieldEnum });
return result != null && (bool)result;
}
catch (Exception ex)
{
return false;
}
}
public static void QualitySettingsHelpBox(string message, MessageType messageType, int expandableGroup, string propertyPath)
{
try
{
Type hdEditorUtilsType = GetHDEditorUtilsType();
if (hdEditorUtilsType == null)
{
return;
}
Type messageTypeEnum = typeof(MessageType);
Type expandableGroupType = GetExpandableGroupType();
if (expandableGroupType == null)
{
return;
}
object messageTypeValue = Enum.ToObject(messageTypeEnum, messageType);
object expandableGroupValue = Enum.ToObject(expandableGroupType, expandableGroup);
MethodInfo qualitySettingsHelpBoxMethod = hdEditorUtilsType.GetMethod("QualitySettingsHelpBox",
BindingFlags.NonPublic | BindingFlags.Static,
null,
new Type[] { typeof(string), messageTypeEnum, expandableGroupType, typeof(string) },
null);
if (qualitySettingsHelpBoxMethod == null)
{
return;
}
qualitySettingsHelpBoxMethod.Invoke(null, new object[] { message, messageTypeValue, expandableGroupValue, propertyPath });
}
catch (Exception ex)
{
//Debug.LogError($"Error calling HDEditorUtils.QualitySettingsHelpBox: {ex.Message}");
}
}
public static void QualitySettingsHelpBoxWithSection(string message, MessageType messageType, int expandableGroup, int expandableSection, string propertyPath)
{
try
{
Type hdEditorUtilsType = GetHDEditorUtilsType();
if (hdEditorUtilsType == null)
{
Debug.LogError("Failed to find HDEditorUtils type");
return;
}
Type messageTypeEnum = typeof(MessageType);
Type expandableGroupType = GetExpandableGroupType();
if (expandableGroupType == null)
{
Debug.LogError("Failed to find ExpandableGroup type");
return;
}
object messageTypeValue = Enum.ToObject(messageTypeEnum, messageType);
object expandableGroupValue = Enum.ToObject(expandableGroupType, expandableGroup);
MethodInfo[] methods = hdEditorUtilsType.GetMethods(BindingFlags.NonPublic | BindingFlags.Static);
MethodInfo genericMethod = null;
foreach (var method in methods)
{
if (method.Name == "QualitySettingsHelpBox" &&
method.IsGenericMethodDefinition &&
method.GetParameters().Length == 5)
{
genericMethod = method;
break;
}
}
if (genericMethod == null)
{
Debug.LogError("Failed to find generic QualitySettingsHelpBox method");
return;
}
Type expandableLightingType = GetExpandableLightingType();
if (expandableLightingType == null)
{
expandableLightingType = expandableGroupType;
}
MethodInfo concreteMethod = genericMethod.MakeGenericMethod(expandableLightingType);
object expandableSectionValue = Enum.ToObject(expandableLightingType, expandableSection);
concreteMethod.Invoke(null, new object[] { message, messageTypeValue, expandableGroupValue, expandableSectionValue, propertyPath });
}
catch (Exception ex)
{
Debug.LogError($"Error calling HDEditorUtils.QualitySettingsHelpBox with section: {ex.Message}");
}
}
#endregion
#region Helper Methods
private static Type GetHDEditorUtilsType()
{
Type hdEditorUtilsType = Type.GetType("UnityEditor.Rendering.HighDefinition.HDEditorUtils, Unity.RenderPipelines.HighDefinition.Editor");
if (hdEditorUtilsType == null)
{
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
hdEditorUtilsType = assembly.GetType("UnityEditor.Rendering.HighDefinition.HDEditorUtils");
if (hdEditorUtilsType != null) break;
}
}
return hdEditorUtilsType;
}
private static Type GetFrameSettingsFieldType()
{
Type frameSettingsFieldType = Type.GetType("UnityEngine.Rendering.HighDefinition.FrameSettingsField, Unity.RenderPipelines.HighDefinition.Runtime");
if (frameSettingsFieldType == null)
{
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
frameSettingsFieldType = assembly.GetType("UnityEngine.Rendering.HighDefinition.FrameSettingsField");
if (frameSettingsFieldType != null) break;
}
}
return frameSettingsFieldType;
}
private static Type GetExpandableGroupType()
{
Type hdrpUIType = GetHDRPUIType();
if (hdrpUIType == null) return null;
return hdrpUIType.GetNestedType("ExpandableGroup", BindingFlags.NonPublic | BindingFlags.Public);
}
private static Type GetExpandableLightingType()
{
Type hdrpUIType = GetHDRPUIType();
if (hdrpUIType == null) return null;
return hdrpUIType.GetNestedType("ExpandableLighting", BindingFlags.NonPublic | BindingFlags.Public);
}
private static Type GetHDRPUIType()
{
Type hdrpUIType = Type.GetType("UnityEditor.Rendering.HighDefinition.HDRenderPipelineUI, Unity.RenderPipelines.HighDefinition.Editor");
if (hdrpUIType == null)
{
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
hdrpUIType = assembly.GetType("UnityEditor.Rendering.HighDefinition.HDRenderPipelineUI");
if (hdrpUIType != null) break;
}
}
return hdrpUIType;
}
public static int GetFrameSettingsFieldValue(string fieldName)
{
try
{
Type frameSettingsFieldType = GetFrameSettingsFieldType();
if (frameSettingsFieldType == null)
return -1;
object enumValue = Enum.Parse(frameSettingsFieldType, fieldName);
return (int)enumValue;
}
catch (Exception ex)
{
Debug.LogError($"Error when get FrameSettingsField.{fieldName}: {ex.Message}");
return -1;
}
}
// internal enum ExpandableGroup
// {
// Rendering = 1 << 4,
// Lighting = 1 << 5,
// LightingTiers = 1 << 6,
// Material = 1 << 7,
// PostProcess = 1 << 8,
// PostProcessTiers = 1 << 9,
// XR = 1 << 10,
// VirtualTexturing = 1 << 11,
// Volumes = 1 << 12
// }
public static int GetExpandableGroupValue(string groupName)
{
try
{
Type expandableGroupType = GetExpandableGroupType();
if (expandableGroupType == null)
return -1;
object enumValue = Enum.Parse(expandableGroupType, groupName);
return (int)enumValue;
}
catch (Exception ex)
{
Debug.LogError($"Error when get ExpandableGroup.{groupName}: {ex.Message}");
return -1;
}
}
// internal enum ExpandableLighting
// {
// Volumetric = 1 << 0,
// ProbeVolume = 1 << 1,
// Cookie = 1 << 2,
// Reflection = 1 << 3,
// Sky = 1 << 4,
// // Illegal index 1 << 5 since parent Lighting section index is using it
// LightLoop = 1 << 6,
// Shadow = 1 << 7
// }
public static int GetExpandableLightingValue(string lightingName)
{
try
{
Type expandableLightingType = GetExpandableLightingType();
if (expandableLightingType == null)
return -1;
object enumValue = Enum.Parse(expandableLightingType, lightingName);
return (int)enumValue;
}
catch (Exception ex)
{
Debug.LogError($"Error when get ExpandableLighting.{lightingName}: {ex.Message}");
return -1;
}
}
#endregion
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d6c5a454614b45b1b4d9c443d62ee70b
timeCreated: 1758542957
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HDEditorUtilsWrapper.cs
uploadId: 840002

View File

@@ -0,0 +1,133 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor
{
internal static class HEditorStyles
{
public static float defaultLineSpace = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
public static float additionalLineSpace = 10f;
public static float helpBoxHeight = EditorGUIUtility.singleLineHeight * 2;
public static float checkBoxOffsetWidth = 15f;
public static float checkBoxWidth = 15f;
public static float tabOffset = 8f;
// Buttons name
public const string FixButtonName = "Fix";
public const string ChangeButtonName = "Change";
public const string OpenButtonName = "Open";
// Debug Tab
public static GUIContent DebugContent = new GUIContent("Debug");
public static GUIContent hTraceLayerContent = new GUIContent("HTrace Layer", "Excludes objects from HTrace rendering on a per-layer basis");
// Foldout names
public static GUIContent GlobalSettings = new GUIContent("Global Settings");
public static GUIContent PipelineIntegration = new GUIContent("Pipeline Integration");
public static GUIContent Visuals = new GUIContent("Visuals");
public static GUIContent Quality = new GUIContent("Quality");
public static GUIContent Tracing = new GUIContent("Tracing");
public static GUIContent Rendering = new GUIContent("Rendering");
public static GUIContent Denoising = new GUIContent("Denoising");
public static GUIContent ReSTIRValidation = new GUIContent("ReSTIR Validation");
public static GUIContent ValidationTypes = new GUIContent("Validation Types:");
public static GUIContent SpatialFilter = new GUIContent("Spatial Filter");
public static GUIContent Debug = new GUIContent("Debug");
// General Tab
public static GUIContent DebugModeContent = new GUIContent("Debug Mode", "Visualizes the debug mode for different rendering components of H-Trace.");
public static GUIContent HBuffer = new GUIContent("Buffer", "Visualizes the debug mode for different buffers");
// Visuals
public static GUIContent ThicknessMode = new GUIContent("Thickness Mode", "Method for thickness estimation.");
public static GUIContent Thickness = new GUIContent("Thickness", "Virtual object thickness for ray intersections.");
public static GUIContent BackfaceLighting = new GUIContent("Backface Lighting", "");
public static GUIContent MaxRayLength = new GUIContent("Max Ray Length", "Maximum ray distance in meters.");
public static GUIContent FallbackType = new("Fallback", "Method used when a ray misses.");
public static GUIContent SkyIntensity = new("Sky Intensity", "Brightness of Sky used for ray misses.");
public static GUIContent ExcludeCastingMask = new("Exclude Casting", "Prevents objects from casting GI.");
public static GUIContent ExcludeReceivingMask = new("Exclude Receiving", "Prevents objects from receiving screen-space GI.");
public static GUIContent NormalBias = new("APV Normal Bias");
public static GUIContent ViewBias = new("APV View Bias");
public static GUIContent SamplingNoise = new("APV Sampling Noise");
public static GUIContent DenoiseFallback = new("Denoise Fallback", "Includes fallback lighting in denoising.");
public static GUIContent Intensity = new GUIContent("Intensity");
public static GUIContent Falloff = new GUIContent("Falloff", "Softens indirect lighting over distance.");
// Quality tab
// Tracing
public static GUIContent RayCount = new GUIContent("Ray Count", "Number of rays per pixel.");
public static GUIContent StepCount = new GUIContent("Step Count", "Number of steps per ray.");
public static GUIContent RefineIntersection = new GUIContent("Refine Intersection", "Extra check to confirm hits.");
public static GUIContent FullResolutionDepth = new GUIContent("Full Resolution Depth", "Uses full-res depth buffer for tracing.");
//Rendering
public static GUIContent Checkerboard = new GUIContent("Checkerboard");
public static GUIContent RenderScale = new GUIContent("Render Scale", "Local render scale of SSGI.");
// Denoising tab
public static GUIContent BrightnessClamp = new("Brightness Clamp", "Method for clamping brightness at hit point.");
public static GUIContent MaxValueBrightnessClamp = new(" Max Value", "Maximum brightness allowed at hit points.");
public static GUIContent MaxDeviationBrightnessClamp = new(" Max Deviation", "Maximum standard deviation for brightness allowed at hit points.");
// ReSTIR Validation
public static GUIContent HalfStepValidation = new("Half-Step Tracing", "Halves validation ray steps.");
public static GUIContent SpatialOcclusionValidation = new("Spatial Occlusion", "Preserves detail, reduces leaks during blur.");
public static GUIContent TemporalLightingValidation = new("Temporal Lighting", "Reacts faster to changing lights.");
public static GUIContent TemporalOcclusionValidation = new("Temporal Occlusion", "Reacts faster to moving shadows.");
// Spatial Fliter
public static GUIContent SpatialRadius = new GUIContent("Radius", "Width of spatial filter.");
public static GUIContent Adaptivity = new GUIContent("Adaptivity", "Shrinks filter radius in geometry corners to preserve detail.");
public static GUIContent RecurrentBlur = new GUIContent("Recurrent Blur", "Stronger blur with low cost, less temporal reactivity.");
public static GUIContent FireflySuppression = new GUIContent("Firefly Suppression", "Removes bright outliers before denoising.");
public static GUIStyle bold = new GUIStyle()
{
alignment = TextAnchor.MiddleLeft,
margin = new RectOffset(),
padding = new RectOffset(2, 0, 0, 0),
fontSize = 12,
normal = new GUIStyleState()
{
textColor = new Color(0.903f, 0.903f, 0.903f, 1f),
},
fontStyle = FontStyle.Bold,
};
public static GUIStyle hiddenFoldout = new GUIStyle()
{
alignment = TextAnchor.MiddleLeft,
margin = new RectOffset(),
padding = new RectOffset(),
fontSize = 12,
normal = new GUIStyleState()
{
//textColor = new Color(0.703f, 0.703f, 0.703f, 1f), //default color
textColor = new Color(0.500f, 0.500f, 0.500f, 1f),
},
fontStyle = FontStyle.Bold,
};
public static GUIStyle headerFoldout = new GUIStyle()
{
alignment = TextAnchor.MiddleLeft,
margin = new RectOffset(),
padding = new RectOffset(),
fontSize = 12,
normal = new GUIStyleState()
{
textColor = new Color(0.903f, 0.903f, 0.903f, 1f),
},
fontStyle = FontStyle.Bold,
};
//buttons gui styles
public static Color warningBackgroundColor = new Color(1,1, 0);
public static Color warningColor = new Color(1, 1, 1);
public static GUIStyle foldout = EditorStyles.foldout;
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7b0103dbde10dd04eb57da14de01f702
timeCreated: 1675231640
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HEditorStyles.cs
uploadId: 840002

View File

@@ -0,0 +1,243 @@
#if UNITY_EDITOR
using System;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor
{
public static class HEditorUtils
{
private static GUIStyle s_linkStyle;
private static GUIStyle s_separatorStyle;
public static void DrawLinkRow(params (string label, Action onClick)[] links)
{
if (s_linkStyle == null)
{
s_linkStyle = new GUIStyle(GUI.skin.label)
{
fontStyle = FontStyle.Bold,
fontSize = 10,
alignment = TextAnchor.MiddleLeft,
normal = { textColor = new Color(0.35f, 0.55f, 0.75f) },
hover = { textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black },
// padding = new RectOffset(0, 0, 0, 0),
// margin = new RectOffset(0, 0, 0, 0)
};
}
if (s_separatorStyle == null)
{
s_separatorStyle = new GUIStyle(GUI.skin.label)
{
fontSize = 12,
alignment = TextAnchor.MiddleCenter,
normal = { textColor = new Color(0.9f, 0.9f, 0.9f,1f) },
padding = new RectOffset(0, 0, 1, 0),
margin = new RectOffset(0, 0, 0, 0)
};
}
float maxWidth = EditorGUIUtility.currentViewWidth - 40; // scroll
float currentLineWidth = 0;
GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
for (int i = 0; i < links.Length; i++)
{
var content = new GUIContent(links[i].label);
Vector2 size = s_linkStyle.CalcSize(content);
float neededWidth = size.x + 8; // text + |
// new line
if (currentLineWidth + neededWidth > maxWidth)
{
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
currentLineWidth = 0;
}
if (DrawClickableButton(links[i].label, onClick: links[i].onClick))
{
// nothing here
}
currentLineWidth += size.x;
if (i < links.Length - 1)
{
GUILayout.Space(8);
// GUILayout.Label("|", s_separatorStyle, GUILayout.Width(12));
// GUILayout.Space(2);
currentLineWidth += 8; // width |
}
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
public static bool DrawClickableButton(string text, Action onClick = null, GUIStyle baseStyle = null)
{
if (s_linkStyle == null)
{
s_linkStyle = new GUIStyle(baseStyle ?? GUI.skin.label)
{
fontStyle = FontStyle.Bold,
fontSize = 10,
alignment = TextAnchor.MiddleLeft,
normal = { textColor = new Color(0.35f, 0.55f, 0.75f) },
hover = { textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black }
};
}
Rect rect = GUILayoutUtility.GetRect(new GUIContent(text), s_linkStyle, GUILayout.ExpandWidth(false));
bool clicked = GUI.Button(rect, text, s_linkStyle);
EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
if (clicked)
onClick?.Invoke();
return clicked;
}
public static bool DrawClickableLink(string text, string url, bool useEmoji = false, GUIStyle baseStyle = null)
{
if (s_linkStyle == null)
{
s_linkStyle = new GUIStyle(baseStyle ?? GUI.skin.label)
{
fontStyle = FontStyle.Bold,
fontSize = 10,
//normal = { textColor = new Color(0.20f, 0.50f, 0.80f) },
normal = { textColor = new Color(0.35f, 0.55f, 0.75f) },
hover = { textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black }
};
}
if (useEmoji)
text += " \U0001F517"; //\U0001F310
bool clicked = GUILayout.Button(text, s_linkStyle, GUILayout.ExpandWidth(false));
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
if (clicked)
{
Application.OpenURL(url);
}
return clicked;
}
public readonly struct FoldoutScope : IDisposable
{
private readonly bool wasIndent;
public FoldoutScope(AnimBool value, out bool shouldDraw, string label, bool indent = true, SerializedProperty toggle = null)
{
value.target = Foldout(value.target, label, toggle);
shouldDraw = EditorGUILayout.BeginFadeGroup(value.faded);
if (shouldDraw && indent)
{
Indent();
wasIndent = true;
}
else
{
wasIndent = false;
}
}
public void Dispose()
{
if (wasIndent)
EndIndent();
EditorGUILayout.EndFadeGroup();
}
}
public static void HorizontalLine(float height = 1, float width = -1, Vector2 margin = new Vector2())
{
GUILayout.Space(margin.x);
var rect = EditorGUILayout.GetControlRect(false, height);
if (width > -1)
{
var centerX = rect.width / 2;
rect.width = width;
rect.x += centerX - width / 2;
}
Color color = EditorStyles.label.active.textColor;
color.a = 0.5f;
EditorGUI.DrawRect(rect, color);
GUILayout.Space(margin.y);
}
public static bool Foldout(bool value, string label, SerializedProperty toggle = null)
{
bool _value;
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.BeginHorizontal();
if (toggle != null && !toggle.boolValue)
{
EditorGUI.BeginDisabledGroup(true);
_value = EditorGUILayout.Toggle(value, EditorStyles.foldout);
EditorGUI.EndDisabledGroup();
_value = false;
}
else
{
_value = EditorGUILayout.Toggle(value, EditorStyles.foldout);
}
if (toggle != null)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(toggle, GUIContent.none, GUILayout.Width(20));
if (EditorGUI.EndChangeCheck() && toggle.boolValue)
_value = true;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
var rect = GUILayoutUtility.GetLastRect();
rect.x += 20;
rect.width -= 20;
if (toggle != null && !toggle.boolValue)
{
EditorGUI.BeginDisabledGroup(true);
EditorGUI.LabelField(rect, label, EditorStyles.boldLabel);
EditorGUI.EndDisabledGroup();
}
else
{
EditorGUI.LabelField(rect, label, EditorStyles.boldLabel);
}
return _value;
}
public static void Indent()
{
EditorGUILayout.BeginHorizontal();
GUILayout.Space(16);
EditorGUILayout.BeginVertical();
}
public static void EndIndent()
{
GUILayout.Space(10);
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f1ca94cbca25bbd46b2e81a98884081a
timeCreated: 1675348234
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HEditorUtils.cs
uploadId: 840002

View File

@@ -0,0 +1,140 @@
//pipelinedefine
#define H_URP
#if UNITY_EDITOR
using System.IO;
using HTraceSSGI.Scripts.Data.Private;
using HTraceSSGI.Scripts.Data.Public;
using UnityEditor;
using UnityEngine;
using HTraceSSGI.Scripts.Infrastructure.URP;
namespace HTraceSSGI.Scripts.Editor
{
public enum HTraceSSGIPreset
{
Performance = 1,
Optimized = 2,
Balanced = 3,
Quality = 4,
}
[CustomEditor(typeof(HTraceSSGI))]
public class HTraceSSGIEditor : UnityEditor.Editor
{
private SerializedProperty _profile;
HTraceSSGIProfile _cachedProfile;
UnityEditor.Editor _cachedProfileEditor;
static GUIStyle _boxStyle;
private void OnEnable()
{
_profile = serializedObject.FindProperty("Profile");
}
public override void OnInspectorGUI()
{
if (_boxStyle == null)
{
_boxStyle = new GUIStyle(GUI.skin.box);
_boxStyle.padding = new RectOffset(15, 10, 5, 5);
}
if (HTraceSSGIRendererFeature.IsUseVolumes == true)
{
EditorGUILayout.HelpBox("\"Use Volumes\" checkbox in the HTrace SSGI Renderer feature is enabled, use the HTraceSSGI volume override in your scenes.", MessageType.Warning, wide: true);
return;
}
EditorGUILayout.PropertyField(_profile);
EditorGUILayout.Space(5);
if (_profile.objectReferenceValue != null)
{
if (_cachedProfile != _profile.objectReferenceValue)
{
_cachedProfile = null;
}
if (_cachedProfile == null)
{
_cachedProfile = (HTraceSSGIProfile)_profile.objectReferenceValue;
_cachedProfileEditor = CreateEditor(_profile.objectReferenceValue);
}
EditorGUILayout.BeginVertical();
_cachedProfileEditor.OnInspectorGUI();
EditorGUILayout.Separator();
if (GUILayout.Button("Save As New Profile"))
{
ExportProfile();
}
EditorGUILayout.EndVertical();
}
else
{
EditorGUILayout.HelpBox("Create or assign a profile.", MessageType.Info);
if (GUILayout.Button("New Profile"))
{
CreateProfile();
}
}
serializedObject.ApplyModifiedProperties();
}
void CreateProfile() {
var fp = CreateInstance<HTraceSSGIProfile>();
fp.name = "New HTrace SSGI Profile";
string path = "Assets";
foreach (Object obj in Selection.GetFiltered(typeof(Object), SelectionMode.Assets)) {
path = AssetDatabase.GetAssetPath(obj);
if (File.Exists(path)) {
path = Path.GetDirectoryName(path);
}
break;
}
string fullPath = path + "/" + fp.name + ".asset";
fullPath = AssetDatabase.GenerateUniqueAssetPath(fullPath);
AssetDatabase.CreateAsset(fp, fullPath);
AssetDatabase.SaveAssets();
_profile.objectReferenceValue = fp;
EditorGUIUtility.PingObject(fp);
}
void ExportProfile() {
var fp = (HTraceSSGIProfile)_profile.objectReferenceValue;
var newProfile = Instantiate(fp);
string path = AssetDatabase.GetAssetPath(fp);
string fullPath = path;
if (string.IsNullOrEmpty(path)) {
path = "Assets";
foreach (Object obj in Selection.GetFiltered(typeof(Object), SelectionMode.Assets)) {
path = AssetDatabase.GetAssetPath(obj);
if (File.Exists(path)) {
path = Path.GetDirectoryName(path);
}
break;
}
fullPath = path + "/" + fp.name + ".asset";
}
fullPath = AssetDatabase.GenerateUniqueAssetPath(fullPath);
AssetDatabase.CreateAsset(newProfile, fullPath);
AssetDatabase.SaveAssets();
_profile.objectReferenceValue = newProfile;
EditorGUIUtility.PingObject(fp);
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1f39d10a78f94348bef222fc6f34a37a
timeCreated: 1761566211
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HTraceSSGIEditor.cs
uploadId: 840002

View File

@@ -0,0 +1,456 @@
//pipelinedefine
#define H_URP
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Data.Private;
using HTraceSSGI.Scripts.Data.Public;
using HTraceSSGI.Scripts.Editor.WindowsAndMenu;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEditor.Rendering;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor
{
[CustomEditor(typeof(HTraceSSGIProfile))]
internal class HTraceSSGIProfileEditor : UnityEditor.Editor
{
HTraceSSGIPreset _preset = HTraceSSGIPreset.Balanced;
bool _globalSettingsTab = true;
bool _qualityTab = true;
bool _denoisingTab = true;
bool _debugTab = true;
private AnimBool AnimBoolGeneralTab;
private AnimBool AnimBoolQualityTab;
private AnimBool AnimBoolDenoisingTab;
private AnimBool AnimBoolDebugTab;
private AnimBool AnimBoolEMPTY;
bool _showPipelineIntegration = true;
bool _showVisualsArea = true;
bool _showTracingArea = true;
bool _showRenderingArea = true;
bool _showRestirValidationArea = true;
bool _showSpatialArea = true;
SerializedProperty GeneralSettings;
SerializedProperty SSGISettings;
SerializedProperty DenoisingSettings;
SerializedProperty DebugSettings;
// Debug Data
SerializedProperty EnableDebug;
SerializedProperty HTraceLayer;
// General Tab
SerializedProperty DebugMode;
SerializedProperty HBuffer;
SerializedProperty MainCamera;
SerializedProperty MetallicIndirectFallback;
SerializedProperty AmbientOverride;
SerializedProperty Multibounce;
SerializedProperty ExcludeReceivingMask;
SerializedProperty ExcludeCastingMask;
SerializedProperty FallbackType;
SerializedProperty SkyIntensity;
//Apv
SerializedProperty ViewBias;
SerializedProperty NormalBias;
SerializedProperty SamplingNoise;
SerializedProperty DenoiseFallback;
// Visuals
SerializedProperty BackfaceLighting;
SerializedProperty MaxRayLength;
SerializedProperty ThicknessMode;
SerializedProperty Thickness;
SerializedProperty Intensity;
SerializedProperty Falloff;
// Quality tab
// Tracing
SerializedProperty RayCount;
SerializedProperty StepCount;
SerializedProperty RefineIntersection;
SerializedProperty FullResolutionDepth;
// Rendering
SerializedProperty Checkerboard;
SerializedProperty RenderScale;
// Denoising tab
SerializedProperty BrightnessClamp;
SerializedProperty MaxValueBrightnessClamp;
SerializedProperty MaxDeviationBrightnessClamp;
// Temporal
SerializedProperty HalfStepValidation;
SerializedProperty SpatialOcclusionValidation;
SerializedProperty TemporalLightingValidation;
SerializedProperty TemporalOcclusionValidation;
// Spatial Filter
SerializedProperty SpatialRadius;
SerializedProperty Adaptivity;
// SerializedProperty SpatialPassCount;
SerializedProperty RecurrentBlur;
SerializedProperty FireflySuppression;
// Debug DEVS
SerializedProperty ShowBowels;
SerializedProperty ShowFullDebugLog;
SerializedProperty TestCheckBox1;
SerializedProperty TestCheckBox2;
SerializedProperty TestCheckBox3;
private void OnEnable()
{
PropertiesRelative();
AnimBoolGeneralTab = new AnimBool(_globalSettingsTab);
AnimBoolGeneralTab.valueChanged.RemoveAllListeners();
AnimBoolGeneralTab.valueChanged.AddListener(Repaint);
AnimBoolQualityTab = new AnimBool(_qualityTab);
AnimBoolQualityTab.valueChanged.RemoveAllListeners();
AnimBoolQualityTab.valueChanged.AddListener(Repaint);
AnimBoolDenoisingTab = new AnimBool(_denoisingTab);
AnimBoolDenoisingTab.valueChanged.RemoveAllListeners();
AnimBoolDenoisingTab.valueChanged.AddListener(Repaint);
AnimBoolDebugTab = new AnimBool(_debugTab);
AnimBoolDebugTab.valueChanged.RemoveAllListeners();
AnimBoolDebugTab.valueChanged.AddListener(Repaint);
AnimBoolEMPTY = new AnimBool(false);
}
protected virtual void OnSceneGUI()
{
HTraceSSGI hTraceSSGI = (HTraceSSGI)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
UpdateStandartStyles();
// base.OnInspectorGUI();
//return;
AnimBoolEMPTY = new AnimBool(false);
Color standartBackgroundColor = GUI.backgroundColor;
Color standartColor = GUI.color;
WarningsHandle();
// ------------------------------------- Global settings ----------------------------------------------------------
using (new HEditorUtils.FoldoutScope(AnimBoolGeneralTab, out var shouldDraw, "Global Settings"))
{
_globalSettingsTab = shouldDraw;
if (shouldDraw)
{
EditorGUILayout.Space(3f);
EditorGUILayout.BeginHorizontal();
_preset = (HTraceSSGIPreset)EditorGUILayout.EnumPopup(new GUIContent("Preset"), _preset);
if (GUILayout.Button("Apply", GUILayout.Width(60)))
{
HTraceSSGIProfile profileLocal = HTraceSSGISettings.ActiveProfile;
profileLocal.ApplyPreset(_preset);
EditorUtility.SetDirty(target);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space(3f);
serializedObject.Update();
EditorGUILayout.PropertyField(DebugMode, HEditorStyles.DebugModeContent);
if (DebugMode.enumValueIndex == 1)
EditorGUILayout.PropertyField(HBuffer, HEditorStyles.HBuffer);
EditorGUILayout.Space(5f);
#if UNITY_2023_3_OR_NEWER
EditorGUILayout.PropertyField(ExcludeCastingMask, HEditorStyles.ExcludeCastingMask);
EditorGUILayout.PropertyField(ExcludeReceivingMask, HEditorStyles.ExcludeReceivingMask);
#endif
EditorGUILayout.Space(3f);
EditorGUILayout.PropertyField(FallbackType, HEditorStyles.FallbackType);
if ((Globals.FallbackType)FallbackType.enumValueIndex == Globals.FallbackType.Sky)
EditorGUILayout.Slider(SkyIntensity, 0.0f, 1.0f, HEditorStyles.SkyIntensity);
_showPipelineIntegration = EditorGUILayout.BeginFoldoutHeaderGroup(_showPipelineIntegration, "Pipeline Integration");
if (_showPipelineIntegration)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(MetallicIndirectFallback, new GUIContent("Metallic Indirect Fallback"));
EditorGUILayout.PropertyField(AmbientOverride, new GUIContent("Ambient Override"));
if (RenderSettings.ambientIntensity > 1.0f && AmbientOverride.boolValue == true)
EditorGUILayout.HelpBox("Ambient Override may not work correctly when the Environment Lighting Multiplier is set above 1 !", MessageType.Warning);
EditorGUILayout.PropertyField(Multibounce, new GUIContent("Multibounce"));
EditorGUI.indentLevel--;
EditorGUILayout.Space(3f);
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
{
_showVisualsArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showVisualsArea, "Visuals");
if (_showVisualsArea)
{
EditorGUI.indentLevel++;
EditorGUILayout.Slider(BackfaceLighting, 0.0f, 1.0f, HEditorStyles.BackfaceLighting);
EditorGUILayout.PropertyField(MaxRayLength, HEditorStyles.MaxRayLength);
if (MaxRayLength.floatValue < 0)
MaxRayLength.floatValue = 0f;
EditorGUILayout.PropertyField(ThicknessMode, HEditorStyles.ThicknessMode);
EditorGUILayout.Slider(Thickness, 0.0f, 1.0f, HEditorStyles.Thickness);
EditorGUILayout.Slider(Intensity, 0.1f, 5.0f, HEditorStyles.Intensity);
EditorGUILayout.Slider(Falloff, 0.0f, 1.0f, HEditorStyles.Falloff);
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
}
}
}
// ------------------------------------- Quality ----------------------------------------------------------
using (new HEditorUtils.FoldoutScope(AnimBoolQualityTab, out var shouldDraw, "Quality"))
{
_qualityTab = shouldDraw;
if (shouldDraw)
{
EditorGUILayout.Space(3f);
_showTracingArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showTracingArea, "Tracing");
if (_showTracingArea)
{
EditorGUI.indentLevel++;
RayCount.intValue = EditorGUILayout.IntSlider(HEditorStyles.RayCount, RayCount.intValue, 2, 16);
StepCount.intValue = EditorGUILayout.IntSlider(HEditorStyles.StepCount, StepCount.intValue, 8, 64);
EditorGUILayout.PropertyField(RefineIntersection, HEditorStyles.RefineIntersection);
EditorGUILayout.PropertyField(FullResolutionDepth, HEditorStyles.FullResolutionDepth);
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(5f);
_showRenderingArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showRenderingArea, "Rendering");
if (_showRenderingArea)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(Checkerboard, HEditorStyles.Checkerboard);
EditorGUILayout.Slider(RenderScale, 0.5f, 1.0f, HEditorStyles.RenderScale);
RenderScale.floatValue = RenderScale.floatValue.RoundToCeilTail(2);
if (Mathf.Approximately(RenderScale.floatValue, 1.0f) == false)
{
EditorGUI.indentLevel++;
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
}
}
// ------------------------------------- Denoising ----------------------------------------------------------
using (new HEditorUtils.FoldoutScope(AnimBoolDenoisingTab, out var shouldDraw, "Denoising"))
{
_denoisingTab = shouldDraw;
if (shouldDraw)
{
EditorGUILayout.Space(3f);
EditorGUILayout.PropertyField(BrightnessClamp, HEditorStyles.BrightnessClamp);
if ((BrightnessClamp)BrightnessClamp.enumValueIndex == Globals.BrightnessClamp.Manual)
EditorGUILayout.Slider(MaxValueBrightnessClamp, 1.0f, 30.0f, HEditorStyles.MaxValueBrightnessClamp);
if ((BrightnessClamp)BrightnessClamp.enumValueIndex == Globals.BrightnessClamp.Automatic)
EditorGUILayout.Slider(MaxDeviationBrightnessClamp, 1.0f, 5.0f, HEditorStyles.MaxDeviationBrightnessClamp);
EditorGUILayout.Space(5f);
_showRestirValidationArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showRestirValidationArea, "ReSTIR Validation");
if (_showRestirValidationArea)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(HalfStepValidation, HEditorStyles.HalfStepValidation);
EditorGUILayout.Space(3f);
EditorGUILayout.LabelField(new GUIContent("Validation Types:"), HEditorStyles.bold);
EditorGUILayout.PropertyField(SpatialOcclusionValidation, HEditorStyles.SpatialOcclusionValidation);
EditorGUILayout.PropertyField(TemporalLightingValidation, HEditorStyles.TemporalLightingValidation);
EditorGUILayout.PropertyField(TemporalOcclusionValidation, HEditorStyles.TemporalOcclusionValidation);
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(5f);
_showSpatialArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showSpatialArea, "Spatial Filter");
if (_showSpatialArea)
{
EditorGUI.indentLevel++;
EditorGUILayout.Slider(SpatialRadius, 0.0f, 1.0f, HEditorStyles.SpatialRadius);
EditorGUILayout.Slider(Adaptivity, 0.0f, 1.0f, HEditorStyles.Adaptivity);
// SpatialPassCount.intValue = EditorGUILayout.IntSlider(HEditorStyles.SpatialPassCount, SpatialPassCount.intValue, 0, 4);
EditorGUILayout.PropertyField(RecurrentBlur, HEditorStyles.RecurrentBlur);
EditorGUILayout.PropertyField(FireflySuppression, HEditorStyles.FireflySuppression);
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
}
}
// ------------------------------------- Debug settings ----------------------------------------------------------
HEditorUtils.HorizontalLine(1f);
EditorGUILayout.Space(3f);
//HEditorUtils.DrawClickableLink($"HTrace AO Version: {HNames.HTRACE_AO_VERSION}", HNames.HTRACE_AO_DOCUMENTATION_LINK, true);
HEditorUtils.DrawLinkRow(
($"Documentation (v." + HNames.HTRACE_SSGI_VERSION + ")", () => Application.OpenURL(HNames.HTRACE_SSGI_DOCUMENTATION_LINK)),
("Discord", () => Application.OpenURL(HNames.HTRACE_DISCORD_LINK)),
("Bug report", () => HBugReporterWindow.ShowWindow())
);
GUI.backgroundColor = standartBackgroundColor;
GUI.color = standartColor;
serializedObject.ApplyModifiedProperties();
}
private void WarningsHandle()
{
}
private void DebugPart()
{
using (new HEditorUtils.FoldoutScope(AnimBoolDebugTab, out var shouldDraw, HEditorStyles.DebugContent.text, toggle: EnableDebug))
{
_debugTab = shouldDraw;
if (shouldDraw)
{
//EditorGUILayout.PropertyField(EnableDebug, HEditorStyles.OcclusionEnable);
//if (EnableDebug.boolValue == true)
{
EditorGUILayout.PropertyField(HTraceLayer, HEditorStyles.hTraceLayerContent);
}
EditorGUILayout.PropertyField(ShowBowels, new GUIContent("Show Bowels"));
ShowFullDebugLog.boolValue = EditorGUILayout.Toggle(new GUIContent("Show Full Debug Log"), ShowFullDebugLog.boolValue);
TestCheckBox1.boolValue = EditorGUILayout.Toggle(new GUIContent("TestCheckBox1"), TestCheckBox1.boolValue);
TestCheckBox2.boolValue = EditorGUILayout.Toggle(new GUIContent("TestCheckBox2"), TestCheckBox2.boolValue);
TestCheckBox3.boolValue = EditorGUILayout.Toggle(new GUIContent("TestCheckBox3"), TestCheckBox3.boolValue);
EditorGUILayout.Space(3);
}
}
}
private void UpdateStandartStyles()
{
HEditorStyles.foldout.fontStyle = FontStyle.Bold;
}
private void PropertiesRelative()
{
GeneralSettings = serializedObject.FindProperty("GeneralSettings");
SSGISettings = serializedObject.FindProperty("SSGISettings");
DenoisingSettings = serializedObject.FindProperty("DenoisingSettings");
DebugSettings = serializedObject.FindProperty("DebugSettings");
// Debug Data
HTraceLayer = DebugSettings.FindPropertyRelative("HTraceLayer");
ShowBowels = DebugSettings.FindPropertyRelative("ShowBowels");
ShowFullDebugLog = DebugSettings.FindPropertyRelative("ShowFullDebugLog");
TestCheckBox1 = DebugSettings.FindPropertyRelative("TestCheckBox1");
TestCheckBox2 = DebugSettings.FindPropertyRelative("TestCheckBox2");
TestCheckBox3 = DebugSettings.FindPropertyRelative("TestCheckBox3");
// Global Tab
DebugMode = GeneralSettings.FindPropertyRelative("DebugMode");
HBuffer = GeneralSettings.FindPropertyRelative("HBuffer");
ExcludeReceivingMask = GeneralSettings.FindPropertyRelative("ExcludeReceivingMask");
ExcludeCastingMask = GeneralSettings.FindPropertyRelative("ExcludeCastingMask");
MetallicIndirectFallback = GeneralSettings.FindPropertyRelative("MetallicIndirectFallback");
AmbientOverride = GeneralSettings.FindPropertyRelative("AmbientOverride");
Multibounce = GeneralSettings.FindPropertyRelative("Multibounce");
FallbackType = GeneralSettings.FindPropertyRelative("FallbackType");
SkyIntensity = GeneralSettings.FindPropertyRelative("_skyIntensity");
ViewBias = GeneralSettings.FindPropertyRelative("_viewBias");
NormalBias = GeneralSettings.FindPropertyRelative("_normalBias");
SamplingNoise = GeneralSettings.FindPropertyRelative("_samplingNoise");
DenoiseFallback = GeneralSettings.FindPropertyRelative("DenoiseFallback");
// Visuals
BackfaceLighting = SSGISettings.FindPropertyRelative("_backfaceLighting");
MaxRayLength = SSGISettings.FindPropertyRelative("_maxRayLength");
ThicknessMode = SSGISettings.FindPropertyRelative("ThicknessMode");
Thickness = SSGISettings.FindPropertyRelative("_thickness");
Intensity = SSGISettings.FindPropertyRelative("_intensity");
Falloff = SSGISettings.FindPropertyRelative("_falloff");
// Quality tab
// Tracing
RayCount = SSGISettings.FindPropertyRelative("_rayCount");
StepCount = SSGISettings.FindPropertyRelative("_stepCount");
RefineIntersection = SSGISettings.FindPropertyRelative("RefineIntersection");
FullResolutionDepth = SSGISettings.FindPropertyRelative("FullResolutionDepth");
// Rendering
Checkerboard = SSGISettings.FindPropertyRelative("Checkerboard");
RenderScale = SSGISettings.FindPropertyRelative("_renderScale");
// Denoising tab
BrightnessClamp = DenoisingSettings.FindPropertyRelative("BrightnessClamp");
MaxValueBrightnessClamp = DenoisingSettings.FindPropertyRelative("_maxValueBrightnessClamp");
MaxDeviationBrightnessClamp = DenoisingSettings.FindPropertyRelative("_maxDeviationBrightnessClamp");
// ReSTIR Validation
HalfStepValidation = DenoisingSettings.FindPropertyRelative("HalfStepValidation");
SpatialOcclusionValidation = DenoisingSettings.FindPropertyRelative("SpatialOcclusionValidation");
TemporalLightingValidation = DenoisingSettings.FindPropertyRelative("TemporalLightingValidation");
TemporalOcclusionValidation = DenoisingSettings.FindPropertyRelative("TemporalOcclusionValidation");
// Spatial
SpatialRadius = DenoisingSettings.FindPropertyRelative("_spatialRadius");
Adaptivity = DenoisingSettings.FindPropertyRelative("_adaptivity");
// SpatialPassCount = DenoisingData.FindPropertyRelative("_spatialPassCount");
RecurrentBlur = DenoisingSettings.FindPropertyRelative("RecurrentBlur");
FireflySuppression = DenoisingSettings.FindPropertyRelative("FireflySuppression");
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2a391e47a8d563041a61da4e5d3d9d51
timeCreated: 1674796690
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HTraceSSGIProfileEditor.cs
uploadId: 840002

View File

@@ -0,0 +1,31 @@
//pipelinedefine
#define H_URP
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Infrastructure.URP;
using UnityEditor;
using UnityEditor.Rendering.Universal;
namespace HTraceSSGI.Scripts.Editor
{
[CustomEditor(typeof(HTraceSSGIRendererFeature))]
public class HTraceSSGIRendererFeatureEditor : ScriptableRendererFeatureEditor
{
SerializedProperty useVolumes;
private void OnEnable()
{
useVolumes = serializedObject.FindProperty("UseVolumes");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(useVolumes);
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c07ed2e0332d41d28f81cb8f1976129b
timeCreated: 1761571199
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HTraceSSGIRendererFeatureEditor.cs
uploadId: 840002

View File

@@ -0,0 +1,468 @@
//pipelinedefine
#define H_URP
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Data.Private;
using HTraceSSGI.Scripts.Data.Public;
using HTraceSSGI.Scripts.Editor.WindowsAndMenu;
using HTraceSSGI.Scripts.Globals;
using HTraceSSGI.Scripts.Infrastructure.URP;
using UnityEditor;
using UnityEditor.Rendering;
using UnityEditor.AnimatedValues;
namespace HTraceSSGI.Scripts.Editor
{
[CanEditMultipleObjects]
#if UNITY_2022_2_OR_NEWER
[CustomEditor(typeof(HTraceSSGIVolume))]
#else
[VolumeComponentEditor(typeof(HTraceSSGIVolume))]
#endif
internal class HTraceSSGIVolumeEditorURP : VolumeComponentEditor
{
private const string NO_RENDERER_FEATURE_MESSAGE = "HTrace Screen Space Global Illumination feature is missing in the active URP renderer.";
private const string RENDERER_FEATURE_OFF_MESSAGE = "HTrace Screen Space Global Illumination is disabled in the active URP renderer.";
private const string LIGHTING_MULTIPLIER_ABOVE_1_MESSAGE = "Ambient Override may not work correctly when the Environment Lighting Multiplier is set above 1 !";
private const string RENDETIN_LIGHTING_SETTINGS_WINDOW_PATH = "Window/Rendering/Lighting";
private Texture2D m_Icon;
SerializedDataParameter p_Enable;
// General
internal SerializedDataParameter p_DebugMode;
internal SerializedDataParameter p_HBuffer;
internal SerializedDataParameter p_ExcludeCastingMask;
internal SerializedDataParameter p_ExcludeReceivingMask;
internal SerializedDataParameter p_FallbackType;
internal SerializedDataParameter p_SkyIntensity;
internal SerializedDataParameter p_MetallicIndirectFallback;
internal SerializedDataParameter p_AmbientOverride;
internal SerializedDataParameter p_Multibounce;
//Apv
internal SerializedDataParameter p_ViewBias;
internal SerializedDataParameter p_NormalBias;
internal SerializedDataParameter p_SamplingNoise;
internal SerializedDataParameter p_IntensityMultiplier;
internal SerializedDataParameter p_DenoiseFallback;
// Visuals
internal SerializedDataParameter p_BackfaceLighting;
internal SerializedDataParameter p_MaxRayLength;
internal SerializedDataParameter p_ThicknessMode;
internal SerializedDataParameter p_Thickness;
internal SerializedDataParameter p_Intensity;
internal SerializedDataParameter p_Falloff;
// Quality tab
// Tracing
internal SerializedDataParameter p_RayCount;
internal SerializedDataParameter p_StepCount;
internal SerializedDataParameter p_RefineIntersection;
internal SerializedDataParameter p_FullResolutionDepth;
// Rendering
internal SerializedDataParameter p_Checkerboard;
internal SerializedDataParameter p_RenderScale;
// Denoising tab
internal SerializedDataParameter p_BrightnessClamp;
internal SerializedDataParameter p_MaxValueBrightnessClamp;
internal SerializedDataParameter p_MaxDeviationBrightnessClamp;
// Temporal
internal SerializedDataParameter p_HalfStepValidation;
internal SerializedDataParameter p_SpatialOcclusionValidation;
internal SerializedDataParameter p_TemporalLightingValidation;
internal SerializedDataParameter p_TemporalOcclusionValidation;
// Spatial Filter
internal SerializedDataParameter p_SpatialRadius;
internal SerializedDataParameter p_Adaptivity;
internal SerializedDataParameter p_RecurrentBlur;
internal SerializedDataParameter p_FireflySuppression;
//Debug
internal SerializedDataParameter p_ShowBowels;
// Main foldout groups
private AnimBool AnimBoolGeneralTab;
private AnimBool AnimBoolQualityTab;
private AnimBool AnimBoolDenoisingTab;
private AnimBool AnimBoolDebugTab;
private AnimBool AnimBoolEMPTY;
// Menu state
private bool _showPipelineIntegration = true;
private bool _showVisualsArea = true;
private bool _showTracingArea = true;
private bool _showRenderingArea = true;
private bool _showRestirValidationArea = true;
private bool _showSpatialArea = true;
static HTraceSSGIPreset _preset = HTraceSSGIPreset.Balanced;
public override void OnEnable()
{
var o = new PropertyFetcher<HTraceSSGIVolume>(serializedObject);
m_Icon = Resources.Load<Texture2D>("SSGI UI Card");
p_Enable = Unpack(o.Find(x => x.Enable));
// General Settings
p_DebugMode = Unpack(o.Find(x => x.DebugMode));
p_HBuffer = Unpack(o.Find(x => x.HBuffer));
#if UNITY_2023_3_OR_NEWER
p_ExcludeReceivingMask = Unpack(o.Find(x => x.ExcludeReceivingMask));
p_ExcludeCastingMask = Unpack(o.Find(x => x.ExcludeCastingMask));
#endif
p_FallbackType = Unpack(o.Find(x => x.FallbackType));
p_SkyIntensity = Unpack(o.Find(x => x.SkyIntensity));
//Pipeline integration
p_MetallicIndirectFallback = Unpack(o.Find(x => x.MetallicIndirectFallback));
p_AmbientOverride = Unpack(o.Find(x => x.AmbientOverride));
p_Multibounce = Unpack(o.Find(x => x.Multibounce));
//Apv
p_ViewBias = Unpack(o.Find(x => x.ViewBias));
p_NormalBias = Unpack(o.Find(x => x.NormalBias));
p_SamplingNoise = Unpack(o.Find(x => x.SamplingNoise));
p_IntensityMultiplier = Unpack(o.Find(x => x.IntensityMultiplier));
p_DenoiseFallback = Unpack(o.Find(x => x.DenoiseFallback));
// Visuals
p_BackfaceLighting = Unpack(o.Find(x => x.BackfaceLighting));
p_MaxRayLength = Unpack(o.Find(x => x.MaxRayLength));
p_ThicknessMode = Unpack(o.Find(x => x.ThicknessMode));
p_Thickness = Unpack(o.Find(x => x.Thickness));
p_Intensity = Unpack(o.Find(x => x.Intensity));
p_Falloff = Unpack(o.Find(x => x.Falloff));
// Quality tab
// Tracing
p_RayCount = Unpack(o.Find(x => x.RayCount));
p_StepCount = Unpack(o.Find(x => x.StepCount));
p_RefineIntersection = Unpack(o.Find(x => x.RefineIntersection));
p_FullResolutionDepth = Unpack(o.Find(x => x.FullResolutionDepth));
// Rendering
p_Checkerboard = Unpack(o.Find(x => x.Checkerboard));
p_RenderScale = Unpack(o.Find(x => x.RenderScale));
// Denoising tab
p_BrightnessClamp = Unpack(o.Find(x => x.BrightnessClamp));
p_MaxValueBrightnessClamp = Unpack(o.Find(x => x.MaxValueBrightnessClamp));
p_MaxDeviationBrightnessClamp = Unpack(o.Find(x => x.MaxDeviationBrightnessClamp));
// Temporal
p_HalfStepValidation = Unpack(o.Find(x => x.HalfStepValidation));
p_SpatialOcclusionValidation = Unpack(o.Find(x => x.SpatialOcclusionValidation));
p_TemporalLightingValidation = Unpack(o.Find(x => x.TemporalLightingValidation));
p_TemporalOcclusionValidation = Unpack(o.Find(x => x.TemporalOcclusionValidation));
// Spatial Filter
p_SpatialRadius = Unpack(o.Find(x => x.SpatialRadius));
p_Adaptivity = Unpack(o.Find(x => x.Adaptivity));
p_RecurrentBlur = Unpack(o.Find(x => x.RecurrentBlur));
p_FireflySuppression = Unpack(o.Find(x => x.FireflySuppression));
// Debug
p_ShowBowels = Unpack(o.Find(x => x.ShowBowels));
AnimBoolGeneralTab = new AnimBool(true);
AnimBoolGeneralTab.valueChanged.RemoveAllListeners();
AnimBoolGeneralTab.valueChanged.AddListener(Repaint);
AnimBoolQualityTab = new AnimBool(true);
AnimBoolQualityTab.valueChanged.RemoveAllListeners();
AnimBoolQualityTab.valueChanged.AddListener(Repaint);
AnimBoolDenoisingTab = new AnimBool(true);
AnimBoolDenoisingTab.valueChanged.RemoveAllListeners();
AnimBoolDenoisingTab.valueChanged.AddListener(Repaint);
AnimBoolDebugTab = new AnimBool(true); //_debugTab.boolValue
AnimBoolDebugTab.valueChanged.RemoveAllListeners();
AnimBoolDebugTab.valueChanged.AddListener(Repaint);
AnimBoolEMPTY = new AnimBool(false);
}
public override void OnInspectorGUI()
{
var hTraceRendererFeature = HRendererURP.GetRendererFeatureByTypeName(nameof(HTraceSSGIRendererFeature)) as HTraceSSGIRendererFeature;
if (hTraceRendererFeature == null)
{
EditorGUILayout.Space();
CoreEditorUtils.DrawFixMeBox(NO_RENDERER_FEATURE_MESSAGE, MessageType.Error, HEditorStyles.FixButtonName, () =>
{
HRendererURP.AddHTraceRendererFeatureToUniversalRendererData();
GUIUtility.ExitGUI();
});
//EditorGUILayout.HelpBox(NO_RENDERER_FEATURE_MESSAGE, MessageType.Error, wide: true);
return;
}
else if (!hTraceRendererFeature.isActive)
{
EditorGUILayout.Space();
CoreEditorUtils.DrawFixMeBox(RENDERER_FEATURE_OFF_MESSAGE, MessageType.Warning, HEditorStyles.FixButtonName, () =>
{
hTraceRendererFeature.SetActive(true);
GUIUtility.ExitGUI();
});
EditorGUILayout.Space();
}
if (m_Icon != null)
{
//GUILayout.Label(m_Icon, HEditorStyles.icon, GUILayout.ExpandWidth(false));
Rect rect = GUILayoutUtility.GetAspectRect((float)m_Icon.width / m_Icon.height);
rect.xMin += 4;
rect.xMax -= 4;
GUI.DrawTexture(rect, m_Icon, ScaleMode.ScaleToFit);
EditorGUILayout.Space(5f);
}
if (HTraceSSGIRendererFeature.IsUseVolumes == false)
{
CoreEditorUtils.DrawFixMeBox("\"Use Volumes\" checkbox in the HTrace SSGI Renderer feature is disabled, use the HTraceSSGI component in your scenes.", MessageType.Warning, HEditorStyles.ChangeButtonName, () =>
{
hTraceRendererFeature.UseVolumes = true;
GUIUtility.ExitGUI();
});
return;
}
PropertyField(p_Enable);
EditorGUILayout.Space(5f);
// ------------------------------------- Global settings ----------------------------------------------------------
using (new HEditorUtils.FoldoutScope(AnimBoolGeneralTab, out var shouldDraw, HEditorStyles.GlobalSettings.text))
{
if (shouldDraw)
{
using (new IndentLevelScope(10))
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Preset");
_preset = (HTraceSSGIPreset)EditorGUILayout.EnumPopup(_preset);
if (GUILayout.Button("Apply", GUILayout.Width(60)))
{
HTraceSSGIPresetData.ApplyPresetVolume(this, _preset);
EditorUtility.SetDirty(target);
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.Space(5f);
PropertyField(p_DebugMode);
if((DebugMode)p_DebugMode.value.enumValueIndex == DebugMode.MainBuffers)
{
PropertyField(p_HBuffer);
}
EditorGUILayout.Space(5f);
#if UNITY_2023_3_OR_NEWER
PropertyField(p_ExcludeCastingMask);
PropertyField(p_ExcludeReceivingMask);
#endif
EditorGUILayout.Space(3f);
PropertyField(p_FallbackType);
if ((Globals.FallbackType)p_FallbackType.value.enumValueIndex == Globals.FallbackType.Sky)
PropertyField(p_SkyIntensity);
#if UNITY_6000_0_OR_NEWER
if ((FallbackType)p_FallbackType.value.enumValueIndex == Globals.FallbackType.APV)
{
using (new IndentLevelScope())
{
PropertyField(p_ViewBias);
PropertyField(p_NormalBias);
PropertyField(p_SamplingNoise);
PropertyField(p_IntensityMultiplier);
PropertyField(p_DenoiseFallback);
}
}
if ((FallbackType)p_FallbackType.value.enumValueIndex == Globals.FallbackType.Sky)
{
using (new IndentLevelScope())
PropertyField(p_DenoiseFallback);
}
#endif
EditorGUILayout.Space(5f);
{
_showPipelineIntegration = EditorGUILayout.BeginFoldoutHeaderGroup(_showPipelineIntegration, HEditorStyles.PipelineIntegration.text);
if (_showPipelineIntegration)
{
using (new IndentLevelScope())
{
PropertyField(p_MetallicIndirectFallback);
PropertyField(p_AmbientOverride);
if (RenderSettings.ambientIntensity > 1.0f && p_AmbientOverride.value.boolValue == true)
{
CoreEditorUtils.DrawFixMeBox(LIGHTING_MULTIPLIER_ABOVE_1_MESSAGE, MessageType.Warning, HEditorStyles.OpenButtonName, () =>
{
EditorApplication.ExecuteMenuItem(RENDETIN_LIGHTING_SETTINGS_WINDOW_PATH);
GUIUtility.ExitGUI();
});
}
PropertyField(p_Multibounce);
}
EditorGUILayout.Space(3f);
}
EditorGUILayout.EndFoldoutHeaderGroup();
}
EditorGUILayout.Space(3f);
{
_showVisualsArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showVisualsArea, HEditorStyles.Visuals.text);
if (_showVisualsArea)
{
using (new IndentLevelScope())
{
PropertyField(p_BackfaceLighting);
PropertyField(p_MaxRayLength);
if (p_MaxRayLength.value.floatValue < 0)
p_MaxRayLength.value.floatValue = 0f;
PropertyField(p_ThicknessMode);
PropertyField(p_Thickness);
PropertyField(p_Intensity);
PropertyField(p_Falloff);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
}
}
}
// ------------------------------------- Quality ----------------------------------------------------------
using (new HEditorUtils.FoldoutScope(AnimBoolQualityTab, out var shouldDraw, HEditorStyles.Quality.text))
{
if (shouldDraw)
{
EditorGUILayout.Space(3f);
_showTracingArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showTracingArea, HEditorStyles.Tracing.text);
if (_showTracingArea)
{
using (new IndentLevelScope())
{
PropertyField(p_RayCount);
PropertyField(p_StepCount);
PropertyField(p_RefineIntersection);
PropertyField(p_FullResolutionDepth);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(5f);
_showRenderingArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showRenderingArea, HEditorStyles.Rendering.text);
if (_showRenderingArea)
{
using (new IndentLevelScope())
{
PropertyField(p_Checkerboard);
PropertyField(p_RenderScale);
p_RenderScale.value.floatValue = p_RenderScale.value.floatValue.RoundToCeilTail(2);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
}
}
// ------------------------------------- Denoising ----------------------------------------------------------
using (new HEditorUtils.FoldoutScope(AnimBoolDenoisingTab, out var shouldDraw, HEditorStyles.Denoising.text))
{
if (shouldDraw)
{
EditorGUILayout.Space(3f);
PropertyField(p_BrightnessClamp);
if ((BrightnessClamp)p_BrightnessClamp.value.enumValueIndex == Globals.BrightnessClamp.Manual)
PropertyField(p_MaxValueBrightnessClamp);
if ((BrightnessClamp)p_BrightnessClamp.value.enumValueIndex == Globals.BrightnessClamp.Automatic)
PropertyField(p_MaxDeviationBrightnessClamp);
EditorGUILayout.Space(5f);
_showRestirValidationArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showRestirValidationArea, HEditorStyles.ReSTIRValidation.text);
if (_showRestirValidationArea)
{
using (new IndentLevelScope())
{
PropertyField(p_HalfStepValidation);
EditorGUILayout.Space(3f);
EditorGUILayout.LabelField(HEditorStyles.ValidationTypes, HEditorStyles.bold);
PropertyField(p_SpatialOcclusionValidation);
PropertyField(p_TemporalLightingValidation);
PropertyField(p_TemporalOcclusionValidation);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(5f);
_showSpatialArea = EditorGUILayout.BeginFoldoutHeaderGroup(_showSpatialArea, HEditorStyles.SpatialFilter.text);
if (_showSpatialArea)
{
using (new IndentLevelScope())
{
PropertyField(p_SpatialRadius);
PropertyField(p_Adaptivity);
PropertyField(p_RecurrentBlur);
PropertyField(p_FireflySuppression);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
EditorGUILayout.Space(3f);
}
}
HEditorUtils.HorizontalLine(1f);
EditorGUILayout.Space(3f);
//HEditorUtils.DrawClickableLink($"HTrace AO Version: {HNames.HTRACE_AO_VERSION}", HNames.HTRACE_AO_DOCUMENTATION_LINK, true);
HEditorUtils.DrawLinkRow(
($"Documentation (v." + HNames.HTRACE_SSGI_VERSION + ")", () => Application.OpenURL(HNames.HTRACE_SSGI_DOCUMENTATION_LINK)),
("Discord", () => Application.OpenURL(HNames.HTRACE_DISCORD_LINK)),
("Bug report", () => HBugReporterWindow.ShowWindow())
);
}
private void DebugPart()
{
using (new HEditorUtils.FoldoutScope(AnimBoolDebugTab, out var shouldDraw, HEditorStyles.Debug.text))
{
if (shouldDraw)
{
EditorGUILayout.Space(3f);
PropertyField(p_ShowBowels);
EditorGUILayout.Space(3f);
}
}
}
}
}
#endif //UNITY_EDITOR

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b83a85dd560147da90cf7c0d4143a78c
timeCreated: 1757342219
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/HTraceSSGIVolumeEditorURP.cs
uploadId: 840002

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f30ffee4f8a6491fa30599d846fd00eb
timeCreated: 1757344404

View File

@@ -0,0 +1,41 @@
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Extensions;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
[InitializeOnLoad]
public static class AssetWelcomeLoader
{
static AssetWelcomeLoader()
{
EditorApplication.delayCall += TryShowWelcome;
}
private static void TryShowWelcome()
{
if (SessionState.GetBool(HNames.HTRACE_WELCOME_SHOW_SESSION, false))
return;
SessionState.SetBool(HNames.HTRACE_WELCOME_SHOW_SESSION, true);
bool dontShowAgain = EditorPrefs.GetBool(HNames.HTRACE_SHOW_KEY, false);
string currentUnityVersion = Application.unityVersion;
string savedUnityVersion = EditorPrefs.GetString(HNames.HTRACE_UNITY_VERSION_KEY, string.Empty);
bool unityVersionChanged = savedUnityVersion != currentUnityVersion;
bool isLts = HExtensions.IsUnityLTS(currentUnityVersion);
bool shouldShowWelcome = !dontShowAgain || (unityVersionChanged && !isLts);
if (shouldShowWelcome)
{
AssetWelcomeWindow.ShowWindow();
}
EditorPrefs.SetString(HNames.HTRACE_UNITY_VERSION_KEY, currentUnityVersion);
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b548ee64286c45f48d34d1dc643c5c30
timeCreated: 1766077710
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/AssetWelcomeLoader.cs
uploadId: 840002

View File

@@ -0,0 +1,139 @@
#if UNITY_EDITOR
using System;
using HTraceSSGI.Scripts.Extensions;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
public class AssetWelcomeWindow : EditorWindow
{
private static Texture2D _icon;
public static void ShowWindow()
{
_icon = Resources.Load<Texture2D>("SSGI UI Card");
var window = GetWindow<AssetWelcomeWindow>("Welcome");
Vector2 minSize = new Vector2(600, 240);
if (HExtensions.IsUnityLTS(Application.unityVersion))
minSize.y -= 45;
if (_icon != null)
minSize.y += 100;
Vector2 maxSize = minSize - new Vector2(1, 1);
window.minSize = minSize;
window.maxSize = maxSize;
Rect main = EditorGUIUtility.GetMainWindowPosition();
window.position = new Rect(
main.x + (main.width - minSize.x) / 2,
main.y + (main.height - minSize.y) / 2,
minSize.x,
minSize.y
);
}
private void OnGUI()
{
if (_icon != null)
{
GUILayout.Space(5);
Rect rect = GUILayoutUtility.GetAspectRect((float)_icon.width / _icon.height);
rect.xMin += 4;
rect.xMax -= 4;
GUI.DrawTexture(rect, _icon, ScaleMode.ScaleToFit);
EditorGUILayout.Space(5f);
}
GUILayout.Space(5);
GUILayout.Label($"Thank you for purchasing {HNames.ASSET_NAME_FULL_WITH_DOTS}!", EditorStyles.boldLabel);
GUILayout.Space(5);
DrawUnityVersionWarning();
GUILayout.Space(10);
var richLabel = new GUIStyle(EditorStyles.wordWrappedLabel)
{
richText = true
};
GUILayout.Label(
"Please make sure to read the <b>Documentation</b> before using the asset.\n" +
"If you run into any issues, check the <b>Known Issues</b> and <b>FAQ</b> sections before reporting a bug.",
richLabel
);
GUILayout.Space(5);
DrawLinksLine();
GUILayout.Space(10);
GUILayout.Label(
"Shortcuts to the Documentation, Discord support channel, and Bug Report form " +
"can be found at the bottom of the HTrace UI.",
EditorStyles.wordWrappedLabel
);
GUILayout.Space(15);
bool dontShow = GUILayout.Toggle(
EditorPrefs.GetBool(HNames.HTRACE_SHOW_KEY, false),
"Don't show next time"
);
EditorPrefs.SetBool(HNames.HTRACE_SHOW_KEY, dontShow);
GUILayout.Space(10);
if (GUILayout.Button("I understand, close window"))
{
Close();
}
}
private static void DrawUnityVersionWarning()
{
string unityVersion = Application.unityVersion;
if (!HExtensions.IsUnityLTS(unityVersion))
{
EditorGUILayout.HelpBox(
$"The current Unity version ({unityVersion}) is not an LTS release.\n" +
"Bug fixes for non-LTS releases are not guaranteed.",
MessageType.Warning
);
}
}
private static void DrawLinksLine()
{
EditorGUILayout.BeginHorizontal();
DrawLinkButton("Documentation", HNames.HTRACE_SSGI_DOCUMENTATION_LINK);
GUILayout.Label("|", GUILayout.Width(10));
DrawLinkButton("Known Issues", HNames.HTRACE_SSGI_DOCUMENTATION_LINK_KNOWN_ISSUES);
GUILayout.Label("|", GUILayout.Width(10));
DrawLinkButton("FAQ", HNames.HTRACE_SSGI_DOCUMENTATION_LINK_FAQ);
EditorGUILayout.EndHorizontal();
}
private static void DrawLinkButton(string label, string url)
{
var style = new GUIStyle(EditorStyles.linkLabel)
{
wordWrap = false
};
if (GUILayout.Button(label, style, GUILayout.Width(EditorStyles.linkLabel.CalcSize(new GUIContent(label)).x)))
{
Application.OpenURL(url);
}
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 37241604af0a4e2ea194f52d530a3b97
timeCreated: 1766077786
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/AssetWelcomeWindow.cs
uploadId: 840002

View File

@@ -0,0 +1,98 @@
using HTraceSSGI.Scripts.Globals;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
#if UNITY_EDITOR
public class HBugReporterWindow : EditorWindow
{
private string _reportData = "";
private GUIStyle _styleLabel;
private Vector2 _scrollPosition = Vector2.zero;
[MenuItem("Window/HTrace/Report a Bug HTrace SSGI", false, priority: 32)]
public static void ShowWindow()
{
var window = GetWindow<HBugReporterWindow>(false, "Report Bug", true);
window.minSize = new Vector2(400, 330);
}
void OnEnable()
{
_reportData = "";
var pipeline = HRenderer.CurrentHRenderPipeline.ToString();
_reportData += $"{HNames.ASSET_NAME_FULL} Version: {HNames.HTRACE_SSGI_VERSION}" + "\n";
_reportData += "\n";
_reportData += "Unity Version: " + Application.unityVersion + "\n";
_reportData += "Pipeline: " + pipeline + "\n";
_reportData += "Platform: " + Application.platform + "\n";
_reportData += "Graphics API: " + SystemInfo.graphicsDeviceType + "\n";
_reportData += "\n";
_reportData += "OS: " + SystemInfo.operatingSystem + "\n";
_reportData += "Graphics: " + SystemInfo.graphicsDeviceName + "\n";
_reportData += "\n";
_reportData += "Additional details:\n";
}
void OnGUI()
{
SetGUIStyles();
GUILayout.Space(-2);
GUILayout.BeginHorizontal();
GUILayout.Space(15);
GUILayout.BeginVertical();
_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 80));
GUILayout.Label(_reportData, _styleLabel);
GUILayout.Space(15);
if (GUILayout.Button("Copy Details To Clipboard", GUILayout.Height(24)))
{
var copyData = _reportData;
GUIUtility.systemCopyBuffer = copyData;
}
if (GUILayout.Button("Report Bug on Discord", GUILayout.Height(24)))
{
Application.OpenURL(HNames.HTRACE_DISCORD_BUGS_SSGI_LINK);
}
GUILayout.FlexibleSpace();
GUILayout.Space(20);
GUILayout.EndScrollView();
GUILayout.EndVertical();
GUILayout.Space(13);
GUILayout.EndHorizontal();
}
void SetGUIStyles()
{
_styleLabel = new GUIStyle(EditorStyles.label)
{
richText = true,
};
}
}
#endif
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dba5cecf144f410fb38b07e1de8c0ca1
timeCreated: 1757344409
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/HBugReporterWindow.cs
uploadId: 840002

View File

@@ -0,0 +1,52 @@
//pipelinedefine
#define H_URP
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Data.Private;
using HTraceSSGI.Scripts.Extensions;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEditor.ShortcutManagement;
using UnityEngine;
using HTraceSSGI.Scripts.Infrastructure.URP;
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
#if UNITY_EDITOR
public class HMenuAndFilesManager : EditorWindow
{
[MenuItem("GameObject/Rendering/HTrace Screen Space Global Illumination", false, priority: 30)]
static void CreateHTraceGameObject(MenuCommand menuCommand)
{
HTraceSSGI[] hTraces = FindObjectsOfType(typeof(HTraceSSGI)) as HTraceSSGI[];
if (hTraces != null && hTraces.Length > 0)
{
return;
}
GameObject go = new GameObject(HNames.ASSET_NAME);
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
go.AddComponent<HTraceSSGI>();
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
Selection.activeObject = go;
}
[MenuItem("Window/HTrace/Add HTrace SSGI Render Feature to active RendererData", false, priority: 32)]
private static void AddRenderFeature()
{
HRendererURP.AddHTraceRendererFeatureToUniversalRendererData();
}
[MenuItem("Window/HTrace/Open HTrace SSGI documentation", false, priority: 32)]
private static void OpenDocumentation()
{
Application.OpenURL(HNames.HTRACE_SSGI_DOCUMENTATION_LINK);
}
}
#endif
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4097973eb33709247ad51c90310a5018
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/Editor/WindowsAndMenu/HMenuAndFilesManager.cs
uploadId: 840002