diff options
Diffstat (limited to 'Assets/Resources')
-rw-r--r-- | Assets/Resources/Default-Transition.png | bin | 0 -> 13342 bytes | |||
-rw-r--r-- | Assets/Resources/Default-Transition.png.meta | 100 | ||||
-rw-r--r-- | Assets/Resources/UIDissolve.shader | 87 | ||||
-rw-r--r-- | Assets/Resources/UIDissolve.shader.meta | 12 | ||||
-rw-r--r-- | Assets/Resources/UIEffect.cginc | 309 | ||||
-rw-r--r-- | Assets/Resources/UIEffect.cginc.meta | 9 | ||||
-rw-r--r-- | Assets/Resources/UIEffect.shader | 113 | ||||
-rw-r--r-- | Assets/Resources/UIEffect.shader.meta | 9 | ||||
-rw-r--r-- | Assets/Resources/UIEffectSprite.cginc | 75 | ||||
-rw-r--r-- | Assets/Resources/UIEffectSprite.cginc.meta | 9 | ||||
-rw-r--r-- | Assets/Resources/UIHsvModifier.shader | 79 | ||||
-rw-r--r-- | Assets/Resources/UIHsvModifier.shader.meta | 9 | ||||
-rw-r--r-- | Assets/Resources/UIShiny.shader | 82 | ||||
-rw-r--r-- | Assets/Resources/UIShiny.shader.meta | 9 | ||||
-rw-r--r-- | Assets/Resources/UITtransition.shader | 87 | ||||
-rw-r--r-- | Assets/Resources/UITtransition.shader.meta | 12 |
16 files changed, 1001 insertions, 0 deletions
diff --git a/Assets/Resources/Default-Transition.png b/Assets/Resources/Default-Transition.png Binary files differnew file mode 100644 index 0000000..8eb1099 --- /dev/null +++ b/Assets/Resources/Default-Transition.png diff --git a/Assets/Resources/Default-Transition.png.meta b/Assets/Resources/Default-Transition.png.meta new file mode 100644 index 0000000..9a60ed2 --- /dev/null +++ b/Assets/Resources/Default-Transition.png.meta @@ -0,0 +1,100 @@ +fileFormatVersion: 2 +guid: 3e04c247fb2604af186173fce0bc62de +timeCreated: 1524468976 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 2 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 10 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 256 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: iPhone + maxTextureSize: 256 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 256 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: WebGL + maxTextureSize: 256 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UIDissolve.shader b/Assets/Resources/UIDissolve.shader new file mode 100644 index 0000000..1f48a1d --- /dev/null +++ b/Assets/Resources/UIDissolve.shader @@ -0,0 +1,87 @@ +Shader "Hidden/UI/Default (UIDissolve)" +{ + Properties + { + [PerRendererData] _MainTex ("Main Texture", 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 + + [Header(Dissolve)] + _TransitionTex ("Transition Texture (A)", 2D) = "white" {} + _ParamTex ("Parameter Texture", 2D) = "white" {} + } + + 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 + { + Name "Default" + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #define DISSOLVE 1 + #pragma multi_compile __ UNITY_UI_ALPHACLIP + #pragma multi_compile __ ADD SUBTRACT FILL + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #define UI_DISSOLVE 1 + #include "UIEffect.cginc" + #include "UIEffectSprite.cginc" + + fixed4 frag(v2f IN) : SV_Target + { + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + + // Dissolve + color = ApplyTransitionEffect(color, IN.eParam); + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + return color; + } + ENDCG + } + } +} diff --git a/Assets/Resources/UIDissolve.shader.meta b/Assets/Resources/UIDissolve.shader.meta new file mode 100644 index 0000000..280b7ff --- /dev/null +++ b/Assets/Resources/UIDissolve.shader.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e1b48dc831eb147e9886c049033213bf +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _TransitionTex: {instanceID: 0} + - _ParamTex: {instanceID: 0} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UIEffect.cginc b/Assets/Resources/UIEffect.cginc new file mode 100644 index 0000000..eeb2dcf --- /dev/null +++ b/Assets/Resources/UIEffect.cginc @@ -0,0 +1,309 @@ +#ifndef UI_EFFECT_INCLUDED +#define UI_EFFECT_INCLUDED + + +sampler2D _TransitionTex; +sampler2D _ParamTex; + +#if GRAYSCALE | SEPIA | NEGA | PIXEL | MONO | CUTOFF | HUE +#define UI_TONE +#endif + +#if ADD | SUBTRACT | FILL +#define UI_COLOR +#endif + +#if FASTBLUR | MEDIUMBLUR | DETAILBLUR +#define UI_BLUR +#endif + +// Unpack float to low-precision [0-1] fixed4. +fixed4 UnpackToVec4(float value) +{ + const int PACKER_STEP = 64; + const int PRECISION = PACKER_STEP - 1; + fixed4 unpacked; + + unpacked.x = (value % PACKER_STEP) / PRECISION; + value = floor(value / PACKER_STEP); + + unpacked.y = (value % PACKER_STEP) / PRECISION; + value = floor(value / PACKER_STEP); + + unpacked.z = (value % PACKER_STEP) / PRECISION; + value = floor(value / PACKER_STEP); + + unpacked.w = (value % PACKER_STEP) / PRECISION; + return unpacked; +} + +// Unpack float to low-precision [0-1] fixed3. +fixed3 UnpackToVec3(float value) +{ + const int PACKER_STEP = 256; + const int PRECISION = PACKER_STEP - 1; + fixed3 unpacked; + + unpacked.x = (value % (PACKER_STEP)) / (PACKER_STEP - 1); + value = floor(value / (PACKER_STEP)); + + unpacked.y = (value % PACKER_STEP) / (PACKER_STEP - 1); + value = floor(value / PACKER_STEP); + + unpacked.z = (value % PACKER_STEP) / (PACKER_STEP - 1); + return unpacked; +} + +// Unpack float to low-precision [0-1] half2. +half2 UnpackToVec2(float value) +{ + const int PACKER_STEP = 4096; + const int PRECISION = PACKER_STEP - 1; + half2 unpacked; + + unpacked.x = (value % (PACKER_STEP)) / (PACKER_STEP - 1); + value = floor(value / (PACKER_STEP)); + + unpacked.y = (value % PACKER_STEP) / (PACKER_STEP - 1); + return unpacked; +} + +// Sample texture with blurring. +// * Fast: Sample texture with 3x3 kernel. +// * Medium: Sample texture with 5x5 kernel. +// * Detail: Sample texture with 7x7 kernel. +fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur, half4 mask) +{ + #if FASTBLUR && EX + const int KERNEL_SIZE = 5; + const float KERNEL_[5] = { 0.2486, 0.7046, 1.0, 0.7046, 0.2486}; + #elif MEDIUMBLUR && EX + const int KERNEL_SIZE = 9; + const float KERNEL_[9] = { 0.0438, 0.1719, 0.4566, 0.8204, 1.0, 0.8204, 0.4566, 0.1719, 0.0438}; + #elif DETAILBLUR && EX + const int KERNEL_SIZE = 13; + const float KERNEL_[13] = { 0.0438, 0.1138, 0.2486, 0.4566, 0.7046, 0.9141, 1.0, 0.9141, 0.7046, 0.4566, 0.2486, 0.1138, 0.0438}; + #elif FASTBLUR + const int KERNEL_SIZE = 3; + const float KERNEL_[3] = { 0.4566, 1.0, 0.4566}; + #elif MEDIUMBLUR + const int KERNEL_SIZE = 5; + const float KERNEL_[5] = { 0.2486, 0.7046, 1.0, 0.7046, 0.2486}; + #elif DETAILBLUR + const int KERNEL_SIZE = 7; + const float KERNEL_[7] = { 0.1719, 0.4566, 0.8204, 1.0, 0.8204, 0.4566, 0.1719}; + #else + const int KERNEL_SIZE = 1; + const float KERNEL_[1] = { 1.0 }; + #endif + float4 o = 0; + float sum = 0; + float2 shift = 0; + for(int x = 0; x < KERNEL_SIZE; x++) + { + shift.x = blur.x * (float(x) - KERNEL_SIZE/2); + for(int y = 0; y < KERNEL_SIZE; y++) + { + shift.y = blur.y * (float(y) - KERNEL_SIZE/2); + float2 uv = texcood + shift; + float weight = KERNEL_[x] * KERNEL_[y]; + sum += weight; + #if EX + fixed masked = min(mask.x <= uv.x, uv.x <= mask.z) * min(mask.y <= uv.y, uv.y <= mask.w); + o += lerp(fixed4(0.5, 0.5, 0.5, 0), tex2D(tex, uv), masked) * weight; + #else + o += tex2D(tex, uv) * weight; + #endif + } + } + return o / sum; +} + +// Sample texture with blurring. +// * Fast: Sample texture with 3x3 kernel. +// * Medium: Sample texture with 5x5 kernel. +// * Detail: Sample texture with 7x7 kernel. +fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur) +{ + return Tex2DBlurring(tex, texcood, blur, half4(0,0,1,1)); +} + + +// Sample texture with blurring. +// * Fast: Sample texture with 3x1 kernel. +// * Medium: Sample texture with 5x1 kernel. +// * Detail: Sample texture with 7x1 kernel. +fixed4 Tex2DBlurring1D (sampler2D tex, half2 uv, half2 blur) +{ + #if FASTBLUR + const int KERNEL_SIZE = 3; + #elif MEDIUMBLUR + const int KERNEL_SIZE = 5; + #elif DETAILBLUR + const int KERNEL_SIZE = 7; + #else + const int KERNEL_SIZE = 1; + #endif + float4 o = 0; + float sum = 0; + float weight; + half2 texcood; + for(int i = -KERNEL_SIZE/2; i <= KERNEL_SIZE/2; i++) + { + texcood = uv; + texcood.x += blur.x * i; + texcood.y += blur.y * i; + weight = 1.0/(abs(i)+2); + o += tex2D(tex, texcood)*weight; + sum += weight; + } + return o / sum; +} + +fixed3 shift_hue(fixed3 RGB, half VSU, half VSW) +{ + fixed3 result; + result.x = (0.299 + 0.701*VSU + 0.168*VSW)*RGB.x + + (0.587 - 0.587*VSU + 0.330*VSW)*RGB.y + + (0.114 - 0.114*VSU - 0.497*VSW)*RGB.z; + + result.y = (0.299 - 0.299*VSU - 0.328*VSW)*RGB.x + + (0.587 + 0.413*VSU + 0.035*VSW)*RGB.y + + (0.114 - 0.114*VSU + 0.292*VSW)*RGB.z; + + result.z = (0.299 - 0.3*VSU + 1.25*VSW)*RGB.x + + (0.587 - 0.588*VSU - 1.05*VSW)*RGB.y + + (0.114 + 0.886*VSU - 0.203*VSW)*RGB.z; + + return result; +} + +// Apply tone effect. +fixed4 ApplyToneEffect(fixed4 color, fixed factor) +{ + #ifdef GRAYSCALE + color.rgb = lerp(color.rgb, Luminance(color.rgb), factor); + + #elif SEPIA + color.rgb = lerp(color.rgb, Luminance(color.rgb) * half3(1.07, 0.74, 0.43), factor); + + #elif NEGA + color.rgb = lerp(color.rgb, 1 - color.rgb, factor); + #endif + + return color; +} + +// Apply color effect. +fixed4 ApplyColorEffect(half4 color, half4 factor) +{ + #if FILL + color.rgb = lerp(color.rgb, factor.rgb, factor.a); + + #elif ADD + color.rgb += factor.rgb * factor.a; + + #elif SUBTRACT + color.rgb -= factor.rgb * factor.a; + + #else + color.rgb = lerp(color.rgb, color.rgb * factor.rgb, factor.a); + #endif + + #if CUTOFF + color.a = factor.a; + #endif + + return color; +} + +// Apply transition effect. +fixed4 ApplyTransitionEffect(half4 color, half3 transParam) +{ + fixed4 param = tex2D(_ParamTex, float2(0.25, transParam.z)); + float alpha = tex2D(_TransitionTex, transParam.xy).a; + + #if REVERSE + fixed effectFactor = 1 - param.x; + #else + fixed effectFactor = param.x; + #endif + + #if FADE + color.a *= saturate(alpha + (1 - effectFactor * 2)); + #elif CUTOFF + color.a *= step(0.001, color.a * alpha - effectFactor); + #elif DISSOLVE + fixed width = param.y/4; + fixed softness = param.z; + fixed3 dissolveColor = tex2D(_ParamTex, float2(0.75, transParam.z)).rgb; + float factor = alpha - effectFactor * ( 1 + width ) + width; + fixed edgeLerp = step(factor, color.a) * saturate((width - factor)*16/ softness); + color = ApplyColorEffect(color, fixed4(dissolveColor, edgeLerp)); + color.a *= saturate((factor)*32/ softness); + #endif + + return color; +} + + +// Apply shiny effect. +half4 ApplyShinyEffect(half4 color, half2 shinyParam) +{ + fixed nomalizedPos = shinyParam.x; + fixed4 param1 = tex2D(_ParamTex, float2(0.25, shinyParam.y)); + fixed4 param2 = tex2D(_ParamTex, float2(0.75, shinyParam.y)); + half location = param1.x * 2 - 0.5; + fixed width = param1.y; + fixed soft = param1.z; + fixed brightness = param1.w; + fixed gloss = param2.x; + half normalized = 1 - saturate(abs((nomalizedPos - location) / width)); + half shinePower = smoothstep(0, soft, normalized); + half3 reflectColor = lerp(fixed3(1,1,1), color.rgb * 7, gloss); + + color.rgb += color.a * (shinePower / 2) * brightness * reflectColor; + + + return color; +} + +half3 RgbToHsv(half3 c) { + half4 K = half4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + half4 p = lerp(half4(c.bg, K.wz), half4(c.gb, K.xy), step(c.b, c.g)); + half4 q = lerp(half4(p.xyw, c.r), half4(c.r, p.yzx), step(p.x, c.r)); + + half d = q.x - min(q.w, q.y); + half e = 1.0e-10; + return half3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +half3 HsvToRgb(half3 c) { + c = half3(c.x, clamp(c.yz, 0.0, 1.0)); + half4 K = half4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + half3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * lerp(K.xxx, clamp(p.xyz - K.xxx, 0.0, 1.0), c.y); +} + + +// Apply Hsv effect. +half4 ApplyHsvEffect(half4 color, half param) +{ + fixed4 param1 = tex2D(_ParamTex, float2(0.25, param)); + fixed4 param2 = tex2D(_ParamTex, float2(0.75, param)); + fixed3 targetHsv = param1.rgb; + + fixed3 targetRange = param1.w; + fixed3 hsvShift = param2.xyz - 0.5; + half3 hsv = RgbToHsv(color.rgb); + half3 range = abs(hsv - targetHsv); + half diff = max(max(min(1-range.x, range.x), min(1-range.y, range.y)/10), min(1-range.z, range.z)/10); + + fixed masked = step(diff, targetRange); + color.rgb = HsvToRgb(hsv + hsvShift * masked); + + return color; +} + + +#endif // UI_EFFECT_INCLUDED diff --git a/Assets/Resources/UIEffect.cginc.meta b/Assets/Resources/UIEffect.cginc.meta new file mode 100644 index 0000000..9fd2f81 --- /dev/null +++ b/Assets/Resources/UIEffect.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7467061e9f5514f2c80e30817ee2458b +timeCreated: 1487915863 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UIEffect.shader b/Assets/Resources/UIEffect.shader new file mode 100644 index 0000000..3397a0f --- /dev/null +++ b/Assets/Resources/UIEffect.shader @@ -0,0 +1,113 @@ +Shader "Hidden/UI/Default (UIEffect)" +{ + Properties + { + [PerRendererData] _MainTex ("Main Texture", 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 + + _ParamTex ("Parameter Texture", 2D) = "white" {} + } + + 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 + { + Name "Default" + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #if !defined(SHADER_API_D3D11_9X) && !defined(SHADER_API_D3D9) + #pragma target 2.0 + #else + #pragma target 3.0 + #endif + + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #pragma multi_compile __ GRAYSCALE SEPIA NEGA PIXEL + #pragma multi_compile __ ADD SUBTRACT FILL + #pragma multi_compile __ FASTBLUR MEDIUMBLUR DETAILBLUR + #pragma multi_compile __ EX + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #define UI_EFFECT 1 + #include "UIEffect.cginc" + #include "UIEffectSprite.cginc" + + fixed4 frag(v2f IN) : SV_Target + { + fixed4 param = tex2D(_ParamTex, float2(0.25, IN.eParam)); + fixed effectFactor = param.x; + fixed colorFactor = param.y; + fixed blurFactor = param.z; + + #if PIXEL + half2 pixelSize = max(2, (1-effectFactor*0.95) * _MainTex_TexelSize.zw); + IN.texcoord = round(IN.texcoord * pixelSize) / pixelSize; + #endif + + #if defined(UI_BLUR) && EX + half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, blurFactor * _MainTex_TexelSize.xy * 2, IN.uvMask) + _TextureSampleAdd); + #elif defined(UI_BLUR) + half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, blurFactor * _MainTex_TexelSize.xy * 2) + _TextureSampleAdd); + #else + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd); + #endif + + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + + #if UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + #if defined (UI_TONE) + color = ApplyToneEffect(color, effectFactor); + #endif + + color = ApplyColorEffect(color, fixed4(IN.color.rgb, colorFactor)); + color.a *= IN.color.a; + + return color; + } + ENDCG + } + } +} diff --git a/Assets/Resources/UIEffect.shader.meta b/Assets/Resources/UIEffect.shader.meta new file mode 100644 index 0000000..b06e4d5 --- /dev/null +++ b/Assets/Resources/UIEffect.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b868e81d0156245e08c8646b4fb68d7a +timeCreated: 1482973535 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UIEffectSprite.cginc b/Assets/Resources/UIEffectSprite.cginc new file mode 100644 index 0000000..77a69e3 --- /dev/null +++ b/Assets/Resources/UIEffectSprite.cginc @@ -0,0 +1,75 @@ +#ifndef UI_EFFECT_SPRITE_INCLUDED +#define UI_EFFECT_SPRITE_INCLUDED + +fixed4 _Color; +fixed4 _TextureSampleAdd; +float4 _ClipRect; +sampler2D _MainTex; +float4 _MainTex_TexelSize; + +struct appdata_t +{ + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; +#if EX + float2 uvMask : TEXCOORD1; +#endif + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + half2 texcoord : TEXCOORD0; + float4 worldPosition : TEXCOORD1; +#if UI_DISSOLVE || UI_TRANSITION + half3 eParam : TEXCOORD2; +#elif UI_SHINY + half2 eParam : TEXCOORD2; +#else + half eParam : TEXCOORD2; +#endif +#if EX + half4 uvMask : TEXCOORD3; +#endif + UNITY_VERTEX_OUTPUT_STEREO +}; + +v2f vert(appdata_t IN) +{ + v2f OUT; + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); + OUT.worldPosition = IN.vertex; + OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); + + #if UI_EFFECT + OUT.texcoord = UnpackToVec2(IN.texcoord.x) * 2 - 0.5; + #else + OUT.texcoord = UnpackToVec2(IN.texcoord.x); + #endif + + #ifdef UNITY_HALF_TEXEL_OFFSET + OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1); + #endif + + OUT.color = IN.color * _Color; + + #if UI_DISSOLVE || UI_TRANSITION + OUT.eParam = UnpackToVec3(IN.texcoord.y); + #elif UI_SHINY + OUT.eParam = UnpackToVec2(IN.texcoord.y); + #else + OUT.eParam = IN.texcoord.y; + #endif + + #if EX + OUT.uvMask = half4(UnpackToVec2(IN.uvMask.x), UnpackToVec2(IN.uvMask.y)); + #endif + + return OUT; +} + +#endif // UI_EFFECT_SPRITE_INCLUDED diff --git a/Assets/Resources/UIEffectSprite.cginc.meta b/Assets/Resources/UIEffectSprite.cginc.meta new file mode 100644 index 0000000..d38f494 --- /dev/null +++ b/Assets/Resources/UIEffectSprite.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: dd60a36b172cf49e2b82258a68799ce3 +timeCreated: 1487915863 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UIHsvModifier.shader b/Assets/Resources/UIHsvModifier.shader new file mode 100644 index 0000000..445182b --- /dev/null +++ b/Assets/Resources/UIHsvModifier.shader @@ -0,0 +1,79 @@ +Shader "Hidden/UI/Default (UIHsvModifier)" +{ + Properties + { + [PerRendererData] _MainTex ("Main Texture", 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 + + _ParamTex ("Parameter Texture", 2D) = "white" {} + } + + 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 + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #define UI_HSV_MODIFIER 1 + #include "UIEffect.cginc" + #include "UIEffectSprite.cginc" + + fixed4 frag(v2f IN) : COLOR + { + half4 color = tex2D(_MainTex, IN.texcoord);// + _TextureSampleAdd) * IN.color; + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + color = ApplyHsvEffect(color, IN.eParam); + + return (color + _TextureSampleAdd) * IN.color; + } + + ENDCG + } + } +} diff --git a/Assets/Resources/UIHsvModifier.shader.meta b/Assets/Resources/UIHsvModifier.shader.meta new file mode 100644 index 0000000..a9797e6 --- /dev/null +++ b/Assets/Resources/UIHsvModifier.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7fc74090480c84f8b977cfcd55cdfe82 +timeCreated: 1531882595 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UIShiny.shader b/Assets/Resources/UIShiny.shader new file mode 100644 index 0000000..5520e43 --- /dev/null +++ b/Assets/Resources/UIShiny.shader @@ -0,0 +1,82 @@ +Shader "Hidden/UI/Default (UIShiny)" +{ + Properties + { + [PerRendererData] _MainTex ("Main Texture", 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 + + _ParamTex ("Parameter Texture", 2D) = "white" {} + } + + 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 + { + Name "Default" + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #define UI_SHINY 1 + #include "UIEffect.cginc" + #include "UIEffectSprite.cginc" + + fixed4 frag(v2f IN) : SV_Target + { + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + + color = ApplyShinyEffect(color, IN.eParam); + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + return color; + } + ENDCG + } + } +} diff --git a/Assets/Resources/UIShiny.shader.meta b/Assets/Resources/UIShiny.shader.meta new file mode 100644 index 0000000..3607115 --- /dev/null +++ b/Assets/Resources/UIShiny.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 20ffe76c2439c403aabdd25bd94bf011 +timeCreated: 1523859834 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UITtransition.shader b/Assets/Resources/UITtransition.shader new file mode 100644 index 0000000..d7c168e --- /dev/null +++ b/Assets/Resources/UITtransition.shader @@ -0,0 +1,87 @@ +Shader "Hidden/UI/Default (UITransition)" +{ + Properties + { + [PerRendererData] _MainTex ("Main Texture", 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 + + [Header(Transition)] + _TransitionTex ("Transition Texture (A)", 2D) = "white" {} + _ParamTex ("Parameter Texture", 2D) = "white" {} + } + + 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 + { + Name "Default" + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #define REVERSE 1 + #define ADD 1 + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #pragma multi_compile __ FADE CUTOFF DISSOLVE + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #define UI_TRANSITION 1 + #include "UIEffect.cginc" + #include "UIEffectSprite.cginc" + + fixed4 frag(v2f IN) : SV_Target + { + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd); + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + + color = ApplyTransitionEffect(color, IN.eParam) * IN.color; + + #if UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + return color; + } + ENDCG + } + } +} diff --git a/Assets/Resources/UITtransition.shader.meta b/Assets/Resources/UITtransition.shader.meta new file mode 100644 index 0000000..3f6004c --- /dev/null +++ b/Assets/Resources/UITtransition.shader.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 85ad24dd0759947ddb117625e108d49c +timeCreated: 1548078121 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _NoiseTex: {fileID: 2800000, guid: 3e04c247fb2604af186173fce0bc62de, type: 3} + - _ParamTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |