feat: ShaderGraph support

close #326
This commit is contained in:
mob-sakai
2025-04-06 11:39:47 +09:00
parent 21172f37c2
commit 2dd2e26166
25 changed files with 59182 additions and 25 deletions
@@ -98,7 +98,11 @@ namespace Coffee.UIEffects
("Hidden/TextMeshPro/Bitmap (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Mobile/Bitmap (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Distance Field (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version)
("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")
});
ShaderSampleImporter.RegisterShaderAliases(new[]
{
@@ -0,0 +1,167 @@
using System;
using System.Linq;
using System.Reflection;
using UnityEditor.ShaderGraph;
using UnityEngine;
using BlendMode = UnityEngine.Rendering.BlendMode;
namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
{
internal class BuiltInUIEffectSubTarget : BuiltInCanvasSubTarget
{
// UIEffectForShaderGraph.hlsl
internal static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath("5109b2ad9b8be459592190a5678464e3");
public BuiltInUIEffectSubTarget() { displayName = "Canvas (UIEffect)"; }
[MenuItem("Assets/Create/Shader Graph/BuiltIn/Canvas Shader Graph (UIEffect)", priority = 1000)]
private static void CreateUnlitGraph()
{
var target = (BuiltInTarget)Activator.CreateInstance(typeof(BuiltInTarget));
target.TrySetActiveSubTarget(typeof(BuiltInUIEffectSubTarget));
target.CreateGraphAsset();
}
protected override IncludeCollection postgraphIncludes => base.postgraphIncludes
.Add(s_UIEffectHlsl, IncludeLocation.Postgraph); // Include UIEffectForShaderGraph.hlsl on postgraph
/// <summary>
/// Modify pass descriptor for UIEffect.
/// </summary>
public static PassDescriptor ModifyUIPassDescriptor(PassDescriptor descriptor)
{
descriptor.keywords
.AddKeywordForUIEffect("TONE", "s_ToneKeywords") // add tone keywords
.AddKeywordForUIEffect("COLOR_FILTER") // add color filter keywords
.AddKeywordForUIEffect("SAMPLING", "s_SamplingKeywords") // add sampling keywords
.AddKeywordForUIEffect("TRANSITION", "s_TransitionKeywords") // add transition keywords
.AddKeywordForUIEffect("EDGE", "s_EdgeKeywords") // add edge keywords
.AddKeywordForUIEffect("DETAIL", "s_DetailKeywords") // add detail keywords
.AddKeywordForUIEffect("TARGET", "s_TargetKeywords") // add target keywords
.AddKeywordForUIEffect("GRADATION", "s_GradationKeywords") // add gradation keywords
.AddKeywordForUIEffect("UIEFFECT_EDITOR", KeywordScope.Global) // add UIEffect editor keywords
.AddKeywordForUIEffect("SOFTMASK_EDITOR", KeywordScope.Global) // add softmask editor keywords
.AddKeywordForUIEffect("SOFTMASKABLE"); // add softmaskable keywords
descriptor.requiredFields
.Add(StructFields.Varyings.texCoord2); // add texCoord2 for UIEffect (uvMask)
descriptor.renderStates = descriptor.renderStates
.RemoveIf(x => x.descriptor.type == RenderStateType.Blend) // remove default blend state
.Add(RenderState.Blend("Blend [_SrcBlend] [_DstBlend]")); // add custom blend state
descriptor.pragmas = descriptor.pragmas
.RemoveIf(x =>
x.value.Contains(" vertex ") || x.value.Contains(" fragment ")) // remove default vertex/fragment
.Add(Pragma.Vertex("vert_override")) // add custom vertex function
.Add(Pragma.Fragment("frag_override")); // add custom fragment function
return descriptor;
}
/// <summary>
/// Modify shader properties for UIEffect.
/// </summary>
public static void ModifyShaderProperties(PropertyCollector collector)
{
collector.AddFloatProperty("_SrcBlend", (int)BlendMode.One);
collector.AddFloatProperty("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
}
public override PassDescriptor GenerateUIPassDescriptor(bool isSRP)
{
return ModifyUIPassDescriptor(base.GenerateUIPassDescriptor(isSRP));
}
public override void CollectShaderProperties(PropertyCollector collector, GenerationMode generationMode)
{
base.CollectShaderProperties(collector, generationMode);
ModifyShaderProperties(collector);
}
}
internal static class ShaderGraphExtensions
{
public static RenderStateCollection RemoveIf(this RenderStateCollection self,
Predicate<RenderStateCollection.Item> predicate)
{
var result = new RenderStateCollection();
foreach (var item in self.Where(x => !predicate(x)))
{
result.Add(item.descriptor, item.fieldConditions);
}
return result;
}
public static PragmaCollection RemoveIf(this PragmaCollection self,
Predicate<PragmaCollection.Item> predicate)
{
var result = new PragmaCollection();
foreach (var item in self.Where(x => !predicate(x)))
{
result.Add(item.descriptor, item.fieldConditions);
}
return result;
}
/// <summary>
/// Creates a boolean type keyword descriptor.
/// </summary>
public static KeywordCollection AddKeywordForUIEffect(this KeywordCollection self,
string name, KeywordScope scope = KeywordScope.Local)
{
return self.Add(new KeywordDescriptor()
{
displayName = name,
referenceName = name,
type = KeywordType.Boolean,
definition = KeywordDefinition.ShaderFeature,
stages = KeywordShaderStage.Fragment,
scope = scope
});
}
/// <summary>
/// Creates an enum type keyword descriptor based on the fields of the UIEffectContext class.
/// </summary>
public static KeywordCollection AddKeywordForUIEffect(this KeywordCollection self,
string name, string fieldName, KeywordScope scope = KeywordScope.Local)
{
var prefix = name + "_";
var keywords = Type.GetType("Coffee.UIEffects.UIEffectContext, Coffee.UIEffect")
.GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic)
.GetValue(null) as string[];
return self.Add(new KeywordDescriptor()
{
displayName = name,
referenceName = name,
type = KeywordType.Enum,
definition = KeywordDefinition.ShaderFeature,
stages = KeywordShaderStage.Fragment,
scope = scope,
entries = keywords
.Select(x => x.Replace(prefix, ""))
.Select(x => new KeywordEntry(x, x))
.ToArray()
});
}
public static void CreateGraphAsset(this Target self)
{
var name = $"New Shader Graph (UIEffect).{ShaderGraphImporter.Extension}";
var graphItem = ScriptableObject.CreateInstance<NewGraphAction>();
graphItem.targets = new[] { self };
graphItem.blocks = new[]
{
BlockFields.SurfaceDescription.BaseColor,
BlockFields.SurfaceDescription.Emission,
BlockFields.SurfaceDescription.Alpha,
BlockFields.SurfaceDescription.AlphaClipThreshold
};
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, graphItem, name, null, null);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 16d72000cb574468dbfa703ce763ab81
@@ -0,0 +1,71 @@
// ==== UIEFFECT START ====
SurfaceDescriptionInputs _fragInput;
half4 uieffect_frag(float2 uv)
{
float2 prevUv = _fragInput.uv0.xy;
_fragInput.uv0.xy = uv;
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(_fragInput);
_fragInput.uv0.xy = prevUv;
half alpha = surfaceDescription.Alpha;
return half4(surfaceDescription.BaseColor * alpha + surfaceDescription.Emission, alpha);
}
#include "Packages/com.coffee.ui-effect/Shaders/UIEffect.cginc"
// ==== UIEFFECT END ====
PackedVaryings vert_override(Attributes input)
{
Varyings output = BuildVaryings(input);
output.texCoord2 = input.uv1;
PackedVaryings packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag_override(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(unpacked);
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
_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;
#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);
#endif
// ==== SOFTMASKABLE END ====
#if defined(_ALPHATEST_ON) || defined(_BUILTIN_ALPHATEST_ON)
clip(color.a - surfaceDescription.Alpha);
#endif
#if UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return color;
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5109b2ad9b8be459592190a5678464e3
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

@@ -0,0 +1,169 @@
fileFormatVersion: 2
guid: e4d5ba59106dc45b38c6ccdbff19e895
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 2
wrapV: 2
wrapW: 2
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 256
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c31b8bd7d68a64b23b8c505bd7871154
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,557 @@
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "59df17a6c3174a02826ef2b2f0b22bba",
"m_Properties": [
{
"m_Id": "0edd83ed2c624ec1806581cf049b4102"
}
],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [
{
"m_Id": "8c8215c5d9714514b592e36aad9c148a"
}
],
"m_Nodes": [
{
"m_Id": "f3b826553df24fdb9d14e4f1ef5504c8"
},
{
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
},
{
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
{
"m_Id": "867db961355a4c1ea898b69d9e6549b0"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "f3b826553df24fdb9d14e4f1ef5504c8"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
"m_SlotId": 7
},
"m_InputSlot": {
"m_Node": {
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "867db961355a4c1ea898b69d9e6549b0"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
"m_SlotId": 1
}
}
],
"m_VertexContext": {
"m_Position": {
"x": -0.000025510787963867188,
"y": 82.99999237060547
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 0.0,
"y": 200.0
},
"m_Blocks": [
{
"m_Id": "f3b826553df24fdb9d14e4f1ef5504c8"
},
{
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
}
]
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
},
"preventRotation": false
},
"m_Path": "Shader Graphs",
"m_GraphPrecision": 1,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": ""
},
"m_SubDatas": [],
"m_ActiveTargets": [
{
"m_Id": "1a195cdf4382437789224a92fedff5b1"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty",
"m_ObjectId": "0edd83ed2c624ec1806581cf049b4102",
"m_Guid": {
"m_GuidSerialized": "732edd04-59f7-47df-9432-7fe06165e57a"
},
"m_Name": "_MainTex",
"m_DefaultRefNameVersion": 1,
"m_RefNameGeneratedByDisplayName": "_MainTex",
"m_DefaultReferenceName": "_MainTex",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_Value": {
"m_SerializedTexture": "",
"m_Guid": ""
},
"isMainTexture": false,
"useTilingAndOffset": false,
"m_Modifiable": true,
"m_DefaultType": 0
}
{
"m_SGVersion": 2,
"m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInTarget",
"m_ObjectId": "1a195cdf4382437789224a92fedff5b1",
"m_Datas": [
{
"m_Id": "eeebd3b9f4ac47059504bc3a1119b400"
}
],
"m_ActiveSubTarget": {
"m_Id": "7ead57ce3c34462b9abc55f1c840545b"
},
"m_AllowMaterialOverride": false,
"m_SurfaceType": 0,
"m_ZWriteControl": 0,
"m_ZTestMode": 4,
"m_AlphaMode": 0,
"m_RenderFace": 2,
"m_AlphaClip": true,
"m_CustomEditorGUI": ""
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
"m_ObjectId": "5b370c6775e1485c8289267723a78b11",
"m_Id": 0,
"m_DisplayName": "_MainTex",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_BareResource": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "68a8b951fcb8489891abfbfcc34a120e",
"m_Id": 4,
"m_DisplayName": "R",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "R",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot",
"m_ObjectId": "7639b4a17a334399a9f421cd50b7cfdb",
"m_Id": 2,
"m_DisplayName": "UV",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "UV",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [],
"m_Channel": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "78db00f49dfe4fa2b4369e32ebf28ec5",
"m_Id": 0,
"m_DisplayName": "RGBA",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "RGBA",
"m_StageCapability": 2,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode",
"m_ObjectId": "7952abbfa5764abbae262f142a3a064b",
"m_Group": {
"m_Id": ""
},
"m_Name": "Sample Texture 2D",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -274.0000305175781,
"y": 160.99998474121095,
"width": 183.00001525878907,
"height": 250.99998474121095
}
},
"m_Slots": [
{
"m_Id": "78db00f49dfe4fa2b4369e32ebf28ec5"
},
{
"m_Id": "68a8b951fcb8489891abfbfcc34a120e"
},
{
"m_Id": "a35c97e796354191a56cab4ebc1b0c97"
},
{
"m_Id": "9015c4f761784b57a17877f114771c6d"
},
{
"m_Id": "efc06576e366411a9dbb3c5e5c3e6dc1"
},
{
"m_Id": "d54d1ad0bcdf4b60a51da4f977c899e2"
},
{
"m_Id": "7639b4a17a334399a9f421cd50b7cfdb"
},
{
"m_Id": "e9a96a370b654f49bdaede33b9c5364c"
}
],
"synonyms": [
"tex2d"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_TextureType": 0,
"m_NormalMapSpace": 0,
"m_EnableGlobalMipBias": true,
"m_MipSamplingMode": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInUIEffectSubTarget",
"m_ObjectId": "7ead57ce3c34462b9abc55f1c840545b"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "867db961355a4c1ea898b69d9e6549b0",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -418.0,
"y": 183.0,
"width": 132.0,
"height": 33.99998474121094
}
},
"m_Slots": [
{
"m_Id": "5b370c6775e1485c8289267723a78b11"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "0edd83ed2c624ec1806581cf049b4102"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "8c8215c5d9714514b592e36aad9c148a",
"m_Name": "",
"m_ChildObjectList": [
{
"m_Id": "0edd83ed2c624ec1806581cf049b4102"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "9015c4f761784b57a17877f114771c6d",
"m_Id": 6,
"m_DisplayName": "B",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "92eee3a578d042e1b3d5449bc1deba68",
"m_Id": 0,
"m_DisplayName": "Alpha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 2,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "a35c97e796354191a56cab4ebc1b0c97",
"m_Id": 5,
"m_DisplayName": "G",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "G",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "bba29a5fc85343b2964b3e4b5a62d0bf",
"m_Id": 0,
"m_DisplayName": "Base Color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "BaseColor",
"m_StageCapability": 2,
"m_Value": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"m_DefaultValue": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"m_Labels": [],
"m_ColorMode": 0,
"m_DefaultColor": {
"r": 0.5,
"g": 0.5,
"b": 0.5,
"a": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "d326ef5f90af4c7996e7e0c915e57983",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Alpha",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 12.99997329711914,
"y": 270.0,
"width": 200.00001525878907,
"height": 41.0
}
},
"m_Slots": [
{
"m_Id": "92eee3a578d042e1b3d5449bc1deba68"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
"m_ObjectId": "d54d1ad0bcdf4b60a51da4f977c899e2",
"m_Id": 1,
"m_DisplayName": "Texture",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Texture",
"m_StageCapability": 3,
"m_BareResource": false,
"m_Texture": {
"m_SerializedTexture": "",
"m_Guid": ""
},
"m_DefaultType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot",
"m_ObjectId": "e9a96a370b654f49bdaede33b9c5364c",
"m_Id": 3,
"m_DisplayName": "Sampler",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Sampler",
"m_StageCapability": 3,
"m_BareResource": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Canvas.ShaderGraph.CanvasData",
"m_ObjectId": "eeebd3b9f4ac47059504bc3a1119b400",
"m_Version": 0,
"m_AlphaClip": false,
"m_DisableTint": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "efc06576e366411a9dbb3c5e5c3e6dc1",
"m_Id": 7,
"m_DisplayName": "A",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "f3b826553df24fdb9d14e4f1ef5504c8",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.BaseColor",
"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": "bba29a5fc85343b2964b3e4b5a62d0bf"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e5b632cdcfc38478ebc1424ae9371f99
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData: v5.7.0
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -0,0 +1,3 @@
{
"reference": "GUID:be0903cd8e1546f498710afdc59db5eb"
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0f789ebf4d79649a99ce55c22b322e8b
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

@@ -0,0 +1,169 @@
fileFormatVersion: 2
guid: 2f1058d436da64dd790d7c6db345a6b8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 2
wrapV: 2
wrapW: 2
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 256
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9d5fb70c6201e408ebe2e8941a0e5944
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,729 @@
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "59df17a6c3174a02826ef2b2f0b22bba",
"m_Properties": [
{
"m_Id": "0edd83ed2c624ec1806581cf049b4102"
}
],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [
{
"m_Id": "8c8215c5d9714514b592e36aad9c148a"
}
],
"m_Nodes": [
{
"m_Id": "f3b826553df24fdb9d14e4f1ef5504c8"
},
{
"m_Id": "c2a8615bb6ed48bfa85d0d3671740b5e"
},
{
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
},
{
"m_Id": "18361f77ae274f2598be88dcaae100de"
},
{
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
{
"m_Id": "867db961355a4c1ea898b69d9e6549b0"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "f3b826553df24fdb9d14e4f1ef5504c8"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
"m_SlotId": 7
},
"m_InputSlot": {
"m_Node": {
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "867db961355a4c1ea898b69d9e6549b0"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "7952abbfa5764abbae262f142a3a064b"
},
"m_SlotId": 1
}
}
],
"m_VertexContext": {
"m_Position": {
"x": -0.000025510787963867188,
"y": 82.99999237060547
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 0.0,
"y": 200.0
},
"m_Blocks": [
{
"m_Id": "f3b826553df24fdb9d14e4f1ef5504c8"
},
{
"m_Id": "d326ef5f90af4c7996e7e0c915e57983"
},
{
"m_Id": "c2a8615bb6ed48bfa85d0d3671740b5e"
},
{
"m_Id": "18361f77ae274f2598be88dcaae100de"
}
]
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
},
"preventRotation": false
},
"m_Path": "Shader Graphs",
"m_GraphPrecision": 1,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": ""
},
"m_SubDatas": [],
"m_ActiveTargets": [
{
"m_Id": "1a195cdf4382437789224a92fedff5b1"
},
{
"m_Id": "22af5ae5df2343a48eab120f592090a0"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty",
"m_ObjectId": "0edd83ed2c624ec1806581cf049b4102",
"m_Guid": {
"m_GuidSerialized": "732edd04-59f7-47df-9432-7fe06165e57a"
},
"m_Name": "_MainTex",
"m_DefaultRefNameVersion": 1,
"m_RefNameGeneratedByDisplayName": "_MainTex",
"m_DefaultReferenceName": "_MainTex",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_Value": {
"m_SerializedTexture": "",
"m_Guid": ""
},
"isMainTexture": false,
"useTilingAndOffset": false,
"m_Modifiable": true,
"m_DefaultType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "18361f77ae274f2598be88dcaae100de",
"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": "4ae12b62cdd7491ea48ecd15c123692d"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold"
}
{
"m_SGVersion": 2,
"m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInTarget",
"m_ObjectId": "1a195cdf4382437789224a92fedff5b1",
"m_Datas": [
{
"m_Id": "f39f3f444a8a4c7593cfa9d3958d6adb"
}
],
"m_ActiveSubTarget": {
"m_Id": "80f8f8e7c44e42c8b6eca7510eeee828"
},
"m_AllowMaterialOverride": false,
"m_SurfaceType": 0,
"m_ZWriteControl": 0,
"m_ZTestMode": 4,
"m_AlphaMode": 0,
"m_RenderFace": 2,
"m_AlphaClip": true,
"m_CustomEditorGUI": ""
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
"m_ObjectId": "22af5ae5df2343a48eab120f592090a0",
"m_Datas": [
{
"m_Id": "e8d949ab75d949a48b225e87bac14000"
}
],
"m_ActiveSubTarget": {
"m_Id": "ccc35450f1194a7794f124787f7223de"
},
"m_AllowMaterialOverride": false,
"m_SurfaceType": 0,
"m_ZTestMode": 4,
"m_ZWriteControl": 0,
"m_AlphaMode": 0,
"m_RenderFace": 2,
"m_AlphaClip": false,
"m_CastShadows": true,
"m_ReceiveShadows": true,
"m_DisableTint": false,
"m_AdditionalMotionVectorMode": 0,
"m_AlembicMotionVectors": false,
"m_SupportsLODCrossFade": false,
"m_CustomEditorGUI": "",
"m_SupportVFX": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "4ae12b62cdd7491ea48ecd15c123692d",
"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.Texture2DMaterialSlot",
"m_ObjectId": "5b370c6775e1485c8289267723a78b11",
"m_Id": 0,
"m_DisplayName": "_MainTex",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_BareResource": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "68a8b951fcb8489891abfbfcc34a120e",
"m_Id": 4,
"m_DisplayName": "R",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "R",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot",
"m_ObjectId": "7639b4a17a334399a9f421cd50b7cfdb",
"m_Id": 2,
"m_DisplayName": "UV",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "UV",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [],
"m_Channel": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "78db00f49dfe4fa2b4369e32ebf28ec5",
"m_Id": 0,
"m_DisplayName": "RGBA",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "RGBA",
"m_StageCapability": 2,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode",
"m_ObjectId": "7952abbfa5764abbae262f142a3a064b",
"m_Group": {
"m_Id": ""
},
"m_Name": "Sample Texture 2D",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -274.0000305175781,
"y": 160.99998474121095,
"width": 183.00001525878907,
"height": 250.99998474121095
}
},
"m_Slots": [
{
"m_Id": "78db00f49dfe4fa2b4369e32ebf28ec5"
},
{
"m_Id": "68a8b951fcb8489891abfbfcc34a120e"
},
{
"m_Id": "a35c97e796354191a56cab4ebc1b0c97"
},
{
"m_Id": "9015c4f761784b57a17877f114771c6d"
},
{
"m_Id": "efc06576e366411a9dbb3c5e5c3e6dc1"
},
{
"m_Id": "d54d1ad0bcdf4b60a51da4f977c899e2"
},
{
"m_Id": "7639b4a17a334399a9f421cd50b7cfdb"
},
{
"m_Id": "e9a96a370b654f49bdaede33b9c5364c"
}
],
"synonyms": [
"tex2d"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_TextureType": 0,
"m_NormalMapSpace": 0,
"m_EnableGlobalMipBias": true,
"m_MipSamplingMode": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInUIEffectSubTarget",
"m_ObjectId": "80f8f8e7c44e42c8b6eca7510eeee828"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "867db961355a4c1ea898b69d9e6549b0",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -418.0,
"y": 183.0,
"width": 132.0,
"height": 33.99998474121094
}
},
"m_Slots": [
{
"m_Id": "5b370c6775e1485c8289267723a78b11"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "0edd83ed2c624ec1806581cf049b4102"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "8c8215c5d9714514b592e36aad9c148a",
"m_Name": "",
"m_ChildObjectList": [
{
"m_Id": "0edd83ed2c624ec1806581cf049b4102"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "9015c4f761784b57a17877f114771c6d",
"m_Id": 6,
"m_DisplayName": "B",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "92eee3a578d042e1b3d5449bc1deba68",
"m_Id": 0,
"m_DisplayName": "Alpha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 2,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "a35c97e796354191a56cab4ebc1b0c97",
"m_Id": 5,
"m_DisplayName": "G",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "G",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "bba29a5fc85343b2964b3e4b5a62d0bf",
"m_Id": 0,
"m_DisplayName": "Base Color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "BaseColor",
"m_StageCapability": 2,
"m_Value": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"m_DefaultValue": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"m_Labels": [],
"m_ColorMode": 0,
"m_DefaultColor": {
"r": 0.5,
"g": 0.5,
"b": 0.5,
"a": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "c2a8615bb6ed48bfa85d0d3671740b5e",
"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": "f9b4659b58e548b795c4f84d6c2d0e37"
}
],
"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.Rendering.Universal.ShaderGraph.UniversalUIEffectSubTarget",
"m_ObjectId": "ccc35450f1194a7794f124787f7223de"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "d326ef5f90af4c7996e7e0c915e57983",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Alpha",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 12.99997329711914,
"y": 270.0,
"width": 200.00001525878907,
"height": 41.0
}
},
"m_Slots": [
{
"m_Id": "92eee3a578d042e1b3d5449bc1deba68"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
"m_ObjectId": "d54d1ad0bcdf4b60a51da4f977c899e2",
"m_Id": 1,
"m_DisplayName": "Texture",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Texture",
"m_StageCapability": 3,
"m_BareResource": false,
"m_Texture": {
"m_SerializedTexture": "",
"m_Guid": ""
},
"m_DefaultType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Canvas.ShaderGraph.CanvasData",
"m_ObjectId": "e8d949ab75d949a48b225e87bac14000",
"m_Version": 0,
"m_AlphaClip": true,
"m_DisableTint": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot",
"m_ObjectId": "e9a96a370b654f49bdaede33b9c5364c",
"m_Id": 3,
"m_DisplayName": "Sampler",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Sampler",
"m_StageCapability": 3,
"m_BareResource": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "efc06576e366411a9dbb3c5e5c3e6dc1",
"m_Id": 7,
"m_DisplayName": "A",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Canvas.ShaderGraph.CanvasData",
"m_ObjectId": "f39f3f444a8a4c7593cfa9d3958d6adb",
"m_Version": 0,
"m_AlphaClip": false,
"m_DisableTint": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "f3b826553df24fdb9d14e4f1ef5504c8",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.BaseColor",
"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": "bba29a5fc85343b2964b3e4b5a62d0bf"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "f9b4659b58e548b795c4f84d6c2d0e37",
"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
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c4b99d7494b704b7c885015e0153163b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData: v5.7.0
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -0,0 +1,3 @@
{
"reference": "GUID:c579267770062bf448e75eb160330b7f"
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2b7a7eb5bb5ed49dcaf7965481fa019d
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,34 @@
using System;
using UnityEditor.Rendering.BuiltIn.ShaderGraph;
using UnityEditor.ShaderGraph;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
internal class UniversalUIEffectSubTarget : UniversalCanvasSubTarget
{
[MenuItem("Assets/Create/Shader Graph/URP/Canvas Shader Graph (UIEffect)", priority = 1000)]
private static void CreateUnlitGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(BuiltInUIEffectSubTarget));
target.TrySetActiveSubTarget(typeof(UniversalUIEffectSubTarget));
target.CreateGraphAsset();
}
public UniversalUIEffectSubTarget() { displayName = "Canvas (UIEffect)"; }
protected override IncludeCollection postgraphIncludes => base.postgraphIncludes
.Add(BuiltInUIEffectSubTarget.s_UIEffectHlsl, IncludeLocation.Postgraph);
public override PassDescriptor GenerateUIPassDescriptor(bool isSRP)
{
return BuiltInUIEffectSubTarget.ModifyUIPassDescriptor(base.GenerateUIPassDescriptor(isSRP));
}
public override void CollectShaderProperties(PropertyCollector collector, GenerationMode generationMode)
{
base.CollectShaderProperties(collector, generationMode);
BuiltInUIEffectSubTarget.ModifyShaderProperties(collector);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e428a82723f244e77b64d08fd256159d
+58 -24
View File
@@ -1,9 +1,16 @@
#ifndef UI_EFFECT_INCLUDED
#define UI_EFFECT_INCLUDED
#ifndef UNITY_PI
#define UNITY_PI 3.14159265358979323846
#endif
#ifndef CANVAS_SHADERGRAPH
uniform const int _SrcBlend;
uniform const int _DstBlend;
uniform const float4 _MainTex_TexelSize;
#endif
uniform const float _ToneIntensity;
uniform const half4 _ColorValue;
uniform const float _ColorIntensity;
@@ -23,7 +30,7 @@ uniform const float2 _TransitionRange;
uniform const float _TransitionWidth;
uniform const int _TransitionPatternReverse;
uniform const float _TransitionAutoPlaySpeed;
uniform const fixed4 _TargetColor;
uniform const half4 _TargetColor;
uniform const float _TargetRange;
uniform const float _TargetSoftness;
uniform const float _ShadowBlurIntensity;
@@ -67,20 +74,31 @@ uniform const matrix _CanvasToWorldMatrix;
#define SAMPLING_NONE (!SAMPLING_BLUR_FAST && !SAMPLING_BLUR_MEDIUM && !SAMPLING_BLUR_DETAIL && !SAMPLING_PIXELATION && !SAMPLING_RGB_SHIFT && !SAMPLING_EDGE_LUMINANCE && !SAMPLING_EDGE_ALPHA)
#define TRANSITION_NONE (!TRANSITION_FADE && !TRANSITION_CUTOFF && !TRANSITION_DISSOLVE && !TRANSITION_SHINY && !TRANSITION_MASK && !TRANSITION_MELT && !TRANSITION_BURN && !TRANSITION_PATTERN)
#define TARGET_NONE (!TARGET_HUE && !TARGET_LUMINANCE)
#define EDGE_NONE (!EDGE_PLAIN && !EDGE_SHINY)
#define DETAIL_NONE (!DETAIL_MASKING && !DETAIL_MULTIPLY && !DETAIL_ADDITIVE && !DETAIL_REPLACE && !DETAIL_MULTIPLY_ADDITIVE)
#define GRADATION_NONE (!GRADATION_GRADIENT && !GRADATION_RADIAL && !GRADATION_COLOR2 && !GRADATION_COLOR4)
#if TONE_NONE && SAMPLING_NONE && TRANSITION_NONE && TARGET_NONE && EDGE_NONE && DETAIL_NONE && GRADATION_NONE
#define NO_UIEFFECT
#endif
#define UIEFFECT_UV_MASK(uv, uvMask) step(uvMask.x, uv.x) * step(uv.x, uvMask.z) * step(uvMask.y, uv.y) * step(uv.y, uvMask.w)
#define UIEFFECT_SAMPLE(uv) uieffect_frag(uv)
#define UIEFFECT_SAMPLE_CLAMP(uv, uvMask) uieffect_frag(uv) \
* step(uvMask.x, uv.x) * step(uv.x, uvMask.z) \
* step(uvMask.y, uv.y) * step(uv.y, uvMask.w)
#define TEX_SAMPLE_CLAMP(uv, uvMask) tex2D(_MainTex, uv) \
* step(uvMask.x, uv.x) * step(uv.x, uvMask.z) \
* step(uvMask.y, uv.y) * step(uv.y, uvMask.w)
#define UIEFFECT_SAMPLE_CLAMP(uv, uvMask) uieffect_frag(uv) * UIEFFECT_UV_MASK(uv, uvMask)
#ifdef CANVAS_SHADERGRAPH
#define TEX_SAMPLE_CLAMP(uv, uvMask) SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv) * UIEFFECT_UV_MASK(uv, uvMask)
#else
#define TEX_SAMPLE_CLAMP(uv, uvMask) tex2D(_MainTex, uv) * UIEFFECT_UV_MASK(uv, uvMask)
#endif
float4 object_to_world(float4 pos)
{
#if UIEFFECT_EDITOR
return pos;
return mul(unity_ObjectToWorld, pos);
#else
return mul(_CanvasToWorldMatrix, pos);
return mul(_CanvasToWorldMatrix, mul(unity_ObjectToWorld, pos));
#endif
}
@@ -152,7 +170,7 @@ half get_target_rate(const half3 color)
#if TARGET_HUE // Target.Hue
{
const half value = rgb_to_hsv(color).x;
const half target = rgb_to_hsv(_TargetColor).x;
const half target = rgb_to_hsv(_TargetColor.rgb).x;
diff = abs(target - value);
diff = min(diff, 1 - diff);
}
@@ -176,14 +194,14 @@ half4 apply_tone_filter(half4 color)
#elif TONE_NEGATIVE // Tone.Negative
color.rgb = lerp(color.rgb, (1 - color.rgb) * color.a, _ToneIntensity);
#elif TONE_RETRO // Tone.Retro
const fixed l = Luminance(color.rgb);
const fixed r0 = step(l, 0.25);
const fixed r1 = step(l, 0.5);
const fixed r2 = step(l, 0.75);
const fixed3 retro = fixed3(0.06, 0.22, 0.06) * r0 // 0.0-0.25: (15, 56, 15)
+ fixed3(0.19, 0.38, 0.19) * (1 - r0) * r1 // 0.25-0.5: (48, 98, 48)
+ fixed3(0.54, 0.67, 0.06) * (1 - r1) * r2 // 0.5-0.75: (139, 172, 15)
+ fixed3(0.60, 0.74, 0.06) * (1 - r2); // 0.75-1.0: (155, 188, 15)
const half l = Luminance(color.rgb);
const half r0 = step(l, 0.25);
const half r1 = step(l, 0.5);
const half r2 = step(l, 0.75);
const half3 retro = half3(0.06, 0.22, 0.06) * r0 // 0.0-0.25: (15, 56, 15)
+ half3(0.19, 0.38, 0.19) * (1 - r0) * r1 // 0.25-0.5: (48, 98, 48)
+ half3(0.54, 0.67, 0.06) * (1 - r1) * r2 // 0.5-0.75: (139, 172, 15)
+ half3(0.60, 0.74, 0.06) * (1 - r2); // 0.75-1.0: (155, 188, 15)
color.rgb = lerp(color.rgb, retro * color.a, _ToneIntensity);
#elif TONE_POSTERIZE // Tone.Posterize
const half3 hsv = rgb_to_hsv(color.rgb);
@@ -487,8 +505,8 @@ half4 apply_transition_filter(half4 color, const float alpha, const float2 uvLoc
{
const float factor = alpha - transition_rate() * (1 + _TransitionWidth) + _TransitionWidth;
const float softness = max(0.0001, _TransitionWidth * _TransitionSoftness);
const fixed bandLerp = saturate((_TransitionWidth - factor) * 1 / softness);
const fixed softLerp = saturate(factor * 2 / softness);
const half bandLerp = saturate((_TransitionWidth - factor) * 1 / softness);
const half softLerp = saturate(factor * 2 / softness);
half4 bandColor = apply_transition_color_filter(half4(color.rgb, 1), half4(_TransitionColor.rgb, 1),
_TransitionColor.a);
bandColor *= color.a;
@@ -677,13 +695,22 @@ half4 uieffect_internal(float2 uv, float4 uvMask, const float2 uvLocal, const fl
}
}
half4 uieffect(float2 uv, float4 uvMask, const float4 pos)
half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos)
{
const fixed4 origin = UIEFFECT_SAMPLE_CLAMP(uv, uvMask);
const half rate = get_target_rate(origin);
const float4 wpos = object_to_world(pos);
const float2 uvLocal = saturate(mul(_RootViewMatrix, wpos));
const float2 uvGrad = mul(_GradViewMatrix, wpos);
#ifdef NO_UIEFFECT
return origin;
#endif
#ifndef CANVAS_SHADERGRAPH
wpos = mul(unity_ObjectToWorld, wpos);
#endif
#if !UIEFFECT_EDITOR
wpos = mul(_CanvasToWorldMatrix, wpos);
#endif
const half rate = get_target_rate(origin.rgb);
const float2 uvLocal = saturate(mul(_RootViewMatrix, wpos)).xy;
const float2 uvGrad = mul(_GradViewMatrix, wpos).xy;
const int isShadow = uvMask.x < 0 ? 1 : 0;
uvMask.x += isShadow * 2;
@@ -730,4 +757,11 @@ half4 uieffect(float2 uv, float4 uvMask, const float4 pos)
return lerp(origin, uieffect_internal(uv, uvMask, uvLocal, uvGrad, isShadow), rate);
}
half4 uieffect(float2 uv, float4 uvMask, float4 wpos)
{
const half4 origin = UIEFFECT_SAMPLE_CLAMP(uv, uvMask);
return uieffect(origin, uv, uvMask, wpos);
}
#endif // UI_EFFECT_INCLUDED
+10
View File
@@ -41,6 +41,16 @@
"displayName": "TextMeshPro Support (Unity 6)",
"description": "TextMeshPro Support (Unity 6)",
"path": "Samples~/TextMeshPro Support (Unity 6)~"
},
{
"displayName": "ShaderGraph Support (Unity 6 BuiltIn)",
"description": "ShaderGraph Support (Unity 6 BuiltIn)",
"path": "Samples~/ShaderGraph Support (Unity 6 BuiltIn)~"
},
{
"displayName": "ShaderGraph Support (Unity 6 URP)",
"description": "ShaderGraph Support (Unity 6 URP)",
"path": "Samples~/ShaderGraph Support (Unity 6 URP)~"
}
]
}