This commit is contained in:
2026-11-24 15:51:02 +01:00
parent cca4d73e41
commit f4aa17114a
22092 changed files with 5042406 additions and 0 deletions
@@ -0,0 +1,54 @@
using System.Linq;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(Bloom))]
sealed class BloomEditor : VolumeComponentEditor
{
SerializedDataParameter m_Threshold;
SerializedDataParameter m_Intensity;
SerializedDataParameter m_Scatter;
SerializedDataParameter m_Clamp;
SerializedDataParameter m_Tint;
SerializedDataParameter m_HighQualityFiltering;
SerializedDataParameter m_Filter;
SerializedDataParameter m_Downsample;
SerializedDataParameter m_MaxIterations;
SerializedDataParameter m_DirtTexture;
SerializedDataParameter m_DirtIntensity;
public override void OnEnable()
{
var o = new PropertyFetcher<Bloom>(serializedObject);
m_Threshold = Unpack(o.Find(x => x.threshold));
m_Intensity = Unpack(o.Find(x => x.intensity));
m_Scatter = Unpack(o.Find(x => x.scatter));
m_Clamp = Unpack(o.Find(x => x.clamp));
m_Tint = Unpack(o.Find(x => x.tint));
m_HighQualityFiltering = Unpack(o.Find(x => x.highQualityFiltering));
m_Filter = Unpack(o.Find(x => x.filter));
m_Downsample = Unpack(o.Find(x => x.downscale));
m_MaxIterations = Unpack(o.Find(x => x.maxIterations));
m_DirtTexture = Unpack(o.Find(x => x.dirtTexture));
m_DirtIntensity = Unpack(o.Find(x => x.dirtIntensity));
}
public override void OnInspectorGUI()
{
PropertyField(m_Threshold);
PropertyField(m_Intensity);
PropertyField(m_Scatter);
PropertyField(m_Tint);
PropertyField(m_Clamp);
PropertyField(m_HighQualityFiltering);
PropertyField(m_Filter);
PropertyField(m_Downsample);
PropertyField(m_MaxIterations);
PropertyField(m_DirtTexture);
PropertyField(m_DirtIntensity);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9c7e18910396a06418ff835346f291c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,76 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(ChannelMixer))]
sealed class ChannelMixerEditor : VolumeComponentEditor
{
SerializedDataParameter m_RedOutRedIn;
SerializedDataParameter m_RedOutGreenIn;
SerializedDataParameter m_RedOutBlueIn;
SerializedDataParameter m_GreenOutRedIn;
SerializedDataParameter m_GreenOutGreenIn;
SerializedDataParameter m_GreenOutBlueIn;
SerializedDataParameter m_BlueOutRedIn;
SerializedDataParameter m_BlueOutGreenIn;
SerializedDataParameter m_BlueOutBlueIn;
SavedInt m_SelectedChannel;
public override void OnEnable()
{
var o = new PropertyFetcher<ChannelMixer>(serializedObject);
m_RedOutRedIn = Unpack(o.Find(x => x.redOutRedIn));
m_RedOutGreenIn = Unpack(o.Find(x => x.redOutGreenIn));
m_RedOutBlueIn = Unpack(o.Find(x => x.redOutBlueIn));
m_GreenOutRedIn = Unpack(o.Find(x => x.greenOutRedIn));
m_GreenOutGreenIn = Unpack(o.Find(x => x.greenOutGreenIn));
m_GreenOutBlueIn = Unpack(o.Find(x => x.greenOutBlueIn));
m_BlueOutRedIn = Unpack(o.Find(x => x.blueOutRedIn));
m_BlueOutGreenIn = Unpack(o.Find(x => x.blueOutGreenIn));
m_BlueOutBlueIn = Unpack(o.Find(x => x.blueOutBlueIn));
m_SelectedChannel = new SavedInt($"{target.GetType()}.SelectedChannel", 0);
}
public override void OnInspectorGUI()
{
int currentChannel = m_SelectedChannel.value;
EditorGUI.BeginChangeCheck();
{
using (new EditorGUILayout.HorizontalScope())
{
if (GUILayout.Toggle(currentChannel == 0, EditorGUIUtility.TrTextContent("Red", "Red output channel."), EditorStyles.miniButtonLeft)) currentChannel = 0;
if (GUILayout.Toggle(currentChannel == 1, EditorGUIUtility.TrTextContent("Green", "Green output channel."), EditorStyles.miniButtonMid)) currentChannel = 1;
if (GUILayout.Toggle(currentChannel == 2, EditorGUIUtility.TrTextContent("Blue", "Blue output channel."), EditorStyles.miniButtonRight)) currentChannel = 2;
}
}
if (EditorGUI.EndChangeCheck())
GUI.FocusControl(null);
m_SelectedChannel.value = currentChannel;
if (currentChannel == 0)
{
PropertyField(m_RedOutRedIn, EditorGUIUtility.TrTextContent("Red"));
PropertyField(m_RedOutGreenIn, EditorGUIUtility.TrTextContent("Green"));
PropertyField(m_RedOutBlueIn, EditorGUIUtility.TrTextContent("Blue"));
}
else if (currentChannel == 1)
{
PropertyField(m_GreenOutRedIn, EditorGUIUtility.TrTextContent("Red"));
PropertyField(m_GreenOutGreenIn, EditorGUIUtility.TrTextContent("Green"));
PropertyField(m_GreenOutBlueIn, EditorGUIUtility.TrTextContent("Blue"));
}
else
{
PropertyField(m_BlueOutRedIn, EditorGUIUtility.TrTextContent("Red"));
PropertyField(m_BlueOutGreenIn, EditorGUIUtility.TrTextContent("Green"));
PropertyField(m_BlueOutBlueIn, EditorGUIUtility.TrTextContent("Blue"));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc48c81d1dba94248b35e9384c12bc77
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,395 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
using CurveState = InspectorCurveEditor.CurveState;
[CustomEditor(typeof(ColorCurves))]
sealed class ColorCurvesEditor : VolumeComponentEditor
{
SerializedDataParameter m_Master;
SerializedDataParameter m_Red;
SerializedDataParameter m_Green;
SerializedDataParameter m_Blue;
SerializedDataParameter m_HueVsHue;
SerializedDataParameter m_HueVsSat;
SerializedDataParameter m_SatVsSat;
SerializedDataParameter m_LumVsSat;
// Internal references to the actual animation curves
// Needed for the curve editor
SerializedProperty m_RawMaster;
SerializedProperty m_RawRed;
SerializedProperty m_RawGreen;
SerializedProperty m_RawBlue;
SerializedProperty m_RawHueVsHue;
SerializedProperty m_RawHueVsSat;
SerializedProperty m_RawSatVsSat;
SerializedProperty m_RawLumVsSat;
InspectorCurveEditor m_CurveEditor;
Dictionary<SerializedProperty, Color> m_CurveDict;
static Material s_MaterialGrid;
static GUIStyle s_PreLabel;
static string[] s_CurveNames =
{
"Master",
"Red",
"Green",
"Blue",
"Hue Vs Hue",
"Hue Vs Sat",
"Sat Vs Sat",
"Lum Vs Sat"
};
SavedInt m_SelectedCurve;
public override void OnEnable()
{
var o = new PropertyFetcher<ColorCurves>(serializedObject);
m_Master = Unpack(o.Find(x => x.master));
m_Red = Unpack(o.Find(x => x.red));
m_Green = Unpack(o.Find(x => x.green));
m_Blue = Unpack(o.Find(x => x.blue));
m_HueVsHue = Unpack(o.Find(x => x.hueVsHue));
m_HueVsSat = Unpack(o.Find(x => x.hueVsSat));
m_SatVsSat = Unpack(o.Find(x => x.satVsSat));
m_LumVsSat = Unpack(o.Find(x => x.lumVsSat));
m_RawMaster = o.Find("master.m_Value.m_Curve");
m_RawRed = o.Find("red.m_Value.m_Curve");
m_RawGreen = o.Find("green.m_Value.m_Curve");
m_RawBlue = o.Find("blue.m_Value.m_Curve");
m_RawHueVsHue = o.Find("hueVsHue.m_Value.m_Curve");
m_RawHueVsSat = o.Find("hueVsSat.m_Value.m_Curve");
m_RawSatVsSat = o.Find("satVsSat.m_Value.m_Curve");
m_RawLumVsSat = o.Find("lumVsSat.m_Value.m_Curve");
m_SelectedCurve = new SavedInt($"{target.GetType()}.SelectedCurve", 0);
// Prepare the curve editor
m_CurveEditor = new InspectorCurveEditor();
m_CurveDict = new Dictionary<SerializedProperty, Color>();
SetupCurve(m_RawMaster, new Color(1f, 1f, 1f), 2, false);
SetupCurve(m_RawRed, new Color(1f, 0f, 0f), 2, false);
SetupCurve(m_RawGreen, new Color(0f, 1f, 0f), 2, false);
SetupCurve(m_RawBlue, new Color(0f, 0.5f, 1f), 2, false);
SetupCurve(m_RawHueVsHue, new Color(1f, 1f, 1f), 0, true);
SetupCurve(m_RawHueVsSat, new Color(1f, 1f, 1f), 0, true);
SetupCurve(m_RawSatVsSat, new Color(1f, 1f, 1f), 0, false);
SetupCurve(m_RawLumVsSat, new Color(1f, 1f, 1f), 0, false);
}
void SetupCurve(SerializedProperty prop, Color color, uint minPointCount, bool loop)
{
var state = CurveState.defaultState;
state.color = color;
state.visible = false;
state.minPointCount = minPointCount;
state.onlyShowHandlesOnSelection = true;
state.zeroKeyConstantValue = 0.5f;
state.loopInBounds = loop;
m_CurveEditor.Add(prop, state);
m_CurveDict.Add(prop, color);
}
void ResetVisibleCurves()
{
foreach (var curve in m_CurveDict)
{
var state = m_CurveEditor.GetCurveState(curve.Key);
state.visible = false;
m_CurveEditor.SetCurveState(curve.Key, state);
}
}
void SetCurveVisible(SerializedProperty rawProp, SerializedProperty overrideProp)
{
var state = m_CurveEditor.GetCurveState(rawProp);
state.visible = true;
state.editable = overrideProp.boolValue;
m_CurveEditor.SetCurveState(rawProp, state);
}
void CurveOverrideToggle(SerializedProperty overrideProp)
{
overrideProp.boolValue = GUILayout.Toggle(overrideProp.boolValue, EditorGUIUtility.TrTextContent("Override"), EditorStyles.toolbarButton);
}
string MakeCurveSelectionPopupLabel(int id)
{
string label = s_CurveNames[id];
const string overrideSuffix = " (Overriding)";
switch (id)
{
case 0: if (m_Master.overrideState.boolValue) label += overrideSuffix; break;
case 1: if (m_Red.overrideState.boolValue) label += overrideSuffix; break;
case 2: if (m_Green.overrideState.boolValue) label += overrideSuffix; break;
case 3: if (m_Blue.overrideState.boolValue) label += overrideSuffix; break;
case 4: if (m_HueVsHue.overrideState.boolValue) label += overrideSuffix; break;
case 5: if (m_HueVsSat.overrideState.boolValue) label += overrideSuffix; break;
case 6: if (m_SatVsSat.overrideState.boolValue) label += overrideSuffix; break;
case 7: if (m_LumVsSat.overrideState.boolValue) label += overrideSuffix; break;
}
return label;
}
int DoCurveSelectionPopup(int id)
{
var label = MakeCurveSelectionPopupLabel(id);
GUILayout.Label(label, EditorStyles.toolbarPopup, GUILayout.MaxWidth(150f));
var lastRect = GUILayoutUtility.GetLastRect();
var e = Event.current;
if (e.type == EventType.MouseDown && e.button == 0 && lastRect.Contains(e.mousePosition))
{
var menu = new GenericMenu();
for (int i = 0; i < s_CurveNames.Length; i++)
{
if (i == 4)
menu.AddSeparator("");
int current = i; // Capture local for closure
var menuLabel = MakeCurveSelectionPopupLabel(i);
menu.AddItem(new GUIContent(menuLabel), current == id, () =>
{
m_SelectedCurve.value = current;
serializedObject.ApplyModifiedProperties();
});
}
menu.DropDown(new Rect(lastRect.xMin, lastRect.yMax, 1f, 1f));
}
return id;
}
void DrawBackgroundTexture(Rect rect, int pass)
{
if (s_MaterialGrid == null)
s_MaterialGrid = new Material(Shader.Find("Hidden/Universal Render Pipeline/Editor/CurveBackground")) { hideFlags = HideFlags.HideAndDontSave };
float scale = EditorGUIUtility.pixelsPerPoint;
var oldRt = RenderTexture.active;
var rt = RenderTexture.GetTemporary(Mathf.CeilToInt(rect.width * scale), Mathf.CeilToInt(rect.height * scale), 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
s_MaterialGrid.SetFloat("_DisabledState", GUI.enabled ? 1f : 0.5f);
Graphics.Blit(null, rt, s_MaterialGrid, pass);
RenderTexture.active = oldRt;
GUI.DrawTexture(rect, rt);
RenderTexture.ReleaseTemporary(rt);
}
void MarkTextureCurveAsDirty(int curveId)
{
var t = target as ColorCurves;
if (t == null)
return;
switch (curveId)
{
case 0: t.master.value.SetDirty(); break;
case 1: t.red.value.SetDirty(); break;
case 2: t.green.value.SetDirty(); break;
case 3: t.blue.value.SetDirty(); break;
case 4: t.hueVsHue.value.SetDirty(); break;
case 5: t.hueVsSat.value.SetDirty(); break;
case 6: t.satVsSat.value.SetDirty(); break;
case 7: t.lumVsSat.value.SetDirty(); break;
}
}
public override void OnInspectorGUI()
{
EditorGUILayout.Space();
ResetVisibleCurves();
using (new EditorGUI.DisabledGroupScope(serializedObject.isEditingMultipleObjects))
{
int curveEditingId;
SerializedProperty currentCurveRawProp = null;
// Top toolbar
using (new GUILayout.HorizontalScope(EditorStyles.toolbar))
{
curveEditingId = DoCurveSelectionPopup(m_SelectedCurve.value);
curveEditingId = Mathf.Clamp(curveEditingId, 0, 7);
EditorGUILayout.Space();
switch (curveEditingId)
{
case 0:
CurveOverrideToggle(m_Master.overrideState);
SetCurveVisible(m_RawMaster, m_Master.overrideState);
currentCurveRawProp = m_RawMaster;
break;
case 1:
CurveOverrideToggle(m_Red.overrideState);
SetCurveVisible(m_RawRed, m_Red.overrideState);
currentCurveRawProp = m_RawRed;
break;
case 2:
CurveOverrideToggle(m_Green.overrideState);
SetCurveVisible(m_RawGreen, m_Green.overrideState);
currentCurveRawProp = m_RawGreen;
break;
case 3:
CurveOverrideToggle(m_Blue.overrideState);
SetCurveVisible(m_RawBlue, m_Blue.overrideState);
currentCurveRawProp = m_RawBlue;
break;
case 4:
CurveOverrideToggle(m_HueVsHue.overrideState);
SetCurveVisible(m_RawHueVsHue, m_HueVsHue.overrideState);
currentCurveRawProp = m_RawHueVsHue;
break;
case 5:
CurveOverrideToggle(m_HueVsSat.overrideState);
SetCurveVisible(m_RawHueVsSat, m_HueVsSat.overrideState);
currentCurveRawProp = m_RawHueVsSat;
break;
case 6:
CurveOverrideToggle(m_SatVsSat.overrideState);
SetCurveVisible(m_RawSatVsSat, m_SatVsSat.overrideState);
currentCurveRawProp = m_RawSatVsSat;
break;
case 7:
CurveOverrideToggle(m_LumVsSat.overrideState);
SetCurveVisible(m_RawLumVsSat, m_LumVsSat.overrideState);
currentCurveRawProp = m_RawLumVsSat;
break;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Reset", EditorStyles.toolbarButton))
{
MarkTextureCurveAsDirty(curveEditingId);
switch (curveEditingId)
{
case 0: m_RawMaster.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f); break;
case 1: m_RawRed.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f); break;
case 2: m_RawGreen.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f); break;
case 3: m_RawBlue.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f); break;
case 4: m_RawHueVsHue.animationCurveValue = new AnimationCurve(); break;
case 5: m_RawHueVsSat.animationCurveValue = new AnimationCurve(); break;
case 6: m_RawSatVsSat.animationCurveValue = new AnimationCurve(); break;
case 7: m_RawLumVsSat.animationCurveValue = new AnimationCurve(); break;
}
}
m_SelectedCurve.value = curveEditingId;
}
// Curve area
var rect = GUILayoutUtility.GetAspectRect(2f);
var innerRect = new RectOffset(10, 10, 10, 10).Remove(rect);
if (Event.current.type == EventType.Repaint)
{
// Background
EditorGUI.DrawRect(rect, new Color(0.15f, 0.15f, 0.15f, 1f));
if (curveEditingId == 4 || curveEditingId == 5)
DrawBackgroundTexture(innerRect, 0);
else if (curveEditingId == 6 || curveEditingId == 7)
DrawBackgroundTexture(innerRect, 1);
// Bounds
Handles.color = Color.white * (GUI.enabled ? 1f : 0.5f);
Handles.DrawSolidRectangleWithOutline(innerRect, Color.clear, new Color(0.8f, 0.8f, 0.8f, 0.5f));
// Grid setup
Handles.color = new Color(1f, 1f, 1f, 0.05f);
int hLines = (int)Mathf.Sqrt(innerRect.width);
int vLines = (int)(hLines / (innerRect.width / innerRect.height));
// Vertical grid
int gridOffset = Mathf.FloorToInt(innerRect.width / hLines);
int gridPadding = ((int)(innerRect.width) % hLines) / 2;
for (int i = 1; i < hLines; i++)
{
var offset = i * Vector2.right * gridOffset;
offset.x += gridPadding;
Handles.DrawLine(innerRect.position + offset, new Vector2(innerRect.x, innerRect.yMax - 1) + offset);
}
// Horizontal grid
gridOffset = Mathf.FloorToInt(innerRect.height / vLines);
gridPadding = ((int)(innerRect.height) % vLines) / 2;
for (int i = 1; i < vLines; i++)
{
var offset = i * Vector2.up * gridOffset;
offset.y += gridPadding;
Handles.DrawLine(innerRect.position + offset, new Vector2(innerRect.xMax - 1, innerRect.y) + offset);
}
}
// Curve editor
using (new GUI.ClipScope(innerRect))
{
if (m_CurveEditor.OnGUI(new Rect(0, 0, innerRect.width - 1, innerRect.height - 1)))
{
Repaint();
GUI.changed = true;
MarkTextureCurveAsDirty(m_SelectedCurve.value);
}
}
if (Event.current.type == EventType.Repaint)
{
// Borders
Handles.color = Color.black;
Handles.DrawLine(new Vector2(rect.x, rect.y - 20f), new Vector2(rect.xMax, rect.y - 20f));
Handles.DrawLine(new Vector2(rect.x, rect.y - 21f), new Vector2(rect.x, rect.yMax));
Handles.DrawLine(new Vector2(rect.x, rect.yMax), new Vector2(rect.xMax, rect.yMax));
Handles.DrawLine(new Vector2(rect.xMax, rect.yMax), new Vector2(rect.xMax, rect.y - 20f));
bool editable = m_CurveEditor.GetCurveState(currentCurveRawProp).editable;
string editableString = editable ? string.Empty : "(Not Overriding)\n";
// Selection info
var selection = m_CurveEditor.GetSelection();
var infoRect = innerRect;
infoRect.x += 5f;
infoRect.width = 100f;
infoRect.height = 30f;
if (s_PreLabel == null)
s_PreLabel = new GUIStyle("ShurikenLabel");
if (selection.curve != null && selection.keyframeIndex > -1)
{
var key = selection.keyframe.Value;
GUI.Label(infoRect, $"{key.time:F3}\n{key.value:F3}", s_PreLabel);
}
else
{
GUI.Label(infoRect, editableString, s_PreLabel);
}
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 471d118113469fd45ba63677546e2020
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(ColorLookup))]
sealed class ColorLookupEditor : VolumeComponentEditor
{
SerializedDataParameter m_Texture;
SerializedDataParameter m_Contribution;
public override void OnEnable()
{
var o = new PropertyFetcher<ColorLookup>(serializedObject);
m_Texture = Unpack(o.Find(x => x.texture));
m_Contribution = Unpack(o.Find(x => x.contribution));
}
public override void OnInspectorGUI()
{
PropertyField(m_Texture, EditorGUIUtility.TrTextContent("Lookup Texture"));
var lut = m_Texture.value.objectReferenceValue;
if (lut != null && !((ColorLookup)target).ValidateLUT())
EditorGUILayout.HelpBox("Invalid lookup texture. It must be a non-sRGB 2D texture or render texture with the same size as set in the Universal Render Pipeline settings.", MessageType.Warning);
PropertyField(m_Contribution, EditorGUIUtility.TrTextContent("Contribution"));
var asset = UniversalRenderPipeline.asset;
if (asset != null)
{
if (asset.supportsHDR && asset.colorGradingMode == ColorGradingMode.HighDynamicRange)
EditorGUILayout.HelpBox("The Grading Mode in the current Universal Render Pipeline Asset is set to High Dynamic Range (HDR). As a result, this Lookup Table (LUT) will be applied after the internal color grading and tonemapping have been applied.", MessageType.Info);
else
EditorGUILayout.HelpBox("The Grading Mode in the current Universal Render Pipeline Asset is set to Low Dynamic Range (LDR). As a result, this Lookup Table (LUT) will be applied after tonemapping and before the internal color grading has been applied.", MessageType.Info);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5421f26576fd37c4c8a2389698c6a276
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,62 @@
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(DepthOfField))]
sealed class DepthOfFieldEditor : VolumeComponentEditor
{
SerializedDataParameter m_Mode;
SerializedDataParameter m_GaussianStart;
SerializedDataParameter m_GaussianEnd;
SerializedDataParameter m_GaussianMaxRadius;
SerializedDataParameter m_HighQualitySampling;
SerializedDataParameter m_FocusDistance;
SerializedDataParameter m_FocalLength;
SerializedDataParameter m_Aperture;
SerializedDataParameter m_BladeCount;
SerializedDataParameter m_BladeCurvature;
SerializedDataParameter m_BladeRotation;
public override void OnEnable()
{
var o = new PropertyFetcher<DepthOfField>(serializedObject);
m_Mode = Unpack(o.Find(x => x.mode));
m_GaussianStart = Unpack(o.Find(x => x.gaussianStart));
m_GaussianEnd = Unpack(o.Find(x => x.gaussianEnd));
m_GaussianMaxRadius = Unpack(o.Find(x => x.gaussianMaxRadius));
m_HighQualitySampling = Unpack(o.Find(x => x.highQualitySampling));
m_FocusDistance = Unpack(o.Find(x => x.focusDistance));
m_FocalLength = Unpack(o.Find(x => x.focalLength));
m_Aperture = Unpack(o.Find(x => x.aperture));
m_BladeCount = Unpack(o.Find(x => x.bladeCount));
m_BladeCurvature = Unpack(o.Find(x => x.bladeCurvature));
m_BladeRotation = Unpack(o.Find(x => x.bladeRotation));
}
public override void OnInspectorGUI()
{
PropertyField(m_Mode);
if (m_Mode.value.intValue == (int)DepthOfFieldMode.Gaussian)
{
PropertyField(m_GaussianStart, EditorGUIUtility.TrTextContent("Start"));
PropertyField(m_GaussianEnd, EditorGUIUtility.TrTextContent("End"));
PropertyField(m_GaussianMaxRadius, EditorGUIUtility.TrTextContent("Max Radius"));
PropertyField(m_HighQualitySampling);
}
else if (m_Mode.value.intValue == (int)DepthOfFieldMode.Bokeh)
{
PropertyField(m_FocusDistance);
PropertyField(m_FocalLength);
PropertyField(m_Aperture);
PropertyField(m_BladeCount);
PropertyField(m_BladeCurvature);
PropertyField(m_BladeRotation);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad710d4eb795c9e45a2dc60a0001e99b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,70 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(FilmGrain))]
sealed class FilmGrainEditor : VolumeComponentEditor
{
SerializedDataParameter m_Type;
SerializedDataParameter m_Intensity;
SerializedDataParameter m_Response;
SerializedDataParameter m_Texture;
public override void OnEnable()
{
var o = new PropertyFetcher<FilmGrain>(serializedObject);
m_Type = Unpack(o.Find(x => x.type));
m_Intensity = Unpack(o.Find(x => x.intensity));
m_Response = Unpack(o.Find(x => x.response));
m_Texture = Unpack(o.Find(x => x.texture));
}
public override void OnInspectorGUI()
{
PropertyField(m_Type);
if (m_Type.value.intValue == (int)FilmGrainLookup.Custom)
{
using (new IndentLevelScope())
PropertyField(m_Texture);
var texture = (target as FilmGrain).texture.value;
if (texture != null)
{
var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(texture)) as TextureImporter;
// Fails when using an internal texture as you can't change import settings on
// builtin resources, thus the check for null
if (importer != null)
{
bool valid = importer.mipmapEnabled == false
&& importer.alphaSource == TextureImporterAlphaSource.FromGrayScale
&& importer.filterMode == FilterMode.Point
&& importer.textureCompression == TextureImporterCompression.Uncompressed
&& importer.textureType == TextureImporterType.SingleChannel;
if (!valid)
CoreEditorUtils.DrawFixMeBox("Invalid texture import settings.", () => SetTextureImportSettings(importer));
}
}
}
PropertyField(m_Intensity);
PropertyField(m_Response);
}
static void SetTextureImportSettings(TextureImporter importer)
{
importer.textureType = TextureImporterType.SingleChannel;
importer.alphaSource = TextureImporterAlphaSource.FromGrayScale;
importer.mipmapEnabled = false;
importer.filterMode = FilterMode.Point;
importer.textureCompression = TextureImporterCompression.Uncompressed;
importer.SaveAndReimport();
AssetDatabase.Refresh();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38f8c5e5ea2961a43b1bb65bf161393c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,45 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(LiftGammaGain))]
sealed class LiftGammaGainEditor : VolumeComponentEditor
{
private static class Styles
{
public static readonly GUIContent liftLabel = EditorGUIUtility.TrTextContent("Lift", "Use this to control and apply a hue to the dark tones. This has a more exaggerated effect on shadows.");
public static readonly GUIContent gammaLabel = EditorGUIUtility.TrTextContent("Gamma", "Use this to control and apply a hue to the mid-range tones with a power function.");
public static readonly GUIContent gainLabel = EditorGUIUtility.TrTextContent("Gain", "Use this to increase and apply a hue to the signal and make highlights brighter.");
}
SerializedDataParameter m_Lift;
SerializedDataParameter m_Gamma;
SerializedDataParameter m_Gain;
readonly TrackballUIDrawer m_TrackballUIDrawer = new TrackballUIDrawer();
public override void OnEnable()
{
var o = new PropertyFetcher<LiftGammaGain>(serializedObject);
m_Lift = Unpack(o.Find(x => x.lift));
m_Gamma = Unpack(o.Find(x => x.gamma));
m_Gain = Unpack(o.Find(x => x.gain));
}
public override void OnInspectorGUI()
{
using (new EditorGUILayout.HorizontalScope())
{
m_TrackballUIDrawer.OnGUI(m_Lift.value, enableOverrides ? m_Lift.overrideState : null, Styles.liftLabel, GetLiftValue);
GUILayout.Space(4f);
m_TrackballUIDrawer.OnGUI(m_Gamma.value, enableOverrides ? m_Gamma.overrideState : null, Styles.gammaLabel, GetLiftValue);
GUILayout.Space(4f);
m_TrackballUIDrawer.OnGUI(m_Gain.value, enableOverrides ? m_Gain.overrideState : null, Styles.gainLabel, GetLiftValue);
}
}
static Vector3 GetLiftValue(Vector4 x) => new Vector3(x.x + x.w, x.y + x.w, x.z + x.w);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5a5420665d101df4c8b55860ae8aaa17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,40 @@
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(MotionBlur))]
sealed class MotionBlurEditor : VolumeComponentEditor
{
SerializedDataParameter m_Mode;
SerializedDataParameter m_Quality;
SerializedDataParameter m_Intensity;
SerializedDataParameter m_Clamp;
public override void OnEnable()
{
var o = new PropertyFetcher<MotionBlur>(serializedObject);
m_Mode = Unpack(o.Find(x => x.mode));
m_Quality = Unpack(o.Find(x => x.quality));
m_Intensity = Unpack(o.Find(x => x.intensity));
m_Clamp = Unpack(o.Find(x => x.clamp));
}
public override void OnInspectorGUI()
{
//PropertyField(m_Mode);
//if (m_Mode.value.intValue == (int)MotionBlurMode.CameraOnly)
//{
PropertyField(m_Mode);
PropertyField(m_Quality);
PropertyField(m_Intensity);
PropertyField(m_Clamp);
//}
//else
//{
// EditorGUILayout.HelpBox("Object motion blur is not supported on the Universal Render Pipeline yet.", MessageType.Info);
//}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49e2a2aa8fc7a8d4aa8e8dd82ac844dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,259 @@
#if MODERN_SSAO
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(ScreenSpaceAmbientOcclusionVolumeOverride))]
sealed class ScreenSpaceAmbientOcclusionVolumeEditor : UniversalRenderPipelineVolumeComponentEditor
{
static class Styles
{
public static readonly GUIContent qualitySettings = EditorGUIUtility.TrTextContent("Quality Settings");
public static readonly GUIContent temporalAccumulation = EditorGUIUtility.TrTextContent("Temporal Accumulation");
public static readonly GUIContent enable = EditorGUIUtility.TrTextContent("Enable", "Enable temporal filtering to reduce noise and improve stability over time.");
public static readonly GUIContent minimumRadiusInPixels = EditorGUIUtility.TrTextContent("Minimum Radius (Pixels)", "Minimum radius in pixels guaranteed by GTAO. Acts as a screen-space floor on the world-space Radius so the effect remains visible at a distance.");
public static readonly GUIContent ghostingMitigation = EditorGUIUtility.TrTextContent("Ghosting Mitigation", "Controls how aggressively temporal accumulation reduces ghosting. Higher values reject more history but can increase noise.");
public static readonly GUIContent historyLength = EditorGUIUtility.TrTextContent("History Length", "Controls the length of the temporal history. Higher values produce smoother, more stable results but can increase ghosting.");
public static readonly GUIContent useComputeShader = EditorGUIUtility.TrTextContent("Use Compute Shader", "When enabled, uses compute shaders for GTAO calculation. Provides temporal filtering support and configurable direction/step counts.");
public static readonly GUIContent spatialFilter = EditorGUIUtility.TrTextContent("Spatial Filter", "Spatial filter used by the GTAO compute path.");
}
SerializedDataParameter m_Mode;
SerializedDataParameter m_Quality;
SerializedDataParameter m_Intensity;
SerializedDataParameter m_Radius;
SerializedDataParameter m_DirectLightingStrength;
SerializedDataParameter m_FalloffDistance;
SerializedDataParameter m_Downsample;
SerializedDataParameter m_AfterOpaque;
SerializedDataParameter m_BlurQuality;
SerializedDataParameter m_SampleCount;
SerializedDataParameter m_Method;
SerializedDataParameter m_DepthSource;
SerializedDataParameter m_NormalQuality;
SerializedDataParameter m_MinimumRadiusInPixels;
SerializedDataParameter m_UseComputeShader;
SerializedDataParameter m_SpatialFilter;
SerializedDataParameter m_TemporalFilter;
SerializedDataParameter m_GhostingMitigation;
SerializedDataParameter m_HistoryLength;
SerializedDataParameter m_DirectionCount;
SerializedDataParameter m_StepCount;
public override void OnEnable()
{
base.OnEnable();
var o = new PropertyFetcher<ScreenSpaceAmbientOcclusionVolumeOverride>(serializedObject);
m_Mode = Unpack(o.Find("m_Mode"));
m_Quality = Unpack(o.Find("m_Quality"));
m_Intensity = Unpack(o.Find("m_Intensity"));
m_Radius = Unpack(o.Find("m_Radius"));
m_DirectLightingStrength = Unpack(o.Find("m_DirectLightingStrength"));
m_FalloffDistance = Unpack(o.Find("m_FalloffDistance"));
m_Downsample = Unpack(o.Find("m_Downsample"));
m_AfterOpaque = Unpack(o.Find("m_AfterOpaque"));
m_BlurQuality = Unpack(o.Find("m_BlurQuality"));
m_SampleCount = Unpack(o.Find("m_SampleCount"));
m_Method = Unpack(o.Find("m_Method"));
m_DepthSource = Unpack(o.Find("m_DepthSource"));
m_NormalQuality = Unpack(o.Find("m_NormalQuality"));
m_MinimumRadiusInPixels = Unpack(o.Find("m_MinimumRadiusInPixels"));
m_UseComputeShader = Unpack(o.Find("m_UseComputeShader"));
m_SpatialFilter = Unpack(o.Find("m_SpatialFilter"));
m_TemporalFilter = Unpack(o.Find("m_TemporalFilter"));
m_GhostingMitigation = Unpack(o.Find("m_GhostingMitigation"));
m_HistoryLength = Unpack(o.Find("m_HistoryLength"));
m_DirectionCount = Unpack(o.Find("m_DirectionCount"));
m_StepCount = Unpack(o.Find("m_StepCount"));
}
public override void OnInspectorGUI()
{
EditorGUILayout.LabelField("SSAO", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
PropertyField(m_Mode);
bool modeChanged = EditorGUI.EndChangeCheck();
bool isNone = m_Mode.value.intValue == (int)ScreenSpaceAmbientOcclusionMode.None;
bool isStandard = m_Mode.value.intValue == (int)ScreenSpaceAmbientOcclusionMode.Standard;
bool isGTAO = m_Mode.value.intValue == (int)ScreenSpaceAmbientOcclusionMode.GTAO;
if (isNone)
return;
PropertyField(m_Method);
PropertyField(m_Intensity);
PropertyField(m_Radius);
PropertyField(m_FalloffDistance);
PropertyField(m_DirectLightingStrength);
PropertyField(m_AfterOpaque);
if (isGTAO)
{
PropertyField(m_MinimumRadiusInPixels, Styles.minimumRadiusInPixels);
PropertyField(m_UseComputeShader, Styles.useComputeShader);
}
bool useComputeShader = isGTAO && m_UseComputeShader.value.boolValue;
if (useComputeShader)
{
using (new IndentLevelScope())
PropertyField(m_SpatialFilter, Styles.spatialFilter);
}
if (!SystemInfo.supportsComputeShaders && useComputeShader)
{
EditorGUILayout.HelpBox("Compute shaders are not supported on this platform. GTAO with compute shaders will not function correctly.", MessageType.Warning);
}
EditorGUILayout.Space();
EditorGUILayout.LabelField(Styles.qualitySettings, EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
PropertyField(m_Quality);
bool qualityChanged = EditorGUI.EndChangeCheck();
// Apply presets when quality or mode changes, but only if quality override is enabled
if ((qualityChanged || modeChanged) && m_Quality.overrideState.boolValue)
{
var qualityValue = (ScreenSpaceAmbientOcclusionQuality)m_Quality.value.intValue;
if (qualityValue != ScreenSpaceAmbientOcclusionQuality.Custom)
{
if (isStandard)
ApplyStandardPreset(qualityValue);
else if (useComputeShader)
ApplyGTAOComputePreset(qualityValue);
else
ApplyGTAOStandardPreset(qualityValue);
}
}
bool isCustom = m_Quality.value.intValue == (int)ScreenSpaceAmbientOcclusionQuality.Custom;
using (new IndentLevelScope())
{
using (new EditorGUI.DisabledScope(!isCustom))
{
if (isStandard)
{
PropertyField(m_DepthSource);
bool isDepthNormals = m_DepthSource.value.intValue == (int)ScreenSpaceAmbientOcclusionDepthSource.DepthNormals;
using (new EditorGUI.DisabledScope(isDepthNormals))
{
using (new IndentLevelScope())
PropertyField(m_NormalQuality);
}
}
PropertyField(m_Downsample);
if (isStandard)
{
PropertyField(m_BlurQuality);
PropertyField(m_SampleCount);
}
if (isGTAO)
{
if (useComputeShader)
{
PropertyField(m_DirectionCount);
PropertyField(m_StepCount);
}
else
{
PropertyField(m_SampleCount);
}
}
}
}
// Temporal Accumulation is only available in GTAO when using compute shaders
if (isGTAO && useComputeShader)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(Styles.temporalAccumulation, EditorStyles.boldLabel);
PropertyField(m_TemporalFilter, Styles.enable);
if (m_TemporalFilter.value.boolValue)
{
using (new IndentLevelScope())
{
PropertyField(m_GhostingMitigation, Styles.ghostingMitigation);
PropertyField(m_HistoryLength, Styles.historyLength);
}
}
}
}
void ApplyStandardPreset(ScreenSpaceAmbientOcclusionQuality quality)
{
if (quality == ScreenSpaceAmbientOcclusionQuality.Custom)
return;
m_SampleCount.value.intValue = (int)ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetSampleCount(quality);
m_SampleCount.overrideState.boolValue = true;
m_DepthSource.value.intValue = (int)ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetDepthSource(quality);
m_DepthSource.overrideState.boolValue = true;
m_NormalQuality.value.intValue = (int)ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetNormalQuality(quality);
m_NormalQuality.overrideState.boolValue = true;
m_Downsample.value.boolValue = ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetDownsample(quality);
m_Downsample.overrideState.boolValue = true;
m_BlurQuality.value.intValue = (int)ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetBlurQuality(quality);
m_BlurQuality.overrideState.boolValue = true;
serializedObject.ApplyModifiedProperties();
}
void ApplyGTAOStandardPreset(ScreenSpaceAmbientOcclusionQuality quality)
{
if (quality == ScreenSpaceAmbientOcclusionQuality.Custom)
return;
m_SampleCount.value.intValue = (int)ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetSampleCount(quality);
m_SampleCount.overrideState.boolValue = true;
m_Downsample.value.boolValue = ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetDownsample(quality);
m_Downsample.overrideState.boolValue = true;
serializedObject.ApplyModifiedProperties();
}
void ApplyGTAOComputePreset(ScreenSpaceAmbientOcclusionQuality quality)
{
if (quality == ScreenSpaceAmbientOcclusionQuality.Custom)
return;
m_Downsample.value.boolValue = ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetDownsample(quality);
m_Downsample.overrideState.boolValue = true;
m_DirectionCount.value.intValue = ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetDirectionCount(quality);
m_DirectionCount.overrideState.boolValue = true;
m_StepCount.value.intValue = ScreenSpaceAmbientOcclusionVolumeOverride.GetPresetStepCount(quality);
m_StepCount.overrideState.boolValue = true;
serializedObject.ApplyModifiedProperties();
}
}
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fefa3225845aff645942c8eba16d5977
@@ -0,0 +1,120 @@
using UnityEngine;
using UnityEditor.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(ScreenSpaceLensFlare))]
class ScreenSpaceLensFlareEditor : VolumeComponentEditor
{
protected SerializedDataParameter m_Intensity;
protected SerializedDataParameter m_TintColor;
protected SerializedDataParameter m_BloomMip;
protected SerializedDataParameter m_FirstFlareIntensity;
protected SerializedDataParameter m_SecondaryFlareIntensity;
protected SerializedDataParameter m_WarpedFlareIntensity;
protected SerializedDataParameter m_WarpedFlareScale;
protected SerializedDataParameter m_Samples;
protected SerializedDataParameter m_SampleDimmer;
protected SerializedDataParameter m_VignetteEffect;
protected SerializedDataParameter m_StartingPosition;
protected SerializedDataParameter m_Scale;
protected SerializedDataParameter m_ChromaticAbberationIntensity;
protected SerializedDataParameter m_StreaksIntensity;
protected SerializedDataParameter m_StreaksLength;
protected SerializedDataParameter m_StreaksOrientation;
protected SerializedDataParameter m_StreaksThreshold;
protected SerializedDataParameter m_Resolution;
static GUIContent s_Intensity = EditorGUIUtility.TrTextContent("Intensity", "Sets the global intensity of the Screen Space Lens Flare effect. When set to 0, the pass is skipped. ");
static GUIContent s_TintColor = EditorGUIUtility.TrTextContent("Tint Color", "Sets the color used to tint all the flares. ");
static GUIContent s_BloomMip = EditorGUIUtility.TrTextContent("Bloom Mip Bias", "Controls the Bloom mip used as a source for the Lens Flare effect. A high value will result in a blurrier result for all the flares.");
static GUIContent s_FirstFlareIntensity = EditorGUIUtility.TrTextContent("Regular Multiplier", "Controls the intensity of the Regular Flare sample. Those flares are sampled using scaled screen coordinates.");
static GUIContent s_SecondaryFlareIntensity = EditorGUIUtility.TrTextContent("Reversed Multiplier", "Controls the intensity of the Reversed Flare sample. Those flares are sampled using scaled and flipped screen coordinates.");
static GUIContent s_WarpedFlareIntensity = EditorGUIUtility.TrTextContent("Warped Multiplier", "Controls the intensity of the Warped Flare sample. Those flares are sampled using polar screen coordinates.");
static GUIContent s_WarpedFlareScale = EditorGUIUtility.TrTextContent("Scale", "Sets the scale of the Warped Flare sample. A value of 1,1 will keep this flare circular. Set values below 1 can lead to stretching artifacts on the side of the screen.");
static GUIContent s_Samples = EditorGUIUtility.TrTextContent("Samples", "Controls the number of times the flare effect is repeated for each flare type (regular, reversed, warped). This parameter has a strong impact on performance.");
static GUIContent s_SampleDimmer = EditorGUIUtility.TrTextContent("Sample Dimmer", "Controls the value by which each additionnal sample is multiplied. This parameter has an effect only after the first sample.");
static GUIContent s_VignetteEffect = EditorGUIUtility.TrTextContent("Vignette Effect", "Controls the intensity of the vignette effect to occlude the Lens Flare effect at the center of the screen.");
static GUIContent s_StartingPosition = EditorGUIUtility.TrTextContent("Starting Position", "Controls the starting position of the flares in screen space relative to their source.");
static GUIContent s_Scale = EditorGUIUtility.TrTextContent("Scale", "Controls the scale at which the flares are sampled. This parameter only impacts regular, reversed and warped flares.");
static GUIContent s_ChromaticAbberationIntensity = EditorGUIUtility.TrTextContent("Intensity", "Controls the strength of the Chromatic Aberration effect. The higher the value, the more light is dispersed on the sides of the screen.");
static GUIContent s_StreaksIntensity = EditorGUIUtility.TrTextContent("Multiplier", "Controls the intensity of streaks effect. This effect has an impact on performance when above zero. When this intensity is zero, this effect is not evaluated to save costs.");
static GUIContent s_StreaksOrientation = EditorGUIUtility.TrTextContent("Orientation", "Controls the orientation streaks effect in degrees. A value of 0 creates horizontal streaks.");
static GUIContent s_StreaksLength = EditorGUIUtility.TrTextContent("Length", "Controls the length of streaks effect. A value of one creates streaks about the width of the screen.");
static GUIContent s_StreaksThreshold = EditorGUIUtility.TrTextContent("Threshold", "Controls the threshold of streak effect. A high value makes the effect more localised on the high intensity areas of the screen. When using a non HDR Camera, a high threshold can remove streaks entirely.");
static GUIContent s_Resolution = EditorGUIUtility.TrTextContent("Resolution", "Specifies the resolution ratio at which the streaks effect is computed.");
public override void OnEnable()
{
var o = new PropertyFetcher<ScreenSpaceLensFlare>(serializedObject);
m_Intensity = Unpack(o.Find(x => x.intensity));
m_TintColor = Unpack(o.Find(x => x.tintColor));
m_BloomMip = Unpack(o.Find(x => x.bloomMip));
m_FirstFlareIntensity = Unpack(o.Find(x => x.firstFlareIntensity));
m_SecondaryFlareIntensity = Unpack(o.Find(x => x.secondaryFlareIntensity));
m_WarpedFlareIntensity = Unpack(o.Find(x => x.warpedFlareIntensity));
m_WarpedFlareScale = Unpack(o.Find(x => x.warpedFlareScale));
m_Samples = Unpack(o.Find(x => x.samples));
m_SampleDimmer = Unpack(o.Find(x => x.sampleDimmer));
m_VignetteEffect = Unpack(o.Find(x => x.vignetteEffect));
m_StartingPosition = Unpack(o.Find(x => x.startingPosition));
m_Scale = Unpack(o.Find(x => x.scale));
m_ChromaticAbberationIntensity = Unpack(o.Find(x => x.chromaticAbberationIntensity));
m_StreaksIntensity = Unpack(o.Find(x => x.streaksIntensity));
m_StreaksLength = Unpack(o.Find(x => x.streaksLength));
m_StreaksOrientation = Unpack(o.Find(x => x.streaksOrientation));
m_StreaksThreshold = Unpack(o.Find(x => x.streaksThreshold));
m_Resolution = Unpack(o.Find(x => x.resolution));
}
public override void OnInspectorGUI()
{
PropertyField(m_Intensity, s_Intensity);
PropertyField(m_TintColor, s_TintColor);
PropertyField(m_BloomMip, s_BloomMip);
//Regular Flares
PropertyField(m_FirstFlareIntensity, s_FirstFlareIntensity);
PropertyField(m_SecondaryFlareIntensity, s_SecondaryFlareIntensity);
PropertyField(m_WarpedFlareIntensity, s_WarpedFlareIntensity);
if(showAdditionalProperties)
{
using (new IndentLevelScope())
{
PropertyField(m_WarpedFlareScale, s_WarpedFlareScale);
}
}
//Parameters for Regular Flares
PropertyField(m_Samples, s_Samples);
if(showAdditionalProperties)
{
using (new IndentLevelScope())
{
PropertyField(m_SampleDimmer, s_SampleDimmer);
}
}
PropertyField(m_VignetteEffect, s_VignetteEffect);
PropertyField(m_StartingPosition, s_StartingPosition);
PropertyField(m_Scale, s_Scale);
//Streaks
PropertyField(m_StreaksIntensity, s_StreaksIntensity);
using (new IndentLevelScope())
{
PropertyField(m_StreaksLength, s_StreaksLength);
PropertyField(m_StreaksOrientation, s_StreaksOrientation);
PropertyField(m_StreaksThreshold, s_StreaksThreshold);
PropertyField(m_Resolution, s_Resolution);
}
//Chromatic Aberration
PropertyField(m_ChromaticAbberationIntensity, s_ChromaticAbberationIntensity);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 069b974b59070ea4ea9d39e27dcd7784
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,242 @@
#if URP_SCREEN_SPACE_REFLECTION
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using static UnityEngine.Rendering.Universal.ScreenSpaceReflectionVolumeSettings;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(ScreenSpaceReflectionVolumeSettings))]
class ScreenSpaceReflectionEditor : VolumeComponentEditor
{
// Serialized properties, performance settings
SerializedDataParameter m_Resolution;
SerializedDataParameter m_UpscalingMethod;
SerializedDataParameter m_MarchingMethod;
SerializedDataParameter m_HitRefinementSteps;
SerializedDataParameter m_FinalThicknessMultiplier;
SerializedDataParameter m_MaxRayLength;
SerializedDataParameter m_RayLengthFade;
SerializedDataParameter m_MaxRaySteps;
SerializedDataParameter m_ObjectThickness;
// Serialized properties, authoring settings
SerializedDataParameter m_Mode;
SerializedDataParameter m_ReflectionStrength;
SerializedDataParameter m_ClampReflectedColor;
SerializedDataParameter m_MaxColorValue;
SerializedDataParameter m_AfterOpaque;
SerializedDataParameter m_RoughnessFilter;
SerializedDataParameter m_RoughnessScale;
SerializedDataParameter m_MinimumSmoothness;
SerializedDataParameter m_SmoothnessFadeStart;
SerializedDataParameter m_NormalFade;
SerializedDataParameter m_ScreenEdgeFade;
SerializedDataParameter m_ReflectSky;
SerializedDataParameter m_TemporalFiltering;
SerializedDataParameter m_BaseBlendFactor;
PerformancePreset m_CurrentPreset = PerformancePreset.Custom;
bool m_IgnorePresetChange = false;
bool m_PresetDirty = false;
public override void OnEnable()
{
var o = new PropertyFetcher<ScreenSpaceReflectionVolumeSettings>(serializedObject);
m_Mode = Unpack(o.Find(x => x.mode));
m_ReflectionStrength = Unpack(o.Find(x => x.reflectionStrength));
m_ClampReflectedColor = Unpack(o.Find(x => x.clampReflectedColor));
m_MaxColorValue = Unpack(o.Find(x => x.maxColorValue));
m_Resolution = Unpack(o.Find(x => x.resolution));
m_UpscalingMethod = Unpack(o.Find(x => x.upscalingMethod));
m_MarchingMethod = Unpack(o.Find(x => x.marchingMethod));
m_HitRefinementSteps = Unpack(o.Find(x => x.hitRefinementSteps));
m_FinalThicknessMultiplier = Unpack(o.Find(x => x.finalThicknessMultiplier));
m_RoughnessFilter = Unpack(o.Find(x => x.roughnessFilter));
m_RoughnessScale = Unpack(o.Find(x => x.roughnessScale));
m_MinimumSmoothness = Unpack(o.Find(x => x.minimumSmoothness));
m_SmoothnessFadeStart = Unpack(o.Find(x => x.smoothnessFadeStart));
m_NormalFade = Unpack(o.Find(x => x.normalFade));
m_ScreenEdgeFade = Unpack(o.Find(x => x.screenEdgeFadeDistance));
m_ReflectSky = Unpack(o.Find(x => x.reflectSky));
m_MaxRayLength = Unpack(o.Find(x => x.maxRayLength));
m_RayLengthFade = Unpack(o.Find(x => x.rayLengthFade));
m_MaxRaySteps = Unpack(o.Find(x => x.maxRaySteps));
m_ObjectThickness = Unpack(o.Find(x => x.objectThickness));
m_TemporalFiltering = Unpack(o.Find(x => x.temporalFiltering));
m_BaseBlendFactor = Unpack(o.Find(x => x.baseBlendFactor));
// Determine current preset
DetectCurrentPreset();
// Re-detect preset when property changed
((ScreenSpaceReflectionVolumeSettings)target).propertyChanged += MarkPresetDirty;
}
public override void OnDisable()
{
((ScreenSpaceReflectionVolumeSettings)target).propertyChanged -= MarkPresetDirty;
}
private void MarkPresetDirty()
{
if (!m_IgnorePresetChange)
m_PresetDirty = true;
}
public override void OnInspectorGUI()
{
#if UNITY_WEBGL
GraphicsDeviceType[] graphicsApis = PlayerSettings.GetGraphicsAPIs(BuildTarget.WebGL);
if (Array.FindIndex(graphicsApis, x => x == GraphicsDeviceType.WebGPU) == -1)
EditorGUILayout.HelpBox("WebGL is not supported for Screen Space Reflection.", MessageType.Warning);
#endif
if (m_PresetDirty)
{
DetectCurrentPreset();
m_PresetDirty = false;
}
// Quality Preset Selection
EditorGUI.BeginChangeCheck();
var qualityTextContent = EditorGUIUtility.TrTextContent("Performance Preset", "Select the quality vs. performance preset or use Custom for manual settings");
var newPreset = (PerformancePreset)EditorGUILayout.EnumPopup(qualityTextContent, m_CurrentPreset);
if (EditorGUI.EndChangeCheck() && newPreset != m_CurrentPreset)
{
ApplyQualityPreset(newPreset);
m_CurrentPreset = newPreset;
}
// Performance Settings
DrawHeader("Performance");
PropertyField(m_Resolution);
PropertyField(m_UpscalingMethod);
PropertyField(m_MaxRaySteps);
PropertyField(m_ObjectThickness);
PropertyField(m_MarchingMethod);
if (m_MarchingMethod.value.enumValueIndex == (int)MarchingMethod.Linear)
{
using (new EditorGUI.DisabledScope(!m_MarchingMethod.overrideState.boolValue))
{
using (new IndentLevelScope())
{
PropertyField(m_MaxRayLength);
PropertyField(m_HitRefinementSteps);
PropertyField(m_FinalThicknessMultiplier);
}
}
}
// Authoring related settings (not part of preset).
DrawHeader("Visual Quality");
PropertyField(m_Mode);
PropertyField(m_ReflectionStrength);
PropertyField(m_ClampReflectedColor);
if (m_ClampReflectedColor.value.boolValue)
{
using (new EditorGUI.DisabledScope(!m_ClampReflectedColor.overrideState.boolValue))
{
using (new IndentLevelScope())
{
PropertyField(m_MaxColorValue);
}
}
}
PropertyField(m_RoughnessFilter);
if (m_RoughnessFilter.value.enumValueIndex != (int)RoughReflectionsQuality.Disabled)
{
using (new EditorGUI.DisabledScope(!m_RoughnessFilter.overrideState.boolValue))
{
using (new IndentLevelScope())
{
PropertyField(m_RoughnessScale);
}
}
}
PropertyField(m_MinimumSmoothness);
PropertyField(m_SmoothnessFadeStart);
m_SmoothnessFadeStart.value.floatValue = Mathf.Max(m_MinimumSmoothness.value.floatValue, m_SmoothnessFadeStart.value.floatValue);
PropertyField(m_ScreenEdgeFade);
PropertyField(m_NormalFade);
if (m_MarchingMethod.value.enumValueIndex == (int)MarchingMethod.Linear)
{
using (new EditorGUI.DisabledScope(!m_MarchingMethod.overrideState.boolValue))
{
PropertyField(m_RayLengthFade);
m_RayLengthFade.value.floatValue = Mathf.Min(m_MaxRayLength.value.floatValue, m_RayLengthFade.value.floatValue);
}
}
PropertyField(m_ReflectSky);
PropertyField(m_TemporalFiltering);
if (m_TemporalFiltering.value.boolValue)
{
using (new EditorGUI.DisabledScope(!m_TemporalFiltering.overrideState.boolValue))
{
using (new IndentLevelScope())
{
PropertyField(m_BaseBlendFactor);
}
}
}
}
void DetectCurrentPreset()
{
for (int i = 0; i < k_PerformancePresets.Length; i++)
{
if (MatchesPreset(in k_PerformancePresets[i]))
{
m_CurrentPreset = (PerformancePreset)i;
return;
}
}
m_CurrentPreset = PerformancePreset.Custom;
}
// Ignores authoring and debugging settings.
bool MatchesPreset(in PerformancePresetValues preset)
{
return m_Resolution.value.enumValueFlag == (int)preset.resolution &&
m_UpscalingMethod.value.enumValueFlag == (int)preset.upscalingMethod &&
m_MarchingMethod.value.enumValueFlag == (int)preset.marchingMethod &&
m_HitRefinementSteps.value.intValue == preset.hitRefinementSteps &&
Mathf.Approximately(m_FinalThicknessMultiplier.value.floatValue, preset.finalThicknessMultiplier) &&
Mathf.Approximately(m_MaxRayLength.value.floatValue, preset.maxRayLength) &&
m_MaxRaySteps.value.intValue == preset.maxRaySteps &&
Mathf.Approximately(m_ObjectThickness.value.floatValue, preset.objectThickness);
}
void ApplyQualityPreset(PerformancePreset preset)
{
if (preset == PerformancePreset.Custom)
return;
m_IgnorePresetChange = true;
ref readonly var settings = ref k_PerformancePresets[(int)preset];
m_Resolution.overrideState.boolValue = true;
m_Resolution.value.intValue = (int)settings.resolution;
m_UpscalingMethod.value.enumValueIndex = (int)settings.upscalingMethod;
m_UpscalingMethod.overrideState.boolValue = true;
m_MarchingMethod.value.enumValueIndex = (int)settings.marchingMethod;
m_MarchingMethod.overrideState.boolValue = true;
m_HitRefinementSteps.value.intValue = settings.hitRefinementSteps;
m_HitRefinementSteps.overrideState.boolValue = true;
m_FinalThicknessMultiplier.value.floatValue = settings.finalThicknessMultiplier;
m_FinalThicknessMultiplier.overrideState.boolValue = true;
m_MaxRayLength.value.floatValue = settings.maxRayLength;
m_MaxRayLength.overrideState.boolValue = true;
m_MaxRaySteps.value.intValue = settings.maxRaySteps;
m_MaxRaySteps.overrideState.boolValue = true;
m_ObjectThickness.value.floatValue = settings.objectThickness;
m_ObjectThickness.overrideState.boolValue = true;
m_IgnorePresetChange = false;
}
}
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 99f99811fc0d0174d8b58a72ab13f8c0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: da0f06d1af1e98c48b8ffbe1e6e4df96
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,63 @@
Shader "Hidden/Universal Render Pipeline/Editor/CurveBackground"
{
CGINCLUDE
#pragma target 3.0
#include "UnityCG.cginc"
float _DisabledState;
float3 HsvToRgb(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
float4 FragHue(v2f_img i) : SV_Target
{
float3 hsv = HsvToRgb(float3(i.uv.x, 1.0, 0.2));
float4 color = float4((0.0).xxx, 1.0);
color.rgb = lerp(color.rgb, hsv, smoothstep(0.5, 1.1, 1.0 - i.uv.y)) + lerp(color.rgb, hsv, smoothstep(0.5, 1.1, i.uv.y));
color.rgb += GammaToLinearSpace(0.15).xxx;
return float4(color.rgb, color.a * _DisabledState);
}
float4 FragSat(v2f_img i) : SV_Target
{
float4 color = float4((0.0).xxx, 1.0);
float sat = i.uv.x / 2;
color.rgb += lerp(color.rgb, (sat).xxx, smoothstep(0.5, 1.2, 1.0 - i.uv.y)) + lerp(color.rgb, (sat).xxx, smoothstep(0.5, 1.2, i.uv.y));
color.rgb += GammaToLinearSpace(0.15).xxx;
return float4(color.rgb, color.a * _DisabledState);
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always
// (0) Hue
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragHue
ENDCG
}
// (1) Sat/lum
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragSat
ENDCG
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0d0f817524897904ba47a6a1d55e7668
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,90 @@
Shader "Hidden/Universal Render Pipeline/Editor/Shadows Midtones Highlights Curve"
{
CGINCLUDE
#include "UnityCG.cginc"
#pragma editor_sync_compilation
#pragma target 3.5
float4 _ShaHiLimits; // xy: shadows min/max, zw: highlight min/max
float4 _Variants; // x: disabled state, y: x-scale, wz: unused
float3 BlendScreen(float3 base, float3 blend)
{
return 1.0 - (1.0 - blend) * (1.0 - base);
}
float4 DrawCurve(v2f_img i, float3 background, float3 shadowsCurveColor, float3 midtonesCurveColor, float3 highlightsCurveColor)
{
float x = i.uv.x * _Variants.y;
float y = i.uv.y;
float aa = fwidth(i.uv.y) * 2.0;
float shadowsY = 1.0 - smoothstep(_ShaHiLimits.x, _ShaHiLimits.y, x);
float shadowsCurve = smoothstep(shadowsY + aa, shadowsY, y);
float shadowsLine = smoothstep(shadowsY - aa, shadowsY, y) - smoothstep(shadowsY, shadowsY + aa, y);
float highlightsY = smoothstep(_ShaHiLimits.z, _ShaHiLimits.w, x);
float highlightsCurve = smoothstep(highlightsY + aa, highlightsY, y);
float highlightsLine = smoothstep(highlightsY - aa, highlightsY, y) - smoothstep(highlightsY, highlightsY + aa, y);
float midtonesY = 1.0 - shadowsY - highlightsY;
float midtonesCurve = smoothstep(midtonesY + aa, midtonesY, y);
float midtonesLine = smoothstep(midtonesY - aa, midtonesY, y) - smoothstep(midtonesY, midtonesY + aa, y);
float grad = lerp(0.7, 1.0, y);
float3 shadowsColor = shadowsCurveColor * shadowsCurve * grad;
float3 midtonesColor = midtonesCurveColor * midtonesCurve * grad;
float3 highlightsColor = highlightsCurveColor * highlightsCurve * grad;
float3 color = BlendScreen(shadowsColor, midtonesColor);
color = BlendScreen(color, highlightsColor);
color = BlendScreen(background, color * _Variants.xxx);
const float kAlpha = 0.3 * _Variants.xxx;
color += shadowsLine * shadowsColor * kAlpha;
color += midtonesLine * midtonesColor * kAlpha;
color += highlightsLine * highlightsColor * kAlpha;
return float4(color, 1.0);
}
float4 FragCurveDark(v2f_img i) : SV_Target
{
return DrawCurve(i, (pow(0.196, 2.2)).xxx, pow(float3(0.161, 0.851, 0.761), 2.2), pow(float3(0.741, 0.949, 0.443), 2.2), pow(float3(0.9, 0.9, 0.651), 2.2));
}
float4 FragCurveLight(v2f_img i) : SV_Target
{
return DrawCurve(i, (pow(0.635, 2.2)).xxx, pow(float3(0.161, 0.851, 0.761), 2.2), pow(float3(0.741, 0.949, 0.443), 2.2), pow(float3(1.0, 1.0, 0.651), 2.2));
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always
// (0) Dark skin
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragCurveDark
ENDCG
}
// (1) Light skin
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragCurveLight
ENDCG
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 95e15a77195eb574ab82aaac18b1c796
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,126 @@
Shader "Hidden/Universal Render Pipeline/Editor/Trackball"
{
CGINCLUDE
#pragma editor_sync_compilation
#include "UnityCG.cginc"
#define PI 3.14159265359
#define PI2 6.28318530718
float _Offset;
float _DisabledState;
float2 _Resolution; // x: size, y: size / 2
float3 HsvToRgb(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
float4 CreateWheel(v2f_img i, float crossColor, float offsetColor)
{
const float kHueOuterRadius = 0.45;
const float kHueInnerRadius = 0.38;
const float kLumOuterRadius = 0.495;
const float kLumInnerRadius = 0.48;
float4 color = (0.0).xxxx;
float2 uvc = i.uv - (0.5).xx;
float dist = sqrt(dot(uvc, uvc));
float delta = fwidth(dist);
float angle = atan2(uvc.x, uvc.y);
// Cross
{
float radius = (0.5 - kHueInnerRadius) * _Resolution.x + 1.0;
float2 pixel = (_Resolution.xx - 1.0) * i.uv + 1.0;
float vline = step(floor(fmod(pixel.x, _Resolution.y)), 0.0);
vline *= step(radius, pixel.y) * step(pixel.y, _Resolution.x - radius);
float hline = step(floor(fmod(pixel.y, _Resolution.y)), 0.0);
hline *= step(radius, pixel.x) * step(pixel.x, _Resolution.x - radius);
color += hline.xxxx * (1.0).xxxx;
color += vline.xxxx * (1.0).xxxx;
color = saturate(color);
color *= half4((crossColor).xxx, 0.05);
}
// Hue
{
float alphaOut = smoothstep(kHueOuterRadius - delta, kHueOuterRadius + delta, dist);
float alphaIn = smoothstep(kHueInnerRadius - delta, kHueInnerRadius + delta, dist);
float hue = angle;
hue = 1.0 - ((hue > 0.0) ? hue : PI2 + hue) / PI2;
float4 c = float4(HsvToRgb(float3(hue, 1.0, 1.0)), 1.0);
color += lerp((0.0).xxxx, c, alphaIn - alphaOut);
}
// Offset
{
float alphaOut = smoothstep(kLumOuterRadius - delta, kLumOuterRadius + delta, dist);
float alphaIn = smoothstep(kLumInnerRadius - delta, kLumInnerRadius + delta / 2, dist);
float4 c = float4((offsetColor).xxx, 1.0);
float a = PI * _Offset;
if (_Offset >= 0 && angle < a && angle > 0.0)
c = float4((1.0).xxx, 0.5);
else if (angle > a && angle < 0.0)
c = float4((1.0).xxx, 0.5);
color += lerp((0.0).xxxx, c, alphaIn - alphaOut);
}
color = color * _DisabledState;
#if !UNITY_COLORSPACE_GAMMA
color = half4(GammaToLinearSpace(color.xyz), color.w);
#endif
return color;
}
float4 FragTrackballDark(v2f_img i) : SV_Target
{
return CreateWheel(i, 1.0, 0.15);
}
float4 FragTrackballLight(v2f_img i) : SV_Target
{
return CreateWheel(i, 0.0, 0.3);
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always
// (0) Dark skin
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragTrackballDark
ENDCG
}
// (1) Light skin
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragTrackballLight
ENDCG
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 77cfa04f893eb8745b6a454a3d51b43c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,136 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
// TODO: handle retina / EditorGUIUtility.pixelsPerPoint
[CustomEditor(typeof(ShadowsMidtonesHighlights))]
sealed class ShadowsMidtonesHighlightsEditor : VolumeComponentEditor
{
private static class Styles
{
public static readonly GUIContent shadowsLabel = EditorGUIUtility.TrTextContent("Shadows", "Use this to control and apply a hue to the shadows.");
public static readonly GUIContent midtonesLabel = EditorGUIUtility.TrTextContent("Midtones", "Use this to control and apply a hue to the shadows.");
public static readonly GUIContent highlightsLabel = EditorGUIUtility.TrTextContent("Highlights", "Use this to control and apply a hue to the shadows.");
}
SerializedDataParameter m_Shadows;
SerializedDataParameter m_Midtones;
SerializedDataParameter m_Highlights;
SerializedDataParameter m_ShadowsStart;
SerializedDataParameter m_ShadowsEnd;
SerializedDataParameter m_HighlightsStart;
SerializedDataParameter m_HighlightsEnd;
const string k_ShaderName = "Hidden/Universal Render Pipeline/Editor/Shadows Midtones Highlights Curve";
static Material s_Material;
readonly TrackballUIDrawer m_TrackballUIDrawer = new TrackballUIDrawer();
// Curve drawing utilities
Rect m_CurveRect;
RenderTexture m_CurveTex;
public override void OnEnable()
{
var o = new PropertyFetcher<ShadowsMidtonesHighlights>(serializedObject);
m_Shadows = Unpack(o.Find(x => x.shadows));
m_Midtones = Unpack(o.Find(x => x.midtones));
m_Highlights = Unpack(o.Find(x => x.highlights));
m_ShadowsStart = Unpack(o.Find(x => x.shadowsStart));
m_ShadowsEnd = Unpack(o.Find(x => x.shadowsEnd));
m_HighlightsStart = Unpack(o.Find(x => x.highlightsStart));
m_HighlightsEnd = Unpack(o.Find(x => x.highlightsEnd));
}
public override void OnInspectorGUI()
{
if (!CheckMaterialAndShader())
{
return;
}
using (new EditorGUILayout.HorizontalScope())
{
m_TrackballUIDrawer.OnGUI(m_Shadows.value, enableOverrides ? m_Shadows.overrideState : null, Styles.shadowsLabel, GetWheelValue);
GUILayout.Space(4f);
m_TrackballUIDrawer.OnGUI(m_Midtones.value, enableOverrides ? m_Midtones.overrideState : null, Styles.midtonesLabel, GetWheelValue);
GUILayout.Space(4f);
m_TrackballUIDrawer.OnGUI(m_Highlights.value, enableOverrides ? m_Highlights.overrideState : null, Styles.highlightsLabel, GetWheelValue);
}
EditorGUILayout.Space();
// Reserve GUI space
m_CurveRect = GUILayoutUtility.GetRect(128, 80);
m_CurveRect.xMin += EditorGUI.indentLevel * 15f;
if (Event.current.type == EventType.Repaint)
{
float alpha = GUI.enabled ? 1f : 0.4f;
var limits = new Vector4(m_ShadowsStart.value.floatValue, m_ShadowsEnd.value.floatValue, m_HighlightsStart.value.floatValue, m_HighlightsEnd.value.floatValue);
s_Material.SetVector("_ShaHiLimits", limits);
s_Material.SetVector("_Variants", new Vector4(alpha, Mathf.Max(m_HighlightsEnd.value.floatValue, 1f), 0f, 0f));
CheckCurveRT((int)m_CurveRect.width, (int)m_CurveRect.height);
var oldRt = RenderTexture.active;
Graphics.Blit(null, m_CurveTex, s_Material, EditorGUIUtility.isProSkin ? 0 : 1);
RenderTexture.active = oldRt;
GUI.DrawTexture(m_CurveRect, m_CurveTex);
Handles.DrawSolidRectangleWithOutline(m_CurveRect, Color.clear, Color.white * 0.4f);
}
PropertyField(m_ShadowsStart, EditorGUIUtility.TrTextContent("Start"));
m_ShadowsStart.value.floatValue = Mathf.Min(m_ShadowsStart.value.floatValue, m_ShadowsEnd.value.floatValue);
PropertyField(m_ShadowsEnd, EditorGUIUtility.TrTextContent("End"));
m_ShadowsEnd.value.floatValue = Mathf.Max(m_ShadowsStart.value.floatValue, m_ShadowsEnd.value.floatValue);
PropertyField(m_HighlightsStart, EditorGUIUtility.TrTextContent("Start"));
m_HighlightsStart.value.floatValue = Mathf.Min(m_HighlightsStart.value.floatValue, m_HighlightsEnd.value.floatValue);
PropertyField(m_HighlightsEnd, EditorGUIUtility.TrTextContent("End"));
m_HighlightsEnd.value.floatValue = Mathf.Max(m_HighlightsStart.value.floatValue, m_HighlightsEnd.value.floatValue);
}
void CheckCurveRT(int width, int height)
{
if (m_CurveTex == null || !m_CurveTex.IsCreated() || m_CurveTex.width != width || m_CurveTex.height != height)
{
CoreUtils.Destroy(m_CurveTex);
m_CurveTex = new RenderTexture(width, height, 0, RenderTextureFormat.ARGB32);
m_CurveTex.hideFlags = HideFlags.HideAndDontSave;
}
}
static Vector3 GetWheelValue(Vector4 v)
{
float w = v.w * (Mathf.Sign(v.w) < 0f ? 1f : 4f);
return new Vector3(
Mathf.Max(v.x + w, 0f),
Mathf.Max(v.y + w, 0f),
Mathf.Max(v.z + w, 0f)
);
}
bool CheckMaterialAndShader()
{
if (s_Material != null)
{
return true;
}
Shader shader = Shader.Find(k_ShaderName);
if (shader == null)
{
Debug.LogError("ShadowsMidtonesHighlightsEditor: Unable to find shader \"" + k_ShaderName + "\"");
return false;
}
s_Material = new Material(shader);
return true;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4b15ac5de32362a4a9ef0bc5b349ac4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,179 @@
#if SURFACE_CACHE
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(SurfaceCacheGIVolumeOverride))]
internal class SurfaceCacheGIVolumeEditor : VolumeComponentEditor
{
protected SurfaceCacheGIVolumeOverride.PresetQuality m_Quality;
private bool m_QualityDirty = true;
protected SerializedDataParameter m_Enabled;
protected SerializedDataParameter m_MultiBounce;
protected SerializedDataParameter m_BouncePatchAllocation;
protected SerializedDataParameter m_SampleCount;
protected SerializedDataParameter m_TemporalSmoothing;
protected SerializedDataParameter m_SpatialFilterEnabled;
protected SerializedDataParameter m_SpatialSampleCount;
protected SerializedDataParameter m_SpatialRadius;
protected SerializedDataParameter m_TemporalPostFilter;
protected SerializedDataParameter m_LookupSampleCount;
protected SerializedDataParameter m_UpsamplingKernelSize;
protected SerializedDataParameter m_UpsamplingSampleCount;
protected SerializedDataParameter m_VolumeSize;
protected SerializedDataParameter m_VolumeResolution;
protected SerializedDataParameter m_VolumeCascadeCount;
protected SerializedDataParameter m_CascadeMovement;
protected SerializedDataParameter m_DefragCount;
protected SerializedDataParameter m_RenderingLayerMask;
static GUIContent s_Enabled = EditorGUIUtility.TrTextContent("Enabled", "Enables Surface Cache Global Illumination. When disabled, the feature performs no work.");
static GUIContent s_Quality = EditorGUIUtility.TrTextContent("Quality", "Quality preset for Surface Cache GI. Select Custom to manually adjust individual parameters.");
static GUIContent s_MultiBounce = EditorGUIUtility.TrTextContent("Multi Bounce", "Enable multi-bounce global illumination for more accurate light propagation.");
static GUIContent s_BouncePatchAllocation = EditorGUIUtility.TrTextContent("Bounce Patch Allocation", "When enabled, new patches are allocated at ray hit locations when multi-bounce cache lookups fail");
static GUIContent s_SampleCount = EditorGUIUtility.TrTextContent("Sample Count", "Number of samples used for GI estimation. Higher values improve quality at performance cost.");
static GUIContent s_TemporalSmoothing = EditorGUIUtility.TrTextContent("Temporal Smoothing", "Temporal smoothing for patch data. Higher values produce more stable results but slower response to lighting changes.");
static GUIContent s_SpatialFilterEnabled = EditorGUIUtility.TrTextContent("Spatial Filter", "Enables spatial filtering across patches. This reduces noise but may also increase leaking.");
static GUIContent s_SpatialSampleCount = EditorGUIUtility.TrTextContent("Spatial Sample Count", "Number of samples for spatial filtering. Higher values improve quality at performance cost.");
static GUIContent s_SpatialRadius = EditorGUIUtility.TrTextContent("Spatial Radius", "Radius used for the spatial filtering kernel. Larger values reduces noise but may cause over-blurring.");
static GUIContent s_TemporalPostFilter = EditorGUIUtility.TrTextContent("Temporal Post Filter", "Enable temporal post-filtering for additional stability.");
static GUIContent s_LookupSampleCount = EditorGUIUtility.TrTextContent("Lookup Sample Count", "Number of samples for screen-space lookups.");
static GUIContent s_UpsamplingKernelSize = EditorGUIUtility.TrTextContent("Upsampling Kernel Size", "Kernel size for upsampling filtering.");
static GUIContent s_UpsamplingSampleCount = EditorGUIUtility.TrTextContent("Upsampling Sample Count", "Number of samples for upsampling. Higher values improve quality at performance cost.");
static GUIContent s_VolumeSize = EditorGUIUtility.TrTextContent("Size", "Size of the surface cache volume in world units. Can be changed at runtime without a performance hitch.");
static GUIContent s_VolumeResolution = EditorGUIUtility.TrTextContent("Resolution", "Spatial resolution of the volume grid. Higher values improve spatial detail but use more memory. Changing at runtime can cause a performance hitch if internal buffers are reallocated.");
static GUIContent s_VolumeCascadeCount = EditorGUIUtility.TrTextContent("Cascade Count", "Number of volume cascades. More cascades extend the volume's effective range. Changing at runtime can cause a performance hitch if internal buffers are reallocated.");
static GUIContent s_CascadeMovement = EditorGUIUtility.TrTextContent("Cascade Movement", "Enable volume cascades to follow the camera.");
// Section header labels with tooltips
static GUIContent s_LightTransportHeader = EditorGUIUtility.TrTextContent("Light Transport", "Controls how many rays are cast per patch to estimate indirect lighting. More samples reduce variance but increase GPU cost per frame.");
static GUIContent s_PatchFilteringHeader = EditorGUIUtility.TrTextContent("Patch Filtering", "Controls how patch irradiance data is filtered over time and space. These settings trade temporal stability and spatial smoothness against responsiveness to lighting changes and light leaking.");
static GUIContent s_ScreenFilteringHeader = EditorGUIUtility.TrTextContent("Screen Filtering", "Controls how the low-resolution patch irradiance is resolved and upsampled to full screen resolution. These settings affect the final image quality and sharpness of the GI contribution.");
static GUIContent s_VolumeConfigurationHeader = EditorGUIUtility.TrTextContent("Volume Configuration", "Defines the spatial extent and grid density of the surface cache volume. Size can be changed freely at runtime. Resolution and cascade count changes reallocate internal buffers, which may cause a brief hitch.");
static GUIContent s_VolumeBehaviorHeader = EditorGUIUtility.TrTextContent("Volume Behavior", "Controls how the volume cascades move relative to the camera during gameplay.");
static GUIContent s_DefragCount = EditorGUIUtility.TrTextContent("Defrag Count", "Number of surface cache patches to defragment per frame. Higher values reduce memory fragmentation at a small per-frame cost.");
static GUIContent s_RenderingLayerMask = EditorGUIUtility.TrTextContent("Rendering Layer Mask", "Only renderers whose Rendering Layer Mask intersects this mask contribute to Surface Cache GI.");
public override void OnEnable()
{
var o = new PropertyFetcher<SurfaceCacheGIVolumeOverride>(serializedObject);
m_Enabled = Unpack(o.Find(obj => obj.enabled));
m_MultiBounce = Unpack(o.Find(obj => obj.multiBounce));
m_BouncePatchAllocation = Unpack(o.Find(obj => obj.bouncePatchAllocation));
m_SampleCount = Unpack(o.Find(obj => obj.sampleCount));
m_TemporalSmoothing = Unpack(o.Find(obj => obj.temporalSmoothing));
m_SpatialFilterEnabled = Unpack(o.Find(obj => obj.spatialFilterEnabled));
m_SpatialSampleCount = Unpack(o.Find(obj => obj.spatialSampleCount));
m_SpatialRadius = Unpack(o.Find(obj => obj.spatialRadius));
m_TemporalPostFilter = Unpack(o.Find(obj => obj.temporalPostFilter));
m_LookupSampleCount = Unpack(o.Find(obj => obj.lookupSampleCount));
m_UpsamplingKernelSize = Unpack(o.Find(obj => obj.upsamplingKernelSize));
m_UpsamplingSampleCount = Unpack(o.Find(obj => obj.upsamplingSampleCount));
m_VolumeSize = Unpack(o.Find(obj => obj.volumeSize));
m_VolumeResolution = Unpack(o.Find(obj => obj.volumeResolution));
m_VolumeCascadeCount = Unpack(o.Find(obj => obj.volumeCascadeCount));
m_CascadeMovement = Unpack(o.Find(obj => obj.cascadeMovement));
m_DefragCount = Unpack(o.Find(obj => obj.defragCount));
m_RenderingLayerMask = Unpack(o.Find(obj => obj.renderingLayerMask));
// Re-detect preset when property changed
((SurfaceCacheGIVolumeOverride)target).propertyChanged += MarkQualityDirty;
}
public override void OnDisable()
{
((SurfaceCacheGIVolumeOverride)target).propertyChanged -= MarkQualityDirty;
}
public override void OnInspectorGUI()
{
PropertyField(m_Enabled, s_Enabled);
EditorGUI.BeginDisabledGroup(!m_Enabled.value.boolValue);
// Quality preset dropdown. Switching to a named preset writes its values into the
// backing fields so users can see the preset values and make fine adjustments from there.
var quality = (SurfaceCacheGIVolumeOverride.PresetQuality)EditorGUILayout.EnumPopup(s_Quality, m_Quality, (e) => (SurfaceCacheGIVolumeOverride.PresetQuality)e != SurfaceCacheGIVolumeOverride.PresetQuality.Custom, false);
if (m_Quality != quality && quality != SurfaceCacheGIVolumeOverride.PresetQuality.Custom)
{
Undo.RecordObjects(serializedObject.targetObjects, "Applied preset");
m_Quality = quality;
foreach (var targetObj in serializedObject.targetObjects)
{
(targetObj as SurfaceCacheGIVolumeOverride).ApplyPreset(m_Quality);
}
serializedObject.Update();
}
else if (m_QualityDirty)
{
m_Quality = (serializedObject.targetObject as SurfaceCacheGIVolumeOverride).GetPresetQuality();
m_QualityDirty = false;
}
// Light Transport section
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_LightTransportHeader, EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
PropertyField(m_MultiBounce, s_MultiBounce);
PropertyField(m_BouncePatchAllocation, s_BouncePatchAllocation);
PropertyField(m_SampleCount, s_SampleCount);
// Patch Filtering section
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_PatchFilteringHeader, EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
PropertyField(m_TemporalSmoothing, s_TemporalSmoothing);
PropertyField(m_SpatialFilterEnabled, s_SpatialFilterEnabled);
using (new IndentLevelScope())
{
PropertyField(m_SpatialSampleCount, s_SpatialSampleCount);
PropertyField(m_SpatialRadius, s_SpatialRadius);
}
PropertyField(m_TemporalPostFilter, s_TemporalPostFilter);
// Screen Filtering section
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_ScreenFilteringHeader, EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
PropertyField(m_LookupSampleCount, s_LookupSampleCount);
PropertyField(m_UpsamplingKernelSize, s_UpsamplingKernelSize);
PropertyField(m_UpsamplingSampleCount, s_UpsamplingSampleCount);
// Volume Configuration section (always editable, not affected by quality preset)
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_VolumeConfigurationHeader, EditorStyles.boldLabel);
PropertyField(m_VolumeSize, s_VolumeSize);
PropertyField(m_VolumeResolution, s_VolumeResolution);
PropertyField(m_VolumeCascadeCount, s_VolumeCascadeCount);
// Volume Behavior (always editable, not affected by quality preset)
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_VolumeBehaviorHeader, EditorStyles.boldLabel);
PropertyField(m_CascadeMovement, s_CascadeMovement);
if (showAdditionalProperties)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Advanced", EditorStyles.boldLabel);
PropertyField(m_DefragCount, s_DefragCount);
PropertyField(m_RenderingLayerMask, s_RenderingLayerMask);
}
EditorGUI.EndDisabledGroup();
}
private void MarkQualityDirty()
{
m_QualityDirty = true;
}
}
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f53f8d0902a414d5ca20fbd1b989e1ec
@@ -0,0 +1,91 @@
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(Tonemapping))]
sealed class TonemappingEditor : VolumeComponentEditor
{
SerializedDataParameter m_Mode;
// HDR Mode.
SerializedDataParameter m_NeutralHDRRangeReductionMode;
SerializedDataParameter m_HueShiftAmount;
SerializedDataParameter m_HDRDetectPaperWhite;
SerializedDataParameter m_HDRPaperwhite;
SerializedDataParameter m_HDRDetectNitLimits;
SerializedDataParameter m_HDRMinNits;
SerializedDataParameter m_HDRMaxNits;
SerializedDataParameter m_HDRAcesPreset;
public override bool hasAdditionalProperties => true;
public override void OnEnable()
{
var o = new PropertyFetcher<Tonemapping>(serializedObject);
m_Mode = Unpack(o.Find(x => x.mode));
m_NeutralHDRRangeReductionMode = Unpack(o.Find(x => x.neutralHDRRangeReductionMode));
m_HueShiftAmount = Unpack(o.Find(x => x.hueShiftAmount));
m_HDRDetectPaperWhite = Unpack(o.Find(x => x.detectPaperWhite));
m_HDRPaperwhite = Unpack(o.Find(x => x.paperWhite));
m_HDRDetectNitLimits = Unpack(o.Find(x => x.detectBrightnessLimits));
m_HDRMinNits = Unpack(o.Find(x => x.minNits));
m_HDRMaxNits = Unpack(o.Find(x => x.maxNits));
m_HDRAcesPreset = Unpack(o.Find(x => x.acesPreset));
}
public override void OnInspectorGUI()
{
PropertyField(m_Mode);
// Display a warning if the user is trying to use a tonemap while rendering in LDR
var asset = UniversalRenderPipeline.asset;
int hdrTonemapMode = m_Mode.value.intValue;
if (asset != null && !asset.supportsHDR && hdrTonemapMode != (int)TonemappingMode.None)
{
EditorGUILayout.HelpBox("Tonemapping should only be used when working with High Dynamic Range (HDR). Please enable HDR through the active Render Pipeline Asset.", MessageType.Warning);
return;
}
if (PlayerSettings.allowHDRDisplaySupport && hdrTonemapMode != (int)TonemappingMode.None)
{
EditorGUILayout.LabelField("HDR Output");
if (hdrTonemapMode == (int)TonemappingMode.Neutral)
{
PropertyField(m_NeutralHDRRangeReductionMode);
PropertyField(m_HueShiftAmount);
PropertyField(m_HDRDetectPaperWhite);
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledScope(m_HDRDetectPaperWhite.value.boolValue))
{
PropertyField(m_HDRPaperwhite);
}
EditorGUI.indentLevel--;
PropertyField(m_HDRDetectNitLimits);
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledScope(m_HDRDetectNitLimits.value.boolValue))
{
PropertyField(m_HDRMinNits);
PropertyField(m_HDRMaxNits);
}
EditorGUI.indentLevel--;
}
if (hdrTonemapMode == (int)TonemappingMode.ACES)
{
PropertyField(m_HDRAcesPreset);
PropertyField(m_HDRDetectPaperWhite);
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledScope(m_HDRDetectPaperWhite.value.boolValue))
{
PropertyField(m_HDRPaperwhite);
}
EditorGUI.indentLevel--;
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 429f93c4cd082064ca7756102c7359ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: