mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-12-01 10:12:38 +08:00
@@ -38,6 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.37311918, g: 0.3807396, b: 0.35872662, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -192,7 +193,6 @@ Transform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
@@ -226,7 +226,6 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 986199155}
|
||||
m_RootOrder: 3
|
||||
@@ -249,6 +248,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Target: {fileID: 1567169363}
|
||||
m_Preset: {fileID: 0}
|
||||
m_UseTargetTransform: 1
|
||||
m_SamplingScale: 1
|
||||
m_AllowToModifyMeshShape: 1
|
||||
@@ -321,7 +321,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
@@ -354,7 +353,6 @@ Transform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
@@ -395,7 +393,6 @@ Canvas:
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 27
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
@@ -450,7 +447,6 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1120943171}
|
||||
- {fileID: 1242517204}
|
||||
@@ -493,7 +489,6 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 986199155}
|
||||
m_RootOrder: 0
|
||||
@@ -517,7 +512,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_ToneFilter: 1
|
||||
m_ToneIntensity: 0.5
|
||||
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ColorFilter: 6
|
||||
m_ColorIntensity: 0.5
|
||||
m_Color: {r: 0.5377358, g: 0, b: 0.09190052, a: 1}
|
||||
@@ -545,6 +539,35 @@ MonoBehaviour:
|
||||
m_TransitionColorGlow: 0
|
||||
m_TransitionPatternReverse: 0
|
||||
m_TransitionAutoPlaySpeed: 0
|
||||
m_TransitionGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
m_TargetMode: 0
|
||||
m_TargetColor: {r: 0.15686275, g: 0.72156864, b: 0.8509804, a: 1}
|
||||
m_TargetRange: 0.033
|
||||
@@ -600,6 +623,8 @@ MonoBehaviour:
|
||||
m_GradationOffset: 0
|
||||
m_GradationScale: 0.15
|
||||
m_GradationRotation: 135
|
||||
m_GradationWrapMode: 0
|
||||
m_GradationReverse: 0
|
||||
m_AllowToModifyMeshShape: 1
|
||||
m_EdgeMode: 2
|
||||
m_EdgeWidth: 0.05
|
||||
@@ -615,10 +640,13 @@ MonoBehaviour:
|
||||
m_DetailThreshold:
|
||||
m_Min: 0
|
||||
m_Max: 1
|
||||
m_DetailColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DetailTex: {fileID: 0}
|
||||
m_DetailTexScale: {x: 1, y: 1}
|
||||
m_DetailTexOffset: {x: 0, y: 0}
|
||||
m_DetailTexSpeed: {x: 0, y: 0}
|
||||
m_RoundCornerMode: 0
|
||||
m_RoundCornerRadius: {x: 20, y: 20, z: 20, w: 20}
|
||||
m_CustomRoot: {fileID: 0}
|
||||
m_Flip: 0
|
||||
--- !u!114 &1120943173
|
||||
@@ -689,7 +717,6 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2125393230}
|
||||
m_Father: {fileID: 986199155}
|
||||
@@ -790,7 +817,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_ToneFilter: 1
|
||||
m_ToneIntensity: 0.875
|
||||
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ColorFilter: 1
|
||||
m_ColorIntensity: 0.7
|
||||
m_Color: {r: 1, g: 0.08701122, b: 0, a: 1}
|
||||
@@ -818,6 +844,35 @@ MonoBehaviour:
|
||||
m_TransitionColorGlow: 1
|
||||
m_TransitionPatternReverse: 0
|
||||
m_TransitionAutoPlaySpeed: 0
|
||||
m_TransitionGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
m_TargetMode: 1
|
||||
m_TargetColor: {r: 0.22352943, g: 0.87843144, b: 0.9450981, a: 1}
|
||||
m_TargetRange: 0.118
|
||||
@@ -873,6 +928,8 @@ MonoBehaviour:
|
||||
m_GradationOffset: 0
|
||||
m_GradationScale: 1
|
||||
m_GradationRotation: 60
|
||||
m_GradationWrapMode: 0
|
||||
m_GradationReverse: 0
|
||||
m_AllowToModifyMeshShape: 1
|
||||
m_EdgeMode: 2
|
||||
m_EdgeWidth: 0.5
|
||||
@@ -888,10 +945,13 @@ MonoBehaviour:
|
||||
m_DetailThreshold:
|
||||
m_Min: 0.25
|
||||
m_Max: 0.5
|
||||
m_DetailColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DetailTex: {fileID: 2800000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3}
|
||||
m_DetailTexScale: {x: 1, y: 1}
|
||||
m_DetailTexOffset: {x: 0, y: 0}
|
||||
m_DetailTexSpeed: {x: 0, y: 0}
|
||||
m_RoundCornerMode: 1
|
||||
m_RoundCornerRadius: {x: 20, y: 20, z: 20, w: 20}
|
||||
m_CustomRoot: {fileID: 2125393230}
|
||||
m_Flip: 1
|
||||
--- !u!114 &1242517207
|
||||
@@ -962,7 +1022,6 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 986199155}
|
||||
m_RootOrder: 2
|
||||
@@ -986,7 +1045,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_ToneFilter: 1
|
||||
m_ToneIntensity: 1
|
||||
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ColorFilter: 0
|
||||
m_ColorIntensity: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
@@ -1014,6 +1072,35 @@ MonoBehaviour:
|
||||
m_TransitionColorGlow: 0
|
||||
m_TransitionPatternReverse: 0
|
||||
m_TransitionAutoPlaySpeed: 0
|
||||
m_TransitionGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
m_TargetMode: 0
|
||||
m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_TargetRange: 0.1
|
||||
@@ -1069,6 +1156,8 @@ MonoBehaviour:
|
||||
m_GradationOffset: 0
|
||||
m_GradationScale: 1
|
||||
m_GradationRotation: 0
|
||||
m_GradationWrapMode: 0
|
||||
m_GradationReverse: 0
|
||||
m_AllowToModifyMeshShape: 1
|
||||
m_EdgeMode: 0
|
||||
m_EdgeWidth: 0.5
|
||||
@@ -1084,10 +1173,13 @@ MonoBehaviour:
|
||||
m_DetailThreshold:
|
||||
m_Min: 0
|
||||
m_Max: 1
|
||||
m_DetailColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DetailTex: {fileID: 0}
|
||||
m_DetailTexScale: {x: 1, y: 1}
|
||||
m_DetailTexOffset: {x: 0, y: 0}
|
||||
m_DetailTexSpeed: {x: 0, y: 0}
|
||||
m_RoundCornerMode: 0
|
||||
m_RoundCornerRadius: {x: 20, y: 20, z: 20, w: 20}
|
||||
m_CustomRoot: {fileID: 0}
|
||||
m_Flip: 0
|
||||
--- !u!114 &1567169364
|
||||
@@ -1230,7 +1322,6 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1242517204}
|
||||
m_RootOrder: 0
|
||||
|
||||
+14133
-5741
File diff suppressed because it is too large
Load Diff
@@ -109,6 +109,12 @@ namespace Coffee.UIEffects.Editors
|
||||
private SerializedProperty _detailTexOffset;
|
||||
private SerializedProperty _detailTexSpeed;
|
||||
|
||||
private SerializedProperty _roundCornerMode;
|
||||
private SerializedProperty _roundCornerRadiusTopLeft;
|
||||
private SerializedProperty _roundCornerRadiusTopRight;
|
||||
private SerializedProperty _roundCornerRadiusBottomRight;
|
||||
private SerializedProperty _roundCornerRadiusBottomLeft;
|
||||
|
||||
private SerializedProperty _flip;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
@@ -210,6 +216,13 @@ namespace Coffee.UIEffects.Editors
|
||||
_detailTexOffset = serializedObject.FindProperty("m_DetailTexOffset");
|
||||
_detailTexSpeed = serializedObject.FindProperty("m_DetailTexSpeed");
|
||||
|
||||
_roundCornerMode = serializedObject.FindProperty("m_RoundCornerMode");
|
||||
var roundCornerRadius = serializedObject.FindProperty("m_RoundCornerRadius");
|
||||
_roundCornerRadiusTopLeft = roundCornerRadius.FindPropertyRelative("x");
|
||||
_roundCornerRadiusTopRight = roundCornerRadius.FindPropertyRelative("y");
|
||||
_roundCornerRadiusBottomRight = roundCornerRadius.FindPropertyRelative("z");
|
||||
_roundCornerRadiusBottomLeft = roundCornerRadius.FindPropertyRelative("w");
|
||||
|
||||
_flip = serializedObject.FindProperty("m_Flip");
|
||||
}
|
||||
|
||||
@@ -489,6 +502,18 @@ namespace Coffee.UIEffects.Editors
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
// Round Corner
|
||||
DrawSeparator();
|
||||
if (DrawHeaderPopup(_roundCornerMode))
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
DrawRoundCornerRadiusField(_roundCornerRadiusTopLeft, "Top Left");
|
||||
DrawRoundCornerRadiusField(_roundCornerRadiusTopRight, "Top Right");
|
||||
DrawRoundCornerRadiusField(_roundCornerRadiusBottomRight, "Bottom Right");
|
||||
DrawRoundCornerRadiusField(_roundCornerRadiusBottomLeft, "Bottom Left");
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
// Flip
|
||||
DrawSeparator();
|
||||
DrawHeaderPopup(_flip);
|
||||
@@ -514,6 +539,16 @@ namespace Coffee.UIEffects.Editors
|
||||
EditorGUI.indentLevel = indentLevel;
|
||||
}
|
||||
|
||||
private static void DrawRoundCornerRadiusField(SerializedProperty property, string label)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(property, EditorGUIUtility.TrTempContent(label));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
property.floatValue = Mathf.Max(0, property.floatValue);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawColorPickerField(Rect rect, SerializedProperty color, bool showAlpha)
|
||||
{
|
||||
var label = EditorGUIUtility.TrTempContent(color.displayName);
|
||||
|
||||
+14
-1
@@ -53,6 +53,7 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
|
||||
- [Gradation Mode](#gradation-mode)
|
||||
- [Edge Mode](#edge-mode)
|
||||
- [Detail Filter](#detail-filter)
|
||||
- [Round Corner](#round-corner)
|
||||
- [Flip](#flip)
|
||||
- [Others](#others)
|
||||
- [Component: UIEffectTweener](#component-uieffecttweener)
|
||||
@@ -452,6 +453,18 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
||||
|
||||
<br>
|
||||
|
||||
#### Round Corner
|
||||
|
||||

|
||||
|
||||
- **Mode**: `Off` or `On`. The default is `Off`.
|
||||
- **Top Left**, **Top Right**, **Bottom Right**, **Bottom Left**: Set each corner radius independently.
|
||||

|
||||
- Radius values use `transitionRoot` local units. They are normalized against its shorter dimension and clamped to half that dimension; `0` keeps a corner square.
|
||||
- The mask applies to the main UI surface; Shadow and Mirror outputs are left unchanged to avoid shadow-edge artifacts.
|
||||
|
||||
<br>
|
||||
|
||||
#### Flip
|
||||
|
||||

|
||||
@@ -476,7 +489,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
||||
- **Custom Root**: Use the custom transform for some effects.
|
||||
|
||||
> [!TIP]
|
||||
> `Transition Filter`, `Gradation Filter`, and `Detail Filter` usually refer to their own `RectTransform` when applying effects.
|
||||
> `Transition Filter`, `Gradation Filter`, `Detail Filter`, and `Round Corner` use their effect root for local-coordinate calculations.
|
||||
> For example, if the mesh shape exceeds the `RectTransform` boundaries, the effect may not be applied correctly.
|
||||
> By specifying `Custom Root`, you can refer to the specified transform.
|
||||
> 
|
||||
|
||||
@@ -90,6 +90,12 @@ namespace Coffee.UIEffects
|
||||
Mirror
|
||||
}
|
||||
|
||||
public enum RoundCornerMode
|
||||
{
|
||||
Off = 0,
|
||||
On = 1
|
||||
}
|
||||
|
||||
public enum EdgeMode
|
||||
{
|
||||
None = 0,
|
||||
|
||||
@@ -266,6 +266,12 @@ namespace Coffee.UIEffects
|
||||
[SerializeField]
|
||||
protected Vector2 m_DetailTexSpeed = new Vector2(0, 0);
|
||||
|
||||
[SerializeField]
|
||||
protected RoundCornerMode m_RoundCornerMode = RoundCornerMode.Off;
|
||||
|
||||
[SerializeField]
|
||||
protected Vector4 m_RoundCornerRadius = new Vector4(20, 20, 20, 20);
|
||||
|
||||
[SerializeField]
|
||||
protected RectTransform m_CustomRoot = null;
|
||||
|
||||
@@ -1423,6 +1429,71 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
|
||||
public Vector4 roundCornerRadius
|
||||
{
|
||||
get => m_RoundCornerRadius;
|
||||
set
|
||||
{
|
||||
value = new Vector4(
|
||||
Mathf.Max(0, value.x),
|
||||
Mathf.Max(0, value.y),
|
||||
Mathf.Max(0, value.z),
|
||||
Mathf.Max(0, value.w));
|
||||
if (m_RoundCornerRadius.x == value.x
|
||||
&& m_RoundCornerRadius.y == value.y
|
||||
&& m_RoundCornerRadius.z == value.z
|
||||
&& m_RoundCornerRadius.w == value.w)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
context.m_RoundCornerRadius = m_RoundCornerRadius = value;
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public RoundCornerMode roundCornerMode
|
||||
{
|
||||
get => m_RoundCornerMode;
|
||||
set
|
||||
{
|
||||
if (m_RoundCornerMode == value) return;
|
||||
context.m_RoundCornerMode = m_RoundCornerMode = value;
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public float roundCornerRadiusTopLeft
|
||||
{
|
||||
get => m_RoundCornerRadius.x;
|
||||
set => SetRoundCornerRadius(0, value);
|
||||
}
|
||||
|
||||
public float roundCornerRadiusTopRight
|
||||
{
|
||||
get => m_RoundCornerRadius.y;
|
||||
set => SetRoundCornerRadius(1, value);
|
||||
}
|
||||
|
||||
public float roundCornerRadiusBottomRight
|
||||
{
|
||||
get => m_RoundCornerRadius.z;
|
||||
set => SetRoundCornerRadius(2, value);
|
||||
}
|
||||
|
||||
public float roundCornerRadiusBottomLeft
|
||||
{
|
||||
get => m_RoundCornerRadius.w;
|
||||
set => SetRoundCornerRadius(3, value);
|
||||
}
|
||||
|
||||
private void SetRoundCornerRadius(int index, float value)
|
||||
{
|
||||
var radius = m_RoundCornerRadius;
|
||||
radius[index] = value;
|
||||
roundCornerRadius = radius;
|
||||
}
|
||||
|
||||
public bool allowToModifyMeshShape
|
||||
{
|
||||
get => m_AllowToModifyMeshShape;
|
||||
@@ -1837,6 +1908,12 @@ namespace Coffee.UIEffects
|
||||
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
|
||||
}
|
||||
|
||||
if (!append || src.m_RoundCornerMode != RoundCornerMode.Off)
|
||||
{
|
||||
dst.m_RoundCornerMode = src.m_RoundCornerMode;
|
||||
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
|
||||
}
|
||||
|
||||
if (!append || src.m_Flip != 0)
|
||||
{
|
||||
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
|
||||
@@ -1969,6 +2046,12 @@ namespace Coffee.UIEffects
|
||||
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
|
||||
}
|
||||
|
||||
if (!append || src.m_RoundCornerMode != RoundCornerMode.Off)
|
||||
{
|
||||
dst.m_RoundCornerMode = src.m_RoundCornerMode;
|
||||
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
|
||||
}
|
||||
|
||||
if (!append || src.m_Flip != 0)
|
||||
{
|
||||
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
|
||||
@@ -2111,6 +2194,12 @@ namespace Coffee.UIEffects
|
||||
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
|
||||
}
|
||||
|
||||
if (!append || src.m_RoundCornerMode != RoundCornerMode.Off)
|
||||
{
|
||||
dst.m_RoundCornerMode = src.m_RoundCornerMode;
|
||||
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
|
||||
}
|
||||
|
||||
if (!append || src.m_Flip != 0)
|
||||
{
|
||||
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
|
||||
@@ -2204,6 +2293,9 @@ namespace Coffee.UIEffects
|
||||
dst.m_DetailTexOffset = src.m_DetailTexOffset;
|
||||
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
|
||||
|
||||
dst.m_RoundCornerMode = src.m_RoundCornerMode;
|
||||
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
|
||||
|
||||
dst.m_Flip = src.m_Flip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace Coffee.UIEffects
|
||||
private static readonly int s_DetailTex = Shader.PropertyToID("_DetailTex");
|
||||
private static readonly int s_DetailTex_ST = Shader.PropertyToID("_DetailTex_ST");
|
||||
private static readonly int s_DetailTex_Speed = Shader.PropertyToID("_DetailTex_Speed");
|
||||
private static readonly int s_RoundCornerRadius = Shader.PropertyToID("_RoundCornerRadius");
|
||||
private static readonly int s_RoundCornerRectSize = Shader.PropertyToID("_RoundCornerRectSize");
|
||||
private static readonly int s_GradationIntensity = Shader.PropertyToID("_GradationIntensity");
|
||||
private static readonly int s_GradationColorFilter = Shader.PropertyToID("_GradationColorFilter");
|
||||
private static readonly int s_GradationColor1 = Shader.PropertyToID("_GradationColor1");
|
||||
@@ -67,8 +69,11 @@ namespace Coffee.UIEffects
|
||||
private static readonly int s_GradationTex_ST = Shader.PropertyToID("_GradationTex_ST");
|
||||
private static readonly int s_GradationRadial = Shader.PropertyToID("_GradationRadial");
|
||||
private static readonly int s_RootViewMatrix = Shader.PropertyToID("_RootViewMatrix");
|
||||
private static readonly int s_RoundCornerViewMatrix = Shader.PropertyToID("_RoundCornerViewMatrix");
|
||||
private static readonly int s_GradViewMatrix = Shader.PropertyToID("_GradViewMatrix");
|
||||
private static readonly int s_MirrorRootViewMatrix = Shader.PropertyToID("_MirrorRootViewMatrix");
|
||||
private static readonly int s_MirrorRoundCornerViewMatrix =
|
||||
Shader.PropertyToID("_MirrorRoundCornerViewMatrix");
|
||||
private static readonly int s_MirrorGradViewMatrix = Shader.PropertyToID("_MirrorGradViewMatrix");
|
||||
private static readonly int s_CanvasToWorldMatrix = Shader.PropertyToID("_CanvasToWorldMatrix");
|
||||
|
||||
@@ -147,6 +152,12 @@ namespace Coffee.UIEffects
|
||||
"GRADATION_COLOR4"
|
||||
};
|
||||
|
||||
private static readonly string[] s_RoundCornerKeywords =
|
||||
{
|
||||
"",
|
||||
"ROUND_CORNER_ON"
|
||||
};
|
||||
|
||||
private static readonly Vector2[][] s_ShadowVectors = new[]
|
||||
{
|
||||
Array.Empty<Vector2>(), // None
|
||||
@@ -243,8 +254,17 @@ namespace Coffee.UIEffects
|
||||
public Vector2 m_DetailTexOffset;
|
||||
public Vector2 m_DetailTexSpeed;
|
||||
|
||||
public RoundCornerMode m_RoundCornerMode;
|
||||
public Vector4 m_RoundCornerRadius;
|
||||
|
||||
public Flip m_Flip;
|
||||
|
||||
private bool hasRoundCorner => m_RoundCornerMode == RoundCornerMode.On
|
||||
&& (0 < m_RoundCornerRadius.x
|
||||
|| 0 < m_RoundCornerRadius.y
|
||||
|| 0 < m_RoundCornerRadius.z
|
||||
|| 0 < m_RoundCornerRadius.w);
|
||||
|
||||
public bool willModifyMaterial => m_ToneFilter != ToneFilter.None
|
||||
|| m_ColorFilter != ColorFilter.None
|
||||
|| m_SamplingFilter != SamplingFilter.None
|
||||
@@ -254,14 +274,16 @@ namespace Coffee.UIEffects
|
||||
|| m_ShadowMode != ShadowMode.None
|
||||
|| m_EdgeMode != EdgeMode.None
|
||||
|| m_DetailFilter != DetailFilter.None
|
||||
|| m_GradationMode != GradationMode.None;
|
||||
|| m_GradationMode != GradationMode.None
|
||||
|| hasRoundCorner;
|
||||
|
||||
public bool willModifyVertex => willModifyMaterial;
|
||||
|
||||
public bool useViewMatrix => m_TransitionFilter != TransitionFilter.None
|
||||
|| m_GradationMode != GradationMode.None
|
||||
|| m_DetailFilter != DetailFilter.None
|
||||
|| m_EdgeMode == EdgeMode.Shiny;
|
||||
|| m_EdgeMode == EdgeMode.Shiny
|
||||
|| hasRoundCorner;
|
||||
|
||||
private Texture2D _gradationRampTex;
|
||||
private Texture2D _transitionRampTex;
|
||||
@@ -434,6 +456,9 @@ namespace Coffee.UIEffects
|
||||
dst.m_DetailTexOffset = src.m_DetailTexOffset;
|
||||
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
|
||||
|
||||
dst.m_RoundCornerMode = src.m_RoundCornerMode;
|
||||
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
|
||||
|
||||
dst.m_Flip = src.m_Flip;
|
||||
}
|
||||
|
||||
@@ -539,6 +564,8 @@ namespace Coffee.UIEffects
|
||||
new Vector4(m_DetailTexScale.x, m_DetailTexScale.y,
|
||||
m_DetailTexOffset.x, m_DetailTexOffset.y));
|
||||
material.SetVector(s_DetailTex_Speed, m_DetailTexSpeed);
|
||||
material.SetVector(s_RoundCornerRadius, Vector4.zero);
|
||||
material.SetVector(s_RoundCornerRectSize, Vector2.one);
|
||||
|
||||
SetKeyword(material, s_ToneKeywords, (int)m_ToneFilter);
|
||||
SetKeyword(material, s_ColorKeywords, m_ColorFilter != 0 || m_ShadowMode != 0 ? 1 : 0);
|
||||
@@ -547,6 +574,7 @@ namespace Coffee.UIEffects
|
||||
SetKeyword(material, s_EdgeKeywords, (int)m_EdgeMode);
|
||||
SetKeyword(material, s_DetailKeywords, (int)m_DetailFilter);
|
||||
SetKeyword(material, s_TargetKeywords, (int)m_TargetMode);
|
||||
SetKeyword(material, s_RoundCornerKeywords, (int)m_RoundCornerMode);
|
||||
|
||||
switch (m_GradationMode)
|
||||
{
|
||||
@@ -608,6 +636,26 @@ namespace Coffee.UIEffects
|
||||
var offset = (transitionRoot.pivot - (Vector2)pivot) * size;
|
||||
var w2LMat = Matrix4x4.Translate(offset) * transitionRoot.worldToLocalMatrix;
|
||||
|
||||
var roundCornerNormalization = Mathf.Min(size.x, size.y);
|
||||
var roundCornerRectSize = Vector2.one;
|
||||
var roundCornerRadius = Vector4.zero;
|
||||
if (m_RoundCornerMode == RoundCornerMode.On && 0 < roundCornerNormalization)
|
||||
{
|
||||
roundCornerRectSize = size / roundCornerNormalization;
|
||||
roundCornerRadius = new Vector4(
|
||||
Mathf.Clamp(m_RoundCornerRadius.x / roundCornerNormalization, 0, 0.5f),
|
||||
Mathf.Clamp(m_RoundCornerRadius.y / roundCornerNormalization, 0, 0.5f),
|
||||
Mathf.Clamp(m_RoundCornerRadius.z / roundCornerNormalization, 0, 0.5f),
|
||||
Mathf.Clamp(m_RoundCornerRadius.w / roundCornerNormalization, 0, 0.5f));
|
||||
}
|
||||
|
||||
material.SetVector(s_RoundCornerRadius, roundCornerRadius);
|
||||
material.SetVector(s_RoundCornerRectSize, roundCornerRectSize);
|
||||
|
||||
var roundCornerScale = new Vector3(1f / size.x, 1f / size.y, 1f);
|
||||
material.SetMatrix(s_RoundCornerViewMatrix,
|
||||
Matrix4x4.TRS(pivot, Quaternion.identity, roundCornerScale) * w2LMat);
|
||||
|
||||
var rootRotation = Quaternion.Euler(0, 0, m_TransitionRotation);
|
||||
var rootScale = 1f / GetMultiplier(m_TransitionRotation);
|
||||
material.SetMatrix(s_RootViewMatrix, Matrix4x4.TRS(pivot, rootRotation, scale * rootScale) * w2LMat);
|
||||
@@ -624,6 +672,8 @@ namespace Coffee.UIEffects
|
||||
var mirrorScale = new Vector3(1, mirrorInv, 1);
|
||||
var udScale = new Vector3(scale.x, -scale.y, scale.z);
|
||||
var mirrorTranslation = Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat;
|
||||
material.SetMatrix(s_MirrorRoundCornerViewMatrix,
|
||||
Matrix4x4.TRS(pivot, Quaternion.identity, roundCornerScale) * mirrorTranslation);
|
||||
material.SetMatrix(
|
||||
s_MirrorRootViewMatrix,
|
||||
Matrix4x4.TRS(pivot, rootRotation, udScale * rootScale) * mirrorTranslation
|
||||
|
||||
@@ -117,6 +117,9 @@ namespace Coffee.UIEffects
|
||||
public Vector2 m_DetailTexOffset = new Vector2(0, 0);
|
||||
public Vector2 m_DetailTexSpeed = new Vector2(0, 0);
|
||||
|
||||
public RoundCornerMode m_RoundCornerMode = RoundCornerMode.Off;
|
||||
public Vector4 m_RoundCornerRadius = new Vector4(20, 20, 20, 20);
|
||||
|
||||
public Flip m_Flip = 0;
|
||||
|
||||
public void UpdateContext(UIEffectContext dst)
|
||||
@@ -206,6 +209,9 @@ namespace Coffee.UIEffects
|
||||
dst.m_DetailTexOffset = src.m_DetailTexOffset;
|
||||
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
|
||||
|
||||
dst.m_RoundCornerMode = src.m_RoundCornerMode;
|
||||
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
|
||||
|
||||
dst.m_Flip = src.m_Flip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
#if !LEGACY_TMP_ENABLE
|
||||
const string tmpSupport = "TextMeshPro Support (Unity 6)";
|
||||
const string version = "v5.11.0 (Unity 6)";
|
||||
const string version = "v5.15.0 (Unity 6)";
|
||||
#else
|
||||
const string tmpSupport = "TextMeshPro Support";
|
||||
const string version = "v5.11.0";
|
||||
const string version = "v5.15.0";
|
||||
#endif
|
||||
ShaderSampleImporter.RegisterReadmeUrl("https://github.com/mob-sakai/UIEffect#import-additional-resources");
|
||||
ShaderSampleImporter.RegisterShaderSamples(new[]
|
||||
@@ -138,8 +138,8 @@ namespace Coffee.UIEffects
|
||||
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
|
||||
|
||||
// ShaderGraph Support
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.11.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.11.0")
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.15.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.15.0")
|
||||
});
|
||||
ShaderSampleImporter.RegisterShaderAliases(new[]
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override void SetVerticesDirty(Graphic graphic, bool enabled)
|
||||
{
|
||||
// TMP submeshes are updated only when the parent is rebuilt, so queue the parent even if the replica is disabled. (#416)
|
||||
// TMP submeshes are updated only when the parent is rebuilt, so queue the parent even if the replica is disabled. (#416)
|
||||
if (graphic is TMP_SubMeshUI subMeshUI)
|
||||
{
|
||||
graphic = subMeshUI.textComponent as TextMeshProUGUI;
|
||||
|
||||
+1
@@ -48,6 +48,7 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
|
||||
.AddKeywordForUIEffect("DETAIL", "s_DetailKeywords") // add detail keywords
|
||||
.AddKeywordForUIEffect("TARGET", "s_TargetKeywords") // add target keywords
|
||||
.AddKeywordForUIEffect("GRADATION", "s_GradationKeywords") // add gradation keywords
|
||||
.AddKeywordForUIEffect("ROUND_CORNER", "s_RoundCornerKeywords") // add round corner keywords
|
||||
.AddKeywordForUIEffect("UIEFFECT_EDITOR", KeywordScope.Global) // add UIEffect editor keywords
|
||||
.AddKeywordForUIEffect("SOFTMASK_EDITOR", KeywordScope.Global) // add softmask editor keywords
|
||||
.AddKeywordForUIEffect("SOFTMASKABLE"); // add softmaskable keywords
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
|
||||
+1
@@ -66,6 +66,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ SubShader{
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -135,6 +135,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -135,6 +135,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -97,6 +97,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -100,6 +100,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -97,6 +97,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -135,6 +135,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0
|
||||
userData: v5.15.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -66,6 +66,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ SubShader{
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -135,6 +135,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -136,6 +136,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -97,6 +97,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -100,6 +100,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -98,6 +98,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
@@ -135,6 +135,7 @@ SubShader {
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.11.0 (Unity 6)
|
||||
userData: v5.15.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -54,6 +54,8 @@ uniform const half4 _DetailColor;
|
||||
uniform const sampler2D _DetailTex;
|
||||
uniform const float4 _DetailTex_ST;
|
||||
uniform const float2 _DetailTex_Speed;
|
||||
uniform const float4 _RoundCornerRadius;
|
||||
uniform const float2 _RoundCornerRectSize;
|
||||
uniform const float _GradationIntensity;
|
||||
uniform const int _GradationColorFilter;
|
||||
uniform const half4 _GradationColor1;
|
||||
@@ -64,8 +66,10 @@ uniform const sampler2D _GradationTex;
|
||||
uniform const float4 _GradationTex_ST;
|
||||
uniform const int _GradationRadial;
|
||||
uniform const matrix _RootViewMatrix;
|
||||
uniform const matrix _RoundCornerViewMatrix;
|
||||
uniform const matrix _GradViewMatrix;
|
||||
uniform const matrix _MirrorRootViewMatrix;
|
||||
uniform const matrix _MirrorRoundCornerViewMatrix;
|
||||
uniform const matrix _MirrorGradViewMatrix;
|
||||
uniform const matrix _CanvasToWorldMatrix;
|
||||
|
||||
@@ -95,8 +99,9 @@ struct uieffect_v2f
|
||||
#define EDGE_NONE (!EDGE_PLAIN && !EDGE_SHINY)
|
||||
#define DETAIL_NONE (!DETAIL_MASKING && !DETAIL_MULTIPLY && !DETAIL_ADDITIVE && !DETAIL_SUBTRACTIVE && !DETAIL_REPLACE && !DETAIL_MULTIPLY_ADDITIVE)
|
||||
#define GRADATION_NONE (!GRADATION_GRADIENT && !GRADATION_RADIAL && !GRADATION_COLOR2 && !GRADATION_COLOR4)
|
||||
#define ROUND_CORNER_OFF (!ROUND_CORNER_ON)
|
||||
|
||||
#if TONE_NONE && !COLOR_FILTER && SAMPLING_NONE && TRANSITION_NONE && TARGET_NONE && EDGE_NONE && DETAIL_NONE && GRADATION_NONE
|
||||
#if TONE_NONE && !COLOR_FILTER && SAMPLING_NONE && TRANSITION_NONE && TARGET_NONE && EDGE_NONE && DETAIL_NONE && GRADATION_NONE && ROUND_CORNER_OFF
|
||||
#define NO_UIEFFECT
|
||||
#endif
|
||||
|
||||
@@ -559,20 +564,45 @@ float is_edge_shiny(const float2 uvLocal)
|
||||
#endif
|
||||
}
|
||||
|
||||
half4 uieffect_internal(UIEFFECT_FRAG_STRUCT IN, float2 uv, float4 uvMask, const float2 uvLocal, const float2 uvGrad, const float isShadow)
|
||||
float round_corner_mask(const float2 uvLocal)
|
||||
{
|
||||
const half alpha = transition_alpha(uvLocal);
|
||||
#if ROUND_CORNER_ON
|
||||
const float radius = uvLocal.y > 0.5
|
||||
? (uvLocal.x < 0.5 ? _RoundCornerRadius.x : _RoundCornerRadius.y)
|
||||
: (uvLocal.x < 0.5 ? _RoundCornerRadius.w : _RoundCornerRadius.z);
|
||||
if (radius <= 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const float2 halfSize = _RoundCornerRectSize * 0.5;
|
||||
const float clampedRadius = min(radius, min(halfSize.x, halfSize.y));
|
||||
const float2 localPosition = (uvLocal - 0.5) * _RoundCornerRectSize;
|
||||
const float2 corner = abs(localPosition) - (halfSize - clampedRadius);
|
||||
const float signedDistance = length(max(corner, 0)) + min(max(corner.x, corner.y), 0) - clampedRadius;
|
||||
const float antialias = max(fwidth(signedDistance), 1e-5);
|
||||
return 1 - smoothstep(-antialias, antialias, signedDistance);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
half4 uieffect_internal(UIEFFECT_FRAG_STRUCT IN, float2 uv, float4 uvMask, const float2 uvLocal,
|
||||
const float2 uvEffect, const float2 uvGrad, const float isShadow, const bool applyRoundCornerMask)
|
||||
{
|
||||
const half alpha = transition_alpha(uvEffect);
|
||||
const float edgeFactor = edge(uv, uvMask, _EdgeWidth);
|
||||
uv += move_transition_filter(uvMask, alpha);
|
||||
half4 color = apply_sampling_filter(IN, uv, uvMask, isShadow);
|
||||
color = apply_gradation_filter(color, uvGrad);
|
||||
color = apply_tone_filter(color);
|
||||
color = apply_transition_filter(color, alpha, uvLocal, edgeFactor);
|
||||
color = apply_detail_filter(color, uvLocal);
|
||||
color = apply_transition_filter(color, alpha, uvEffect, edgeFactor);
|
||||
color = apply_detail_filter(color, uvEffect);
|
||||
|
||||
half4 result;
|
||||
if (0 < isShadow)
|
||||
{
|
||||
return apply_color_filter(_ShadowColorFilter, color, _ShadowColor, 1, _ShadowColorGlow);
|
||||
result = apply_color_filter(_ShadowColorFilter, color, _ShadowColor, 1, _ShadowColorGlow);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -580,21 +610,27 @@ half4 uieffect_internal(UIEFFECT_FRAG_STRUCT IN, float2 uv, float4 uvMask, const
|
||||
{
|
||||
color = apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow);
|
||||
const half4 edgeColor = apply_color_filter(_EdgeColorFilter, color, _EdgeColor, 1, _EdgeColorGlow);
|
||||
const float isEdgeShiny = is_edge_shiny(uvLocal);
|
||||
return lerp(color, edgeColor, edgeFactor * isEdgeShiny);
|
||||
const float isEdgeShiny = is_edge_shiny(uvEffect);
|
||||
result = lerp(color, edgeColor, edgeFactor * isEdgeShiny);
|
||||
}
|
||||
#else
|
||||
{
|
||||
return apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow);
|
||||
result = apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return applyRoundCornerMask ? result * round_corner_mask(uvLocal) : result;
|
||||
}
|
||||
|
||||
half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRAG_STRUCT IN)
|
||||
{
|
||||
#ifdef NO_UIEFFECT
|
||||
return origin;
|
||||
if (max(max(_RoundCornerRadius.x, _RoundCornerRadius.y),
|
||||
max(_RoundCornerRadius.z, _RoundCornerRadius.w)) <= 0)
|
||||
{
|
||||
return origin;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CANVAS_SHADERGRAPH
|
||||
@@ -605,14 +641,35 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRA
|
||||
wpos = mul(_CanvasToWorldMatrix, wpos);
|
||||
#endif
|
||||
const half rate = get_target_rate(origin.rgb);
|
||||
float2 uvLocal = saturate(mul(_RootViewMatrix, wpos)).xy;
|
||||
float2 uvEffect = saturate(mul(_RootViewMatrix, wpos)).xy;
|
||||
|
||||
#if !ROUND_CORNER_OFF
|
||||
float2 uvLocal = saturate(mul(_RoundCornerViewMatrix, wpos)).xy;
|
||||
#else
|
||||
float2 uvLocal = float2(0, 0);
|
||||
#endif
|
||||
|
||||
#if !GRADATION_NONE
|
||||
float2 uvGrad = mul(_GradViewMatrix, wpos).xy;
|
||||
#else
|
||||
float2 uvGrad = float2(0, 0);
|
||||
#endif
|
||||
|
||||
const bool isShadowMesh = uvMask.x < -1;
|
||||
|
||||
// Mirror
|
||||
if (uvMask.x < -3)
|
||||
{
|
||||
uvLocal = saturate(mul(_MirrorRootViewMatrix, wpos)).xy;
|
||||
uvEffect = saturate(mul(_MirrorRootViewMatrix, wpos)).xy;
|
||||
|
||||
#if !ROUND_CORNER_OFF
|
||||
uvLocal = saturate(mul(_MirrorRoundCornerViewMatrix, wpos)).xy;
|
||||
#endif
|
||||
|
||||
#if !GRADATION_NONE
|
||||
uvGrad = saturate(mul(_MirrorGradViewMatrix, wpos)).xy;
|
||||
#endif
|
||||
|
||||
uvMask.x += 4;
|
||||
}
|
||||
|
||||
@@ -629,10 +686,11 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRA
|
||||
#elif SAMPLING_RGB_SHIFT
|
||||
{
|
||||
const half2 offset = half2(_SamplingIntensity * texel_size().x * 20, 0);
|
||||
const half2 r = uieffect_internal(IN, uv + offset, uvMask, uvLocal, uvGrad, isShadow).ra;
|
||||
const half2 g = uieffect_internal(IN, uv, uvMask, uvLocal, uvGrad, isShadow).ga;
|
||||
const half2 b = uieffect_internal(IN, uv - offset, uvMask, uvLocal, uvGrad, isShadow).ba;
|
||||
return half4(r.x * r.y, g.x * g.y, b.x * b.y, (r.y + g.y + b.y) / 3);
|
||||
const half2 r = uieffect_internal(IN, uv + offset, uvMask, uvLocal, uvEffect, uvGrad, isShadow, false).ra;
|
||||
const half2 g = uieffect_internal(IN, uv, uvMask, uvLocal, uvEffect, uvGrad, isShadow, false).ga;
|
||||
const half2 b = uieffect_internal(IN, uv - offset, uvMask, uvLocal, uvEffect, uvGrad, isShadow, false).ba;
|
||||
const half4 color = half4(r.x * r.y, g.x * g.y, b.x * b.y, (r.y + g.y + b.y) / 3);
|
||||
return isShadowMesh ? color : color * round_corner_mask(uvLocal);
|
||||
}
|
||||
// Sampling.EdgeLuminance/EdgeAlpha
|
||||
#elif SAMPLING_EDGE_LUMINANCE || SAMPLING_EDGE_ALPHA
|
||||
@@ -655,11 +713,14 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRA
|
||||
half sobel_v = v00 * -1.0 + v10 * -2.0 + v20 * -1.0 + v02 * 1.0 + v12 * 2.0 + v22 * 1.0;
|
||||
|
||||
const half sobel = sqrt(sobel_h * sobel_h + sobel_v * sobel_v) * _SamplingIntensity;
|
||||
return lerp(half4(0, 0, 0, 0), uieffect_internal(IN, uv, uvMask, uvLocal, uvGrad, isShadow), inv_lerp(0.5, 1, sobel));
|
||||
return lerp(half4(0, 0, 0, 0),
|
||||
uieffect_internal(IN, uv, uvMask, uvLocal, uvEffect, uvGrad, isShadow, !isShadowMesh),
|
||||
inv_lerp(0.5, 1, sobel));
|
||||
}
|
||||
#endif
|
||||
|
||||
return lerp(origin, uieffect_internal(IN, uv, uvMask, uvLocal, uvGrad, isShadow), rate);
|
||||
return lerp(origin, uieffect_internal(IN, uv, uvMask, uvLocal, uvEffect, uvGrad, isShadow, !isShadowMesh),
|
||||
rate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ Shader "Hidden/UI/Default (UIEffect)"
|
||||
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
|
||||
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
|
||||
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
|
||||
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
|
||||
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
|
||||
// ==== UIEFFECT END ====
|
||||
|
||||
|
||||
Reference in New Issue
Block a user