mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-19 17:22:37 +08:00
feat: update shaders in samples
NOTE: Imported samples will be automatically updated.
This commit is contained in:
@@ -93,10 +93,10 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
#if UNITY_2023_2_OR_NEWER
|
||||
const string tmpSupport = "TextMeshPro Support (Unity 6)";
|
||||
const string version = "v5.8.0 (Unity 6)";
|
||||
const string version = "v5.9.0 (Unity 6)";
|
||||
#else
|
||||
const string tmpSupport = "TextMeshPro Support";
|
||||
const string version = "v5.8.0";
|
||||
const string version = "v5.9.0";
|
||||
#endif
|
||||
ShaderSampleImporter.RegisterShaderSamples(new[]
|
||||
{
|
||||
@@ -111,8 +111,8 @@ namespace Coffee.UIEffects
|
||||
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
|
||||
|
||||
// ShaderGraph Support
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.8.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.8.0")
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.9.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.9.0")
|
||||
});
|
||||
ShaderSampleImporter.RegisterShaderAliases(new[]
|
||||
{
|
||||
|
||||
+10
-1
@@ -10,7 +10,9 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
|
||||
internal class BuiltInUIEffectSubTarget : BuiltInCanvasSubTarget
|
||||
{
|
||||
// UIEffectForShaderGraph.hlsl
|
||||
internal static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath("5109b2ad9b8be459592190a5678464e3");
|
||||
private static GUID s_UIEffectCgincGuid => new GUID("2dd0ed35b98b345218d9aa8ac5a3ad6b");
|
||||
private static GUID s_UIEffectHlslGuid => new GUID("5109b2ad9b8be459592190a5678464e3");
|
||||
private static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath(s_UIEffectHlslGuid.ToString());
|
||||
|
||||
public BuiltInUIEffectSubTarget() { displayName = "Canvas (UIEffect)"; }
|
||||
|
||||
@@ -25,6 +27,13 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
|
||||
protected override IncludeCollection postgraphIncludes => base.postgraphIncludes
|
||||
.Add(s_UIEffectHlsl, IncludeLocation.Postgraph); // Include UIEffectForShaderGraph.hlsl on postgraph
|
||||
|
||||
public override void Setup(ref TargetSetupContext context)
|
||||
{
|
||||
base.Setup(ref context);
|
||||
context.AddAssetDependency(s_UIEffectHlslGuid, AssetCollection.Flags.SourceDependency);
|
||||
context.AddAssetDependency(s_UIEffectCgincGuid, AssetCollection.Flags.SourceDependency);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modify pass descriptor for UIEffect.
|
||||
/// </summary>
|
||||
|
||||
+11
-10
@@ -1,5 +1,6 @@
|
||||
// ==== UIEFFECT START ====
|
||||
SurfaceDescriptionInputs _fragInput;
|
||||
|
||||
half4 uieffect_frag(float2 uv)
|
||||
{
|
||||
float2 prevUv = _fragInput.uv0.xy;
|
||||
@@ -34,25 +35,25 @@ half4 frag_override(PackedVaryings packedInput) : SV_TARGET
|
||||
_fragInput = surfaceDescriptionInputs;
|
||||
const half4 origin = uieffect_frag(_fragInput.uv0.xy);
|
||||
half4 color = uieffect(origin, _fragInput.uv0.xy, unpacked.texCoord2, float4(unpacked.positionWS, 1));
|
||||
|
||||
|
||||
//Round up the alpha color coming from the interpolator (to 1.0/256.0 steps)
|
||||
//The incoming alpha could have numerical instability, which makes it very sensible to
|
||||
//HDR color transparency blend, when it blends with the world's texture.
|
||||
const half alphaPrecision = half(0xff);
|
||||
const half invAlphaPrecision = half(1.0/alphaPrecision);
|
||||
unpacked.color.a = round(unpacked.color.a * alphaPrecision)*invAlphaPrecision;
|
||||
|
||||
const half invAlphaPrecision = half(1.0 / alphaPrecision);
|
||||
unpacked.color.a = round(unpacked.color.a * alphaPrecision) * invAlphaPrecision;
|
||||
|
||||
#if !defined(HAVE_VFX_MODIFICATION) && !defined(_DISABLE_COLOR_TINT)
|
||||
color.rgb *= unpacked.color.rgb;
|
||||
color *= unpacked.color.a;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
//mask = Uv2
|
||||
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(unpacked.texCoord1.xy)) * unpacked.texCoord1.zw);
|
||||
color *= m.x * m.y;
|
||||
#endif
|
||||
|
||||
|
||||
// ==== SOFTMASKABLE START ====
|
||||
#if SOFTMASKABLE
|
||||
color *= SoftMask(unpacked.positionCS, unpacked.positionWS, color.a);
|
||||
@@ -62,10 +63,10 @@ half4 frag_override(PackedVaryings packedInput) : SV_TARGET
|
||||
#if defined(_ALPHATEST_ON) || defined(_BUILTIN_ALPHATEST_ON)
|
||||
clip(color.a - surfaceDescription.AlphaClipThreshold);
|
||||
#endif
|
||||
|
||||
|
||||
#if UNITY_UI_ALPHACLIP
|
||||
clip(color.a - 0.001);
|
||||
#endif
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
|
||||
+13
-1
@@ -6,6 +6,11 @@ namespace UnityEditor.Rendering.Universal.ShaderGraph
|
||||
{
|
||||
internal class UniversalUIEffectSubTarget : UniversalCanvasSubTarget
|
||||
{
|
||||
// UIEffectForShaderGraph.hlsl
|
||||
private static GUID s_UIEffectCgincGuid => new GUID("2dd0ed35b98b345218d9aa8ac5a3ad6b");
|
||||
private static GUID s_UIEffectHlslGuid => new GUID("5109b2ad9b8be459592190a5678464e3");
|
||||
private static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath(s_UIEffectHlslGuid.ToString());
|
||||
|
||||
[MenuItem("Assets/Create/Shader Graph/URP/Canvas Shader Graph (UIEffect)", priority = 1000)]
|
||||
private static void CreateUnlitGraph()
|
||||
{
|
||||
@@ -18,7 +23,14 @@ namespace UnityEditor.Rendering.Universal.ShaderGraph
|
||||
public UniversalUIEffectSubTarget() { displayName = "Canvas (UIEffect)"; }
|
||||
|
||||
protected override IncludeCollection postgraphIncludes => base.postgraphIncludes
|
||||
.Add(BuiltInUIEffectSubTarget.s_UIEffectHlsl, IncludeLocation.Postgraph);
|
||||
.Add(s_UIEffectHlsl, IncludeLocation.Postgraph);
|
||||
|
||||
public override void Setup(ref TargetSetupContext context)
|
||||
{
|
||||
base.Setup(ref context);
|
||||
context.AddAssetDependency(s_UIEffectHlslGuid, AssetCollection.Flags.SourceDependency);
|
||||
context.AddAssetDependency(s_UIEffectCgincGuid, AssetCollection.Flags.SourceDependency);
|
||||
}
|
||||
|
||||
public override PassDescriptor GenerateUIPassDescriptor(bool isSRP)
|
||||
{
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0 (Unity 6)
|
||||
userData: v5.9.0 (Unity 6)
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -4,6 +4,6 @@ ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData: v5.8.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Reference in New Issue
Block a user