This commit is contained in:
Caiyanpeng committed 2021-04-19 14:11:53 +08:00
1 parent f4cbad819b
commit 0346b650aa
64 files changed
+12634 -12935

No files matched your search

+102
View File
@@ -0,0 +1,102 @@
Shader "Custom/ImageMask"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Mask ("Base (RGB)", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#pragma multi_compile __ UNITY_UI_ALPHACLIP
struct a2v
{
fixed2 uv : TEXCOORD0;
half4 vertex : POSITION;
float4 color : COLOR;
};
fixed4 _Color;
struct v2f
{
fixed2 uv : TEXCOORD0;
half4 vertex : SV_POSITION;
float4 color : COLOR;
};
sampler2D _MainTex;
sampler2D _Mask;
v2f vert (a2v i)
{
v2f o;
o.vertex = UnityObjectToClipPos(i.vertex);
o.uv = i.uv;
o.color = i.color * _Color;
return o;
}
fixed4 frag (v2f i) : COLOR
{
half4 color = tex2D(_MainTex, i.uv) * i.color;
half4 mask = tex2D(_Mask, i.uv);
color.a *= mask.a;
return color;
}
ENDCG
}
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9753843e0b8f8e54aa5de7c99ba029d7
guid: 36c797600830d844eaec2cfe2b90bfb0
ShaderImporter:
externalObjects: {}
defaultTextures: []
@@ -7,8 +7,8 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UV
m_Shader: {fileID: 4800000, guid: 9753843e0b8f8e54aa5de7c99ba029d7, type: 3}
m_Name: New Material
m_Shader: {fileID: 4800000, guid: 36c797600830d844eaec2cfe2b90bfb0, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@@ -40,7 +40,11 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: b880d26a12584a04ab6b96e822b9e360, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Mask:
m_Texture: {fileID: 2800000, guid: 426bc972b7c244d40b428c79111a0d76, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
@@ -70,7 +74,6 @@ Material:
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _Speed: 5
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
@@ -78,6 +81,7 @@ Material:
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d94587ed2aef77641b5e19629ed6c9be
guid: dd6552bd9b1de2747aa636527513d0b8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
-86
View File
@@ -1,86 +0,0 @@
Shader "Hidden/UVSlider"
{
Properties
{
_MainTex ("Texture", 2D) = "white" { }
_Speed ("Speed", float) = 0.2
//MASK SUPPORT ADD
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
//MASK SUPPORT END
}
SubShader
{
Tags { "Queue" = "Transparent" }
//MASK SUPPORT ADD
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
ColorMask [_ColorMask]
//MASK SUPPORT END
// No culling or depth
Cull Back
ZWrite Off
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex: POSITION;
float2 uv: TEXCOORD0;
};
struct v2f
{
float2 uv: TEXCOORD0;
float4 vertex: SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Speed;
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);//v.uv;
return o;
}
fixed4 frag(v2f i): SV_Target
{
float2 uv = i.uv;
uv.x += -_Time.x * _Speed ;
fixed4 col = tex2D(_MainTex, uv);
return col;
}
ENDCG
}
}
}
+15 -3
View File
@@ -34,9 +34,9 @@ TextureImporter:
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
wrapU: 2
wrapV: 2
wrapW: 2
nPOTScale: 0
lightmap: 0
compressionQuality: 50
@@ -83,6 +83,18 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []