fix: fix alpha clipping for ShaderGraph

This commit is contained in:
mob-sakai
2025-04-17 02:37:11 +09:00
parent 88bb76d735
commit ae177a800c
5 changed files with 130 additions and 5 deletions
@@ -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.7.0"),
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.7.0")
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.8.0"),
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.8.0")
});
ShaderSampleImporter.RegisterShaderAliases(new[]
{
@@ -60,7 +60,7 @@ half4 frag_override(PackedVaryings packedInput) : SV_TARGET
// ==== SOFTMASKABLE END ====
#if defined(_ALPHATEST_ON) || defined(_BUILTIN_ALPHATEST_ON)
clip(color.a - surfaceDescription.Alpha);
clip(color.a - surfaceDescription.AlphaClipThreshold);
#endif
#if UNITY_UI_ALPHACLIP
@@ -26,6 +26,12 @@
},
{
"m_Id": "867db961355a4c1ea898b69d9e6549b0"
},
{
"m_Id": "a76cdcf36ae243e5a5ea033c7d40d34f"
},
{
"m_Id": "23e0b7c820e7452ab73c3bec44cf0e48"
}
],
"m_GroupDatas": [],
@@ -92,6 +98,12 @@
},
{
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
},
{
"m_Id": "a76cdcf36ae243e5a5ea033c7d40d34f"
},
{
"m_Id": "23e0b7c820e7452ab73c3bec44cf0e48"
}
]
},
@@ -168,6 +180,85 @@
"m_CustomEditorGUI": ""
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "23e0b7c820e7452ab73c3bec44cf0e48",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.AlphaClipThreshold",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "3c6f2af22741431faed8a2606630029a"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "3c6f2af22741431faed8a2606630029a",
"m_Id": 0,
"m_DisplayName": "Alpha Clip Threshold",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "AlphaClipThreshold",
"m_StageCapability": 2,
"m_Value": 0.009999999776482582,
"m_DefaultValue": 0.5,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "5891f1777feb46cdbd85b489f87bfc69",
"m_Id": 0,
"m_DisplayName": "Emission",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Emission",
"m_StageCapability": 2,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_ColorMode": 1,
"m_DefaultColor": {
"r": 0.0,
"g": 0.0,
"b": 0.0,
"a": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
@@ -402,6 +493,40 @@
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "a76cdcf36ae243e5a5ea033c7d40d34f",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Emission",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "5891f1777feb46cdbd85b489f87bfc69"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Emission"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
@@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData: v5.7.0
userData: v5.8.0
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData: v5.7.0
userData: v5.8.0
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}