├── .github
├── FUNDING.yml
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── question.md
├── .releaserc
├── CHANGELOG.md
├── CHANGELOG.md.meta
├── LICENSE.md
├── LICENSE.md.meta
├── README.md
├── README.md.meta
├── Resources.meta
├── Resources
├── Default-Transition.png
├── Default-Transition.png.meta
├── UIDissolve.shader
├── UIDissolve.shader.meta
├── UIEffect.cginc
├── UIEffect.cginc.meta
├── UIEffect.shader
├── UIEffect.shader.meta
├── UIEffectSprite.cginc
├── UIEffectSprite.cginc.meta
├── UIHsvModifier.shader
├── UIHsvModifier.shader.meta
├── UIShiny.shader
├── UIShiny.shader.meta
├── UITtransition.shader
└── UITtransition.shader.meta
├── Samples~
├── Demo.meta
└── Demo
│ ├── UIEffect_Demo.asmdef
│ ├── UIEffect_Demo.asmdef.meta
│ ├── UIEffect_Demo.cs
│ ├── UIEffect_Demo.cs.meta
│ ├── UIEffect_Demo.unity
│ ├── UIEffect_Demo.unity.meta
│ ├── UIEffect_Demo_Atlas.png
│ ├── UIEffect_Demo_Atlas.png.meta
│ ├── UIEffect_Demo_ColorControl.cs
│ ├── UIEffect_Demo_ColorControl.cs.meta
│ ├── UIEffect_Demo_For Thumbnail.controller
│ ├── UIEffect_Demo_For Thumbnail.controller.meta
│ ├── UIEffect_Demo_Pattern.png
│ ├── UIEffect_Demo_Pattern.png.meta
│ ├── UIEffect_Demo_PropertyControl.cs
│ ├── UIEffect_Demo_PropertyControl.cs.meta
│ ├── UIEffect_Demo_Transition.controller
│ ├── UIEffect_Demo_Transition.controller.meta
│ ├── UITransitionTex.png
│ ├── UITransitionTex.png.meta
│ ├── UITransitionTex_Demo1.png
│ ├── UITransitionTex_Demo1.png.meta
│ ├── UITransitionTex_Demo2.png
│ ├── UITransitionTex_Demo2.png.meta
│ ├── UITransitionTex_Demo3.png
│ ├── UITransitionTex_Demo3.png.meta
│ ├── UITransitionTex_Demo4.png
│ ├── UITransitionTex_Demo4.png.meta
│ ├── UITransition_Art.png
│ └── UITransition_Art.png.meta
├── Scripts.meta
├── Scripts
├── Common.meta
├── Common
│ ├── BaseMaterialEffect.cs
│ ├── BaseMaterialEffect.cs.meta
│ ├── BaseMeshEffect.cs
│ ├── BaseMeshEffect.cs.meta
│ ├── EffectPlayer.cs
│ ├── EffectPlayer.cs.meta
│ ├── GraphicConnector.cs
│ ├── GraphicConnector.cs.meta
│ ├── MaterialCache.cs
│ ├── MaterialCache.cs.meta
│ ├── Matrix2x3.cs
│ ├── Matrix2x3.cs.meta
│ ├── Packer.cs
│ ├── Packer.cs.meta
│ ├── ParameterTexture.cs
│ └── ParameterTexture.cs.meta
├── Editor.meta
├── Editor
│ ├── ImportSampleMenu.cs
│ ├── ImportSampleMenu.cs.meta
│ ├── MaterialDirtyScope.cs
│ ├── MaterialDirtyScope.cs.meta
│ ├── UIDissolveEditor.cs
│ ├── UIDissolveEditor.cs.meta
│ ├── UIEffect-Editor.asmdef
│ ├── UIEffect-Editor.asmdef.meta
│ ├── UIEffectEditor.cs
│ ├── UIEffectEditor.cs.meta
│ ├── UIGradientEditor.cs
│ ├── UIGradientEditor.cs.meta
│ ├── UIHsvModifierEditor.cs
│ ├── UIHsvModifierEditor.cs.meta
│ ├── UIShadowEditor.cs
│ ├── UIShadowEditor.cs.meta
│ ├── UIShinyEditor.cs
│ ├── UIShinyEditor.cs.meta
│ ├── UITransitionEffectEditor.cs
│ └── UITransitionEffectEditor.cs.meta
├── Enums.meta
├── Enums
│ ├── BlurMode.cs
│ ├── BlurMode.cs.meta
│ ├── ColorMode.cs
│ ├── ColorMode.cs.meta
│ ├── EffectArea.cs
│ ├── EffectArea.cs.meta
│ ├── EffectMode.cs
│ ├── EffectMode.cs.meta
│ ├── ShadowStyle.cs
│ └── ShadowStyle.cs.meta
├── UIDissolve.cs
├── UIDissolve.cs.meta
├── UIEffect.asmdef
├── UIEffect.asmdef.meta
├── UIEffect.cs
├── UIEffect.cs.meta
├── UIFlip.cs
├── UIFlip.cs.meta
├── UIGradient.cs
├── UIGradient.cs.meta
├── UIHsvModifier.cs
├── UIHsvModifier.cs.meta
├── UIShadow.cs
├── UIShadow.cs.meta
├── UIShiny.cs
├── UIShiny.cs.meta
├── UISyncEffect.cs
├── UISyncEffect.cs.meta
├── UITransitionEffect.cs
└── UITransitionEffect.cs.meta
├── package.json
└── package.json.meta
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: mob-sakai # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: mob_sakai # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: mob-sakai
7 |
8 | ---
9 |
10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
11 |
12 | **Describe the bug**
13 | A clear and concise description of what the bug is.
14 |
15 | **To Reproduce**
16 | Steps to reproduce the behavior:
17 | 1. Go to '...'
18 | 2. Click on '....'
19 | 3. Scroll down to '....'
20 | 4. See error
21 |
22 | **Expected behavior**
23 | A clear and concise description of what you expected to happen.
24 |
25 | **Screenshots**
26 | If applicable, add screenshots to help explain your problem.
27 |
28 | **Environment (please complete the following information):**
29 | - Version [e.g. 4.0.0]
30 | - Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
31 | - Unity version: [e.g. 2018.2.8f1]
32 | - Build options: [e.g. IL2CPP, .Net 4.x, LWRP]
33 |
34 | **Additional context**
35 | Add any other context about the problem here.
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: mob-sakai
7 |
8 | ---
9 |
10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
11 |
12 | **Is your feature request related to a problem? Please describe.**
13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
14 |
15 | **Describe the solution you'd like**
16 | A clear and concise description of what you want to happen.
17 |
18 | **Describe alternatives you've considered**
19 | A clear and concise description of any alternative solutions or features you've considered.
20 |
21 | **Additional context**
22 | Add any other context or screenshots about the feature request here.
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question
3 | about: Ask a question about this project
4 | title: ''
5 | labels: question
6 | assignees: mob-sakai
7 |
8 | ---
9 |
10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
11 |
12 | **Describe what help do you need**
13 | A description of the question.
14 |
15 | **Screenshots**
16 | If applicable, add screenshots to help explain your problem.
17 |
18 | **Environment (please complete the following information):**
19 | - Version [e.g. 4.0.0]
20 | - Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
21 | - Unity version: [e.g. 2018.2.8f1]
22 | - Build options: [e.g. IL2CPP, .Net 4.x, LWRP]
23 |
24 | **Additional context**
25 | Add any other context or screenshots about the question here.
26 |
--------------------------------------------------------------------------------
/.releaserc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ankh4396/UIEffect/b43e40508b167d143330d8b9eff0d5c9965cdf3c/.releaserc
--------------------------------------------------------------------------------
/CHANGELOG.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1fe75f65a37454bf5aa2dab183b4305a
3 | timeCreated: 1522651812
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright 2017-2020 mob-sakai
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5c8ea34522dd786479be28b1347542b7
3 | timeCreated: 1515125149
4 | licenseType: Free
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UIEffect
2 | ===
3 |
4 | UIEffect provides visual effect components for Unity UI.
5 |
6 | [](https://openupm.com/packages/com.coffee.ui-effect/)
7 | [](https://github.com/mob-sakai/UIEffect/releases)
8 | [](https://github.com/mob-sakai/UIEffect/releases)
9 | 
10 | [](https://github.com/mob-sakai/UIEffect/blob/master/LICENSE.txt)
11 | [](http://makeapullrequest.com)
12 | [](https://github.com/mob-sakai/UIEffect/subscription)
13 | [](https://twitter.com/intent/follow?screen_name=mob_sakai)
14 |
15 | << [Description](#Description) | [WebGL Demo](#demo) | [Installation](#installation) | [Usage](#usage) | [Example of using](#example-of-using) | [Change log](https://github.com/mob-sakai/UIEffect/blob/upm/CHANGELOG.md) | [Support](#support) >>
16 |
17 |
18 |
19 |
20 | ## Description
21 |
22 | Let's decorate your UI with effects!
23 | You can control parameters as you like from the script as well as inspector.
24 | AnimationClip is supported as a matter of course!
25 |
26 | 
27 | 
28 |
29 |
30 | #### Available effects
31 |
32 | | Component | Features | Screenshot |
33 | | -- | -- | -- |
34 | | **UIEffect** | Combine some visual effects.
**Effect Mode:** Grayscale, Sepia, Nega, Pixelation
**Color Mode:** Multiply, Fill, Additive, Subtract
**Blur Mode:** Fast, Medium, Detail
**Advanced Blur:** Enable more beautiful blurring. | ![][eff1] |
35 | | **UIShiny** | Apply shining effect to a graphic.
The effect does not require Mask component or normal map.
**Parameters:** Effect factor, Width, Rotation, Softness, Brightness, Gloss | ![][eff2] |
36 | | **UIDissolve** | Apply dissolve effect to a graphic.
**Color Mode for edge:** Multiply, Fill, Additive, Subtract
**Parameters:** Effect factor, Width, Rotation, Softness, Edge color
**Options:** Effect area, Keep effect aspect ratio | ![][eff3] |
37 | | **UIHsvModifier** | Modify HSV for graphic.
**Target:** Color, Range
**Adjustment:** Hue, Saturation, Value | ![][eff4] |
38 | | **UITransition Effect** | Apply transition effect with a single channel texture.
**Effect Mode:** Cutoff, Fade, Dissolve
**Options:** Effect area, Keep effect aspect ratio, transition texture
**Pass Ray On Hidden:** Disable the graphic's raycastTarget on hidden. | ![][eff5] |
39 |
40 | [eff1]:https://user-images.githubusercontent.com/12690315/46639603-258df180-cba2-11e8-8f50-9e93bdc4c96e.png
41 | [eff2]:https://user-images.githubusercontent.com/12690315/46639689-b1078280-cba2-11e8-8716-cbc634af7293.gif
42 | [eff3]:https://user-images.githubusercontent.com/12690315/46639690-b1078280-cba2-11e8-8aa9-1d2650fe9a62.gif
43 | [eff4]:https://user-images.githubusercontent.com/12690315/43200006-d6e2bf54-904e-11e8-9f22-0c0f9ce5912f.gif
44 | [eff5]:https://user-images.githubusercontent.com/12690315/46639688-b1078280-cba2-11e8-8bbb-16b8498bca5f.gif
45 |
46 |
47 | ##### The following effects can be used with the above components.
48 |
49 | | Component | Features | Screenshot |
50 | | -- | -- | -- |
51 | | **UIShadow** | Add shadow/outline to a graphic.
The performance is better than the default Shadow/Outline component.
**ShadowStyle:** Shadow, Shadow3, Outline, Outline8 | ![][meff1] |
52 | | **UIGradient** | Change vertex color as gradient with angle and offset.
**Direction:** Horizontal, Vertical, Angle, Diagonal
**Options:** Offset, Color space | ![][meff2] |
53 | | **UIFlip** | Flip a graphic.
**Direction:** Horizontal, Vertical, Both | ![][meff3] |
54 |
55 | [meff1]:https://user-images.githubusercontent.com/12690315/46639604-258df180-cba2-11e8-98a9-aa31f04c695d.png
56 | [meff2]:https://user-images.githubusercontent.com/12690315/40716995-ca87665e-6445-11e8-8233-ec2e21fefd6b.png
57 | [meff3]:https://user-images.githubusercontent.com/12690315/40716996-cab1fd7e-6445-11e8-9753-962d23991d86.png
58 |
59 |
60 |
61 |
62 | ## Demo
63 |
64 | [WebGL Demo](http://mob-sakai.github.io/UIEffect)
65 |
66 |
67 |
68 |
69 |
70 | ## Installation
71 |
72 | #### Requirement
73 |
74 | * Unity 2017.1 or later
75 | * No other SDK are required
76 |
77 | #### Using OpenUPM (for Unity 2018.3 or later)
78 |
79 | This package is available on [OpenUPM](https://openupm.com).
80 | You can install it via [openupm-cli](https://github.com/openupm/openupm-cli).
81 | ```
82 | openupm add com.coffee.ui-effect
83 | ```
84 |
85 | #### Using Git (for Unity 2018.3 or later)
86 |
87 | Find the manifest.json file in the Packages folder of your project and edit it to look like this:
88 | ```js
89 | {
90 | "dependencies": {
91 | "com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git",
92 | ...
93 | },
94 | }
95 | ```
96 |
97 | To update the package, change suffix `#{version}` to the target version.
98 |
99 | * e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git#4.0.0",`
100 |
101 | Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to install and update the package.
102 |
103 | #### For Unity 2018.2 or earlier
104 |
105 | 1. Download a source code zip file from [Releases](https://github.com/mob-sakai/UIEffect/releases) page
106 | 2. Extract it
107 | 3. Import it into the following directory in your Unity project
108 | - `Packages` (It works as an embedded package. For Unity 2018.1 or later)
109 | - `Assets` (Legacy way. For Unity 2017.1 or later)
110 |
111 |
112 |
113 |
114 | ## How to play demo
115 |
116 | - For Unity 2019.1 or later
117 | - Open `Package Manager` window and select `UI Effect` package in package list and click `Demo > Import in project` button
118 | - For Unity 2018.4 or earlier
119 | - Click `Assets/Samples/UIEffect/Import Demo` from menu
120 |
121 | The assets will be imported into `Assets/Samples/UI Effect/{version}/Demo`.
122 | Open `
123 |
124 |
125 |
126 |
127 | ## Usage
128 |
129 | 1. Add any effect component to UI element (Image, RawImage, Text, etc...) from `Add Component` in inspector or `Component > UI > UIEffect > ...` menu.
130 | 
131 | 2. Adjust the parameters of the effect as you like, in inspector.
132 | 
133 | 3. You can add or modify effects from the script.
134 | ```cs
135 | var uieffect = gameObject.AddComponent();
136 | uieffect.effectMode = EffectMode.Grayscale;
137 | uieffect.effectFactor = 0.85f;
138 | uieffect.colorMode = ColorMode.Add;
139 | uieffect.effectColor = Color.white;
140 | uieffect.colorFactor = 0.1f;
141 | uieffect.blurMode = BlurMode.FastBlur;
142 | uieffect.blurFactor = 1;
143 | ```
144 | 
145 |
146 | 4. Enjoy!
147 |
148 |
149 |
150 |
151 | ## Example of using
152 |
153 | UIEffect can easily be used in a variety of cases in the game.
154 |
155 | | Case | Description | Screenshot |
156 | | -- | -- | -- |
157 | | Lock/unlock contents | Use UIEffect to apply grayscale.
Indicate to user that the content is unavailable. | ![][ex1] |
158 | | Silhouette | Use UIEffect for filling color. | ![][ex2] |
159 | | Soft shadow/
Outer glow | Use UIEffect and UIShadow to blur the shadow. | ![][ex3] |
160 | | Colored shadow | Use UIEffect and UIShadow to fill shadow with color. | ![][ex4] |
161 | | Blurred dynamic font | Use UIEffect to blur text.
To blur dynamic font cleanly, enable `Advanced Blur` option. | ![][ex5] |
162 | | Text with outline & shadow | Use two UIShadows to add outline and shadow.
There is less overdraw than default Outline/Shadow. | ![][ex6] |
163 | | Shining button | Use UIShiny for shining button.
Indicate to user that you can press the button. | ![][ex7] |
164 | | Screen transition | Use UITransitionEffect to transition the screen with any transition texture. | ![][ex8] |
165 |
166 | [ex1]:https://user-images.githubusercontent.com/12690315/46563469-aba8fe80-c93c-11e8-850f-949f6f8da742.png
167 | [ex2]:https://user-images.githubusercontent.com/12690315/46563576-3db10700-c93d-11e8-960e-4336ff3ce481.png
168 | [ex3]:https://user-images.githubusercontent.com/12690315/46566001-452edb00-c952-11e8-9cc4-6098a9eb67f3.png
169 | [ex4]:https://user-images.githubusercontent.com/12690315/46566000-452edb00-c952-11e8-8d20-6ccc3fa92ae4.png
170 | [ex5]:https://user-images.githubusercontent.com/12690315/46566002-45c77180-c952-11e8-87cb-4d915e0614be.png
171 | [ex6]:https://user-images.githubusercontent.com/12690315/46566003-45c77180-c952-11e8-9b47-7bf563ffbaa7.png
172 | [ex7]:https://user-images.githubusercontent.com/12690315/46563539-fb87c580-c93c-11e8-8c08-0f21872c47d4.gif
173 | [ex8]:https://user-images.githubusercontent.com/12690315/46565182-dfd5ec80-c947-11e8-834f-a2ef67ad0d95.gif
174 |
175 |
176 |
177 |
178 | ## License
179 |
180 | * MIT
181 | * © UTJ/UCL
182 |
183 |
184 |
185 |
186 | ## Support
187 |
188 | This is an open-source project that I am developing in my free time.
189 | If you like it, you can support me.
190 | By supporting, you let me spend more time working on better tools that you can use for free. :)
191 |
192 | [](https://www.patreon.com/join/2343451?)
193 | [](https://github.com/users/mob-sakai/sponsorship)
194 |
195 |
196 |
197 | ## Author
198 |
199 | [mob-sakai](https://github.com/mob-sakai)
200 | [](https://twitter.com/intent/follow?screen_name=mob_sakai)
201 |
202 |
203 |
204 | ## See Also
205 |
206 | * GitHub page : https://github.com/mob-sakai/UIEffect
207 | * Releases : https://github.com/mob-sakai/UIEffect/releases
208 | * Issue tracker : https://github.com/mob-sakai/UIEffect/issues
209 | * Change log : https://github.com/mob-sakai/UIEffect/blob/upm/CHANGELOG.md
210 |
--------------------------------------------------------------------------------
/README.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ddc08462bf3e14c82929e462ff7823e7
3 | timeCreated: 1502939317
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f38c4e6372f684b60a94e0d0b902a98a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Resources/Default-Transition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ankh4396/UIEffect/b43e40508b167d143330d8b9eff0d5c9965cdf3c/Resources/Default-Transition.png
--------------------------------------------------------------------------------
/Resources/Default-Transition.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e04c247fb2604af186173fce0bc62de
3 | timeCreated: 1524468976
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | sRGBTexture: 0
12 | linearTexture: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 6
25 | cubemapConvolution: 0
26 | seamlessCubemap: 0
27 | textureFormat: 1
28 | maxTextureSize: 2048
29 | textureSettings:
30 | filterMode: 1
31 | aniso: -1
32 | mipBias: -1
33 | wrapMode: 1
34 | nPOTScale: 1
35 | lightmap: 0
36 | compressionQuality: 50
37 | spriteMode: 0
38 | spriteExtrude: 1
39 | spriteMeshType: 1
40 | alignment: 0
41 | spritePivot: {x: 0.5, y: 0.5}
42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
43 | spritePixelsToUnits: 100
44 | alphaUsage: 2
45 | alphaIsTransparency: 0
46 | spriteTessellationDetail: -1
47 | textureType: 10
48 | textureShape: 1
49 | maxTextureSizeSet: 0
50 | compressionQualitySet: 0
51 | textureFormatSet: 0
52 | platformSettings:
53 | - buildTarget: DefaultTexturePlatform
54 | maxTextureSize: 256
55 | textureFormat: -1
56 | textureCompression: 1
57 | compressionQuality: 50
58 | crunchedCompression: 0
59 | allowsAlphaSplitting: 0
60 | overridden: 0
61 | - buildTarget: Standalone
62 | maxTextureSize: 256
63 | textureFormat: -1
64 | textureCompression: 1
65 | compressionQuality: 50
66 | crunchedCompression: 0
67 | allowsAlphaSplitting: 0
68 | overridden: 0
69 | - buildTarget: iPhone
70 | maxTextureSize: 256
71 | textureFormat: -1
72 | textureCompression: 1
73 | compressionQuality: 50
74 | crunchedCompression: 0
75 | allowsAlphaSplitting: 0
76 | overridden: 0
77 | - buildTarget: Android
78 | maxTextureSize: 256
79 | textureFormat: -1
80 | textureCompression: 1
81 | compressionQuality: 50
82 | crunchedCompression: 0
83 | allowsAlphaSplitting: 0
84 | overridden: 0
85 | - buildTarget: WebGL
86 | maxTextureSize: 256
87 | textureFormat: -1
88 | textureCompression: 1
89 | compressionQuality: 50
90 | crunchedCompression: 0
91 | allowsAlphaSplitting: 0
92 | overridden: 0
93 | spriteSheet:
94 | serializedVersion: 2
95 | sprites: []
96 | outline: []
97 | spritePackingTag:
98 | userData:
99 | assetBundleName:
100 | assetBundleVariant:
101 |
--------------------------------------------------------------------------------
/Resources/UIDissolve.shader:
--------------------------------------------------------------------------------
1 | Shader "Hidden/UI/Default (UIDissolve)"
2 | {
3 | Properties
4 | {
5 | [PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
6 | _Color ("Tint", Color) = (1,1,1,1)
7 |
8 | _StencilComp ("Stencil Comparison", Float) = 8
9 | _Stencil ("Stencil ID", Float) = 0
10 | _StencilOp ("Stencil Operation", Float) = 0
11 | _StencilWriteMask ("Stencil Write Mask", Float) = 255
12 | _StencilReadMask ("Stencil Read Mask", Float) = 255
13 |
14 | _ColorMask ("Color Mask", Float) = 15
15 |
16 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
17 |
18 | [Header(Dissolve)]
19 | _TransitionTex ("Transition Texture (A)", 2D) = "white" {}
20 | _ParamTex ("Parameter Texture", 2D) = "white" {}
21 | }
22 |
23 | SubShader
24 | {
25 | Tags
26 | {
27 | "Queue"="Transparent"
28 | "IgnoreProjector"="True"
29 | "RenderType"="Transparent"
30 | "PreviewType"="Plane"
31 | "CanUseSpriteAtlas"="True"
32 | }
33 |
34 | Stencil
35 | {
36 | Ref [_Stencil]
37 | Comp [_StencilComp]
38 | Pass [_StencilOp]
39 | ReadMask [_StencilReadMask]
40 | WriteMask [_StencilWriteMask]
41 | }
42 |
43 | Cull Off
44 | Lighting Off
45 | ZWrite Off
46 | ZTest [unity_GUIZTestMode]
47 | Blend SrcAlpha OneMinusSrcAlpha
48 | ColorMask [_ColorMask]
49 |
50 | Pass
51 | {
52 | Name "Default"
53 |
54 | CGPROGRAM
55 | #pragma vertex vert
56 | #pragma fragment frag
57 | #pragma target 2.0
58 |
59 | #define DISSOLVE 1
60 | #pragma multi_compile __ UNITY_UI_ALPHACLIP
61 | #pragma multi_compile __ ADD SUBTRACT FILL
62 |
63 | #include "UnityCG.cginc"
64 | #include "UnityUI.cginc"
65 |
66 | #define UI_DISSOLVE 1
67 | #include "UIEffect.cginc"
68 | #include "UIEffectSprite.cginc"
69 |
70 | fixed4 frag(v2f IN) : SV_Target
71 | {
72 | half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
73 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
74 |
75 | // Dissolve
76 | color = ApplyTransitionEffect(color, IN.eParam);
77 |
78 | #ifdef UNITY_UI_ALPHACLIP
79 | clip (color.a - 0.001);
80 | #endif
81 |
82 | return color;
83 | }
84 | ENDCG
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Resources/UIDissolve.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e1b48dc831eb147e9886c049033213bf
3 | ShaderImporter:
4 | externalObjects: {}
5 | defaultTextures:
6 | - _MainTex: {instanceID: 0}
7 | - _TransitionTex: {instanceID: 0}
8 | - _ParamTex: {instanceID: 0}
9 | nonModifiableTextures: []
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Resources/UIEffect.cginc:
--------------------------------------------------------------------------------
1 | #ifndef UI_EFFECT_INCLUDED
2 | #define UI_EFFECT_INCLUDED
3 |
4 |
5 | sampler2D _TransitionTex;
6 | sampler2D _ParamTex;
7 |
8 | #if GRAYSCALE | SEPIA | NEGA | PIXEL | MONO | CUTOFF | HUE
9 | #define UI_TONE
10 | #endif
11 |
12 | #if ADD | SUBTRACT | FILL
13 | #define UI_COLOR
14 | #endif
15 |
16 | #if FASTBLUR | MEDIUMBLUR | DETAILBLUR
17 | #define UI_BLUR
18 | #endif
19 |
20 | // Unpack float to low-precision [0-1] fixed4.
21 | fixed4 UnpackToVec4(float value)
22 | {
23 | const int PACKER_STEP = 64;
24 | const int PRECISION = PACKER_STEP - 1;
25 | fixed4 unpacked;
26 |
27 | unpacked.x = (value % PACKER_STEP) / PRECISION;
28 | value = floor(value / PACKER_STEP);
29 |
30 | unpacked.y = (value % PACKER_STEP) / PRECISION;
31 | value = floor(value / PACKER_STEP);
32 |
33 | unpacked.z = (value % PACKER_STEP) / PRECISION;
34 | value = floor(value / PACKER_STEP);
35 |
36 | unpacked.w = (value % PACKER_STEP) / PRECISION;
37 | return unpacked;
38 | }
39 |
40 | // Unpack float to low-precision [0-1] fixed3.
41 | fixed3 UnpackToVec3(float value)
42 | {
43 | const int PACKER_STEP = 256;
44 | const int PRECISION = PACKER_STEP - 1;
45 | fixed3 unpacked;
46 |
47 | unpacked.x = (value % (PACKER_STEP)) / (PACKER_STEP - 1);
48 | value = floor(value / (PACKER_STEP));
49 |
50 | unpacked.y = (value % PACKER_STEP) / (PACKER_STEP - 1);
51 | value = floor(value / PACKER_STEP);
52 |
53 | unpacked.z = (value % PACKER_STEP) / (PACKER_STEP - 1);
54 | return unpacked;
55 | }
56 |
57 | // Unpack float to low-precision [0-1] half2.
58 | half2 UnpackToVec2(float value)
59 | {
60 | const int PACKER_STEP = 4096;
61 | const int PRECISION = PACKER_STEP - 1;
62 | half2 unpacked;
63 |
64 | unpacked.x = (value % (PACKER_STEP)) / (PACKER_STEP - 1);
65 | value = floor(value / (PACKER_STEP));
66 |
67 | unpacked.y = (value % PACKER_STEP) / (PACKER_STEP - 1);
68 | return unpacked;
69 | }
70 |
71 | // Sample texture with blurring.
72 | // * Fast: Sample texture with 3x3 kernel.
73 | // * Medium: Sample texture with 5x5 kernel.
74 | // * Detail: Sample texture with 7x7 kernel.
75 | fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur, half4 mask)
76 | {
77 | #if FASTBLUR && EX
78 | const int KERNEL_SIZE = 5;
79 | const float KERNEL_[5] = { 0.2486, 0.7046, 1.0, 0.7046, 0.2486};
80 | #elif MEDIUMBLUR && EX
81 | const int KERNEL_SIZE = 9;
82 | const float KERNEL_[9] = { 0.0438, 0.1719, 0.4566, 0.8204, 1.0, 0.8204, 0.4566, 0.1719, 0.0438};
83 | #elif DETAILBLUR && EX
84 | const int KERNEL_SIZE = 13;
85 | 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};
86 | #elif FASTBLUR
87 | const int KERNEL_SIZE = 3;
88 | const float KERNEL_[3] = { 0.4566, 1.0, 0.4566};
89 | #elif MEDIUMBLUR
90 | const int KERNEL_SIZE = 5;
91 | const float KERNEL_[5] = { 0.2486, 0.7046, 1.0, 0.7046, 0.2486};
92 | #elif DETAILBLUR
93 | const int KERNEL_SIZE = 7;
94 | const float KERNEL_[7] = { 0.1719, 0.4566, 0.8204, 1.0, 0.8204, 0.4566, 0.1719};
95 | #else
96 | const int KERNEL_SIZE = 1;
97 | const float KERNEL_[1] = { 1.0 };
98 | #endif
99 | float4 o = 0;
100 | float sum = 0;
101 | float2 shift = 0;
102 | for(int x = 0; x < KERNEL_SIZE; x++)
103 | {
104 | shift.x = blur.x * (float(x) - KERNEL_SIZE/2);
105 | for(int y = 0; y < KERNEL_SIZE; y++)
106 | {
107 | shift.y = blur.y * (float(y) - KERNEL_SIZE/2);
108 | float2 uv = texcood + shift;
109 | float weight = KERNEL_[x] * KERNEL_[y];
110 | sum += weight;
111 | #if EX
112 | fixed masked = min(mask.x <= uv.x, uv.x <= mask.z) * min(mask.y <= uv.y, uv.y <= mask.w);
113 | o += lerp(fixed4(0.5, 0.5, 0.5, 0), tex2D(tex, uv), masked) * weight;
114 | #else
115 | o += tex2D(tex, uv) * weight;
116 | #endif
117 | }
118 | }
119 | return o / sum;
120 | }
121 |
122 | // Sample texture with blurring.
123 | // * Fast: Sample texture with 3x3 kernel.
124 | // * Medium: Sample texture with 5x5 kernel.
125 | // * Detail: Sample texture with 7x7 kernel.
126 | fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur)
127 | {
128 | return Tex2DBlurring(tex, texcood, blur, half4(0,0,1,1));
129 | }
130 |
131 |
132 | // Sample texture with blurring.
133 | // * Fast: Sample texture with 3x1 kernel.
134 | // * Medium: Sample texture with 5x1 kernel.
135 | // * Detail: Sample texture with 7x1 kernel.
136 | fixed4 Tex2DBlurring1D (sampler2D tex, half2 uv, half2 blur)
137 | {
138 | #if FASTBLUR
139 | const int KERNEL_SIZE = 3;
140 | #elif MEDIUMBLUR
141 | const int KERNEL_SIZE = 5;
142 | #elif DETAILBLUR
143 | const int KERNEL_SIZE = 7;
144 | #else
145 | const int KERNEL_SIZE = 1;
146 | #endif
147 | float4 o = 0;
148 | float sum = 0;
149 | float weight;
150 | half2 texcood;
151 | for(int i = -KERNEL_SIZE/2; i <= KERNEL_SIZE/2; i++)
152 | {
153 | texcood = uv;
154 | texcood.x += blur.x * i;
155 | texcood.y += blur.y * i;
156 | weight = 1.0/(abs(i)+2);
157 | o += tex2D(tex, texcood)*weight;
158 | sum += weight;
159 | }
160 | return o / sum;
161 | }
162 |
163 | fixed3 shift_hue(fixed3 RGB, half VSU, half VSW)
164 | {
165 | fixed3 result;
166 | result.x = (0.299 + 0.701*VSU + 0.168*VSW)*RGB.x
167 | + (0.587 - 0.587*VSU + 0.330*VSW)*RGB.y
168 | + (0.114 - 0.114*VSU - 0.497*VSW)*RGB.z;
169 |
170 | result.y = (0.299 - 0.299*VSU - 0.328*VSW)*RGB.x
171 | + (0.587 + 0.413*VSU + 0.035*VSW)*RGB.y
172 | + (0.114 - 0.114*VSU + 0.292*VSW)*RGB.z;
173 |
174 | result.z = (0.299 - 0.3*VSU + 1.25*VSW)*RGB.x
175 | + (0.587 - 0.588*VSU - 1.05*VSW)*RGB.y
176 | + (0.114 + 0.886*VSU - 0.203*VSW)*RGB.z;
177 |
178 | return result;
179 | }
180 |
181 | // Apply tone effect.
182 | fixed4 ApplyToneEffect(fixed4 color, fixed factor)
183 | {
184 | #ifdef GRAYSCALE
185 | color.rgb = lerp(color.rgb, Luminance(color.rgb), factor);
186 |
187 | #elif SEPIA
188 | color.rgb = lerp(color.rgb, Luminance(color.rgb) * half3(1.07, 0.74, 0.43), factor);
189 |
190 | #elif NEGA
191 | color.rgb = lerp(color.rgb, 1 - color.rgb, factor);
192 | #endif
193 |
194 | return color;
195 | }
196 |
197 | // Apply color effect.
198 | fixed4 ApplyColorEffect(half4 color, half4 factor)
199 | {
200 | #if FILL
201 | color.rgb = lerp(color.rgb, factor.rgb, factor.a);
202 |
203 | #elif ADD
204 | color.rgb += factor.rgb * factor.a;
205 |
206 | #elif SUBTRACT
207 | color.rgb -= factor.rgb * factor.a;
208 |
209 | #else
210 | color.rgb = lerp(color.rgb, color.rgb * factor.rgb, factor.a);
211 | #endif
212 |
213 | #if CUTOFF
214 | color.a = factor.a;
215 | #endif
216 |
217 | return color;
218 | }
219 |
220 | // Apply transition effect.
221 | fixed4 ApplyTransitionEffect(half4 color, half3 transParam)
222 | {
223 | fixed4 param = tex2D(_ParamTex, float2(0.25, transParam.z));
224 | float alpha = tex2D(_TransitionTex, transParam.xy).a;
225 |
226 | #if REVERSE
227 | fixed effectFactor = 1 - param.x;
228 | #else
229 | fixed effectFactor = param.x;
230 | #endif
231 |
232 | #if FADE
233 | color.a *= saturate(alpha + (1 - effectFactor * 2));
234 | #elif CUTOFF
235 | color.a *= step(0.001, color.a * alpha - effectFactor);
236 | #elif DISSOLVE
237 | fixed width = param.y/4;
238 | fixed softness = param.z;
239 | fixed3 dissolveColor = tex2D(_ParamTex, float2(0.75, transParam.z)).rgb;
240 | float factor = alpha - effectFactor * ( 1 + width ) + width;
241 | fixed edgeLerp = step(factor, color.a) * saturate((width - factor)*16/ softness);
242 | color = ApplyColorEffect(color, fixed4(dissolveColor, edgeLerp));
243 | color.a *= saturate((factor)*32/ softness);
244 | #endif
245 |
246 | return color;
247 | }
248 |
249 |
250 | // Apply shiny effect.
251 | half4 ApplyShinyEffect(half4 color, half2 shinyParam)
252 | {
253 | fixed nomalizedPos = shinyParam.x;
254 | fixed4 param1 = tex2D(_ParamTex, float2(0.25, shinyParam.y));
255 | fixed4 param2 = tex2D(_ParamTex, float2(0.75, shinyParam.y));
256 | half location = param1.x * 2 - 0.5;
257 | fixed width = param1.y;
258 | fixed soft = param1.z;
259 | fixed brightness = param1.w;
260 | fixed gloss = param2.x;
261 | half normalized = 1 - saturate(abs((nomalizedPos - location) / width));
262 | half shinePower = smoothstep(0, soft, normalized);
263 | half3 reflectColor = lerp(fixed3(1,1,1), color.rgb * 7, gloss);
264 |
265 | color.rgb += color.a * (shinePower / 2) * brightness * reflectColor;
266 |
267 |
268 | return color;
269 | }
270 |
271 | half3 RgbToHsv(half3 c) {
272 | half4 K = half4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
273 | half4 p = lerp(half4(c.bg, K.wz), half4(c.gb, K.xy), step(c.b, c.g));
274 | half4 q = lerp(half4(p.xyw, c.r), half4(c.r, p.yzx), step(p.x, c.r));
275 |
276 | half d = q.x - min(q.w, q.y);
277 | half e = 1.0e-10;
278 | return half3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
279 | }
280 |
281 | half3 HsvToRgb(half3 c) {
282 | c = half3(c.x, clamp(c.yz, 0.0, 1.0));
283 | half4 K = half4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
284 | half3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
285 | return c.z * lerp(K.xxx, clamp(p.xyz - K.xxx, 0.0, 1.0), c.y);
286 | }
287 |
288 |
289 | // Apply Hsv effect.
290 | half4 ApplyHsvEffect(half4 color, half param)
291 | {
292 | fixed4 param1 = tex2D(_ParamTex, float2(0.25, param));
293 | fixed4 param2 = tex2D(_ParamTex, float2(0.75, param));
294 | fixed3 targetHsv = param1.rgb;
295 |
296 | fixed3 targetRange = param1.w;
297 | fixed3 hsvShift = param2.xyz - 0.5;
298 | half3 hsv = RgbToHsv(color.rgb);
299 | half3 range = abs(hsv - targetHsv);
300 | half diff = max(max(min(1-range.x, range.x), min(1-range.y, range.y)/10), min(1-range.z, range.z)/10);
301 |
302 | fixed masked = step(diff, targetRange);
303 | color.rgb = HsvToRgb(hsv + hsvShift * masked);
304 |
305 | return color;
306 | }
307 |
308 |
309 | #endif // UI_EFFECT_INCLUDED
310 |
--------------------------------------------------------------------------------
/Resources/UIEffect.cginc.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7467061e9f5514f2c80e30817ee2458b
3 | timeCreated: 1487915863
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Resources/UIEffect.shader:
--------------------------------------------------------------------------------
1 | Shader "Hidden/UI/Default (UIEffect)"
2 | {
3 | Properties
4 | {
5 | [PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
6 | _Color ("Tint", Color) = (1,1,1,1)
7 |
8 | _StencilComp ("Stencil Comparison", Float) = 8
9 | _Stencil ("Stencil ID", Float) = 0
10 | _StencilOp ("Stencil Operation", Float) = 0
11 | _StencilWriteMask ("Stencil Write Mask", Float) = 255
12 | _StencilReadMask ("Stencil Read Mask", Float) = 255
13 |
14 | _ColorMask ("Color Mask", Float) = 15
15 |
16 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
17 |
18 | _ParamTex ("Parameter Texture", 2D) = "white" {}
19 | }
20 |
21 | SubShader
22 | {
23 | Tags
24 | {
25 | "Queue"="Transparent"
26 | "IgnoreProjector"="True"
27 | "RenderType"="Transparent"
28 | "PreviewType"="Plane"
29 | "CanUseSpriteAtlas"="True"
30 | }
31 |
32 | Stencil
33 | {
34 | Ref [_Stencil]
35 | Comp [_StencilComp]
36 | Pass [_StencilOp]
37 | ReadMask [_StencilReadMask]
38 | WriteMask [_StencilWriteMask]
39 | }
40 |
41 | Cull Off
42 | Lighting Off
43 | ZWrite Off
44 | ZTest [unity_GUIZTestMode]
45 | Blend SrcAlpha OneMinusSrcAlpha
46 | ColorMask [_ColorMask]
47 |
48 | Pass
49 | {
50 | Name "Default"
51 |
52 | CGPROGRAM
53 | #pragma vertex vert
54 | #pragma fragment frag
55 | #if !defined(SHADER_API_D3D11_9X) && !defined(SHADER_API_D3D9)
56 | #pragma target 2.0
57 | #else
58 | #pragma target 3.0
59 | #endif
60 |
61 | #pragma multi_compile __ UNITY_UI_ALPHACLIP
62 |
63 | #pragma multi_compile __ GRAYSCALE SEPIA NEGA PIXEL
64 | #pragma multi_compile __ ADD SUBTRACT FILL
65 | #pragma multi_compile __ FASTBLUR MEDIUMBLUR DETAILBLUR
66 | #pragma multi_compile __ EX
67 |
68 | #include "UnityCG.cginc"
69 | #include "UnityUI.cginc"
70 |
71 | #define UI_EFFECT 1
72 | #include "UIEffect.cginc"
73 | #include "UIEffectSprite.cginc"
74 |
75 | fixed4 frag(v2f IN) : SV_Target
76 | {
77 | fixed4 param = tex2D(_ParamTex, float2(0.25, IN.eParam));
78 | fixed effectFactor = param.x;
79 | fixed colorFactor = param.y;
80 | fixed blurFactor = param.z;
81 |
82 | #if PIXEL
83 | half2 pixelSize = max(2, (1-effectFactor*0.95) * _MainTex_TexelSize.zw);
84 | IN.texcoord = round(IN.texcoord * pixelSize) / pixelSize;
85 | #endif
86 |
87 | #if defined(UI_BLUR) && EX
88 | half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, blurFactor * _MainTex_TexelSize.xy * 2, IN.uvMask) + _TextureSampleAdd);
89 | #elif defined(UI_BLUR)
90 | half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, blurFactor * _MainTex_TexelSize.xy * 2) + _TextureSampleAdd);
91 | #else
92 | half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
93 | #endif
94 |
95 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
96 |
97 | #if UNITY_UI_ALPHACLIP
98 | clip (color.a - 0.001);
99 | #endif
100 |
101 | #if defined (UI_TONE)
102 | color = ApplyToneEffect(color, effectFactor);
103 | #endif
104 |
105 | color = ApplyColorEffect(color, fixed4(IN.color.rgb, colorFactor));
106 | color.a *= IN.color.a;
107 |
108 | return color;
109 | }
110 | ENDCG
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/Resources/UIEffect.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b868e81d0156245e08c8646b4fb68d7a
3 | timeCreated: 1482973535
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Resources/UIEffectSprite.cginc:
--------------------------------------------------------------------------------
1 | #ifndef UI_EFFECT_SPRITE_INCLUDED
2 | #define UI_EFFECT_SPRITE_INCLUDED
3 |
4 | fixed4 _Color;
5 | fixed4 _TextureSampleAdd;
6 | float4 _ClipRect;
7 | sampler2D _MainTex;
8 | float4 _MainTex_TexelSize;
9 |
10 | struct appdata_t
11 | {
12 | float4 vertex : POSITION;
13 | float4 color : COLOR;
14 | float2 texcoord : TEXCOORD0;
15 | #if EX
16 | float2 uvMask : TEXCOORD1;
17 | #endif
18 | UNITY_VERTEX_INPUT_INSTANCE_ID
19 | };
20 |
21 | struct v2f
22 | {
23 | float4 vertex : SV_POSITION;
24 | fixed4 color : COLOR;
25 | half2 texcoord : TEXCOORD0;
26 | float4 worldPosition : TEXCOORD1;
27 | #if UI_DISSOLVE || UI_TRANSITION
28 | half3 eParam : TEXCOORD2;
29 | #elif UI_SHINY
30 | half2 eParam : TEXCOORD2;
31 | #else
32 | half eParam : TEXCOORD2;
33 | #endif
34 | #if EX
35 | half4 uvMask : TEXCOORD3;
36 | #endif
37 | UNITY_VERTEX_OUTPUT_STEREO
38 | };
39 |
40 | v2f vert(appdata_t IN)
41 | {
42 | v2f OUT;
43 | UNITY_SETUP_INSTANCE_ID(IN);
44 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
45 | OUT.worldPosition = IN.vertex;
46 | OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
47 |
48 | #if UI_EFFECT
49 | OUT.texcoord = UnpackToVec2(IN.texcoord.x) * 2 - 0.5;
50 | #else
51 | OUT.texcoord = UnpackToVec2(IN.texcoord.x);
52 | #endif
53 |
54 | #ifdef UNITY_HALF_TEXEL_OFFSET
55 | OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
56 | #endif
57 |
58 | OUT.color = IN.color * _Color;
59 |
60 | #if UI_DISSOLVE || UI_TRANSITION
61 | OUT.eParam = UnpackToVec3(IN.texcoord.y);
62 | #elif UI_SHINY
63 | OUT.eParam = UnpackToVec2(IN.texcoord.y);
64 | #else
65 | OUT.eParam = IN.texcoord.y;
66 | #endif
67 |
68 | #if EX
69 | OUT.uvMask = half4(UnpackToVec2(IN.uvMask.x), UnpackToVec2(IN.uvMask.y));
70 | #endif
71 |
72 | return OUT;
73 | }
74 |
75 | #endif // UI_EFFECT_SPRITE_INCLUDED
76 |
--------------------------------------------------------------------------------
/Resources/UIEffectSprite.cginc.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dd60a36b172cf49e2b82258a68799ce3
3 | timeCreated: 1487915863
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Resources/UIHsvModifier.shader:
--------------------------------------------------------------------------------
1 | Shader "Hidden/UI/Default (UIHsvModifier)"
2 | {
3 | Properties
4 | {
5 | [PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
6 | _Color ("Tint", Color) = (1,1,1,1)
7 |
8 | _StencilComp ("Stencil Comparison", Float) = 8
9 | _Stencil ("Stencil ID", Float) = 0
10 | _StencilOp ("Stencil Operation", Float) = 0
11 | _StencilWriteMask ("Stencil Write Mask", Float) = 255
12 | _StencilReadMask ("Stencil Read Mask", Float) = 255
13 |
14 | _ColorMask ("Color Mask", Float) = 15
15 |
16 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
17 |
18 | _ParamTex ("Parameter Texture", 2D) = "white" {}
19 | }
20 |
21 | SubShader
22 | {
23 | Tags
24 | {
25 | "Queue"="Transparent"
26 | "IgnoreProjector"="True"
27 | "RenderType"="Transparent"
28 | "PreviewType"="Plane"
29 | "CanUseSpriteAtlas"="True"
30 | }
31 |
32 | Stencil
33 | {
34 | Ref [_Stencil]
35 | Comp [_StencilComp]
36 | Pass [_StencilOp]
37 | ReadMask [_StencilReadMask]
38 | WriteMask [_StencilWriteMask]
39 | }
40 |
41 | Cull Off
42 | Lighting Off
43 | ZWrite Off
44 | ZTest [unity_GUIZTestMode]
45 | Blend SrcAlpha OneMinusSrcAlpha
46 | ColorMask [_ColorMask]
47 |
48 | Pass
49 | {
50 | CGPROGRAM
51 | #pragma vertex vert
52 | #pragma fragment frag
53 | #pragma multi_compile __ UNITY_UI_ALPHACLIP
54 |
55 | #include "UnityCG.cginc"
56 | #include "UnityUI.cginc"
57 |
58 | #define UI_HSV_MODIFIER 1
59 | #include "UIEffect.cginc"
60 | #include "UIEffectSprite.cginc"
61 |
62 | fixed4 frag(v2f IN) : COLOR
63 | {
64 | half4 color = tex2D(_MainTex, IN.texcoord);// + _TextureSampleAdd) * IN.color;
65 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
66 |
67 | #ifdef UNITY_UI_ALPHACLIP
68 | clip (color.a - 0.001);
69 | #endif
70 |
71 | color = ApplyHsvEffect(color, IN.eParam);
72 |
73 | return (color + _TextureSampleAdd) * IN.color;
74 | }
75 |
76 | ENDCG
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Resources/UIHsvModifier.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7fc74090480c84f8b977cfcd55cdfe82
3 | timeCreated: 1531882595
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Resources/UIShiny.shader:
--------------------------------------------------------------------------------
1 | Shader "Hidden/UI/Default (UIShiny)"
2 | {
3 | Properties
4 | {
5 | [PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
6 | _Color ("Tint", Color) = (1,1,1,1)
7 |
8 | _StencilComp ("Stencil Comparison", Float) = 8
9 | _Stencil ("Stencil ID", Float) = 0
10 | _StencilOp ("Stencil Operation", Float) = 0
11 | _StencilWriteMask ("Stencil Write Mask", Float) = 255
12 | _StencilReadMask ("Stencil Read Mask", Float) = 255
13 |
14 | _ColorMask ("Color Mask", Float) = 15
15 |
16 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
17 |
18 | _ParamTex ("Parameter Texture", 2D) = "white" {}
19 | }
20 |
21 | SubShader
22 | {
23 | Tags
24 | {
25 | "Queue"="Transparent"
26 | "IgnoreProjector"="True"
27 | "RenderType"="Transparent"
28 | "PreviewType"="Plane"
29 | "CanUseSpriteAtlas"="True"
30 | }
31 |
32 | Stencil
33 | {
34 | Ref [_Stencil]
35 | Comp [_StencilComp]
36 | Pass [_StencilOp]
37 | ReadMask [_StencilReadMask]
38 | WriteMask [_StencilWriteMask]
39 | }
40 |
41 | Cull Off
42 | Lighting Off
43 | ZWrite Off
44 | ZTest [unity_GUIZTestMode]
45 | Blend SrcAlpha OneMinusSrcAlpha
46 | ColorMask [_ColorMask]
47 |
48 | Pass
49 | {
50 | Name "Default"
51 |
52 | CGPROGRAM
53 | #pragma vertex vert
54 | #pragma fragment frag
55 | #pragma target 2.0
56 |
57 | #pragma multi_compile __ UNITY_UI_ALPHACLIP
58 |
59 | #include "UnityCG.cginc"
60 | #include "UnityUI.cginc"
61 |
62 | #define UI_SHINY 1
63 | #include "UIEffect.cginc"
64 | #include "UIEffectSprite.cginc"
65 |
66 | fixed4 frag(v2f IN) : SV_Target
67 | {
68 | half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
69 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
70 |
71 | color = ApplyShinyEffect(color, IN.eParam);
72 |
73 | #ifdef UNITY_UI_ALPHACLIP
74 | clip (color.a - 0.001);
75 | #endif
76 |
77 | return color;
78 | }
79 | ENDCG
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Resources/UIShiny.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 20ffe76c2439c403aabdd25bd94bf011
3 | timeCreated: 1523859834
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Resources/UITtransition.shader:
--------------------------------------------------------------------------------
1 | Shader "Hidden/UI/Default (UITransition)"
2 | {
3 | Properties
4 | {
5 | [PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
6 | _Color ("Tint", Color) = (1,1,1,1)
7 |
8 | _StencilComp ("Stencil Comparison", Float) = 8
9 | _Stencil ("Stencil ID", Float) = 0
10 | _StencilOp ("Stencil Operation", Float) = 0
11 | _StencilWriteMask ("Stencil Write Mask", Float) = 255
12 | _StencilReadMask ("Stencil Read Mask", Float) = 255
13 |
14 | _ColorMask ("Color Mask", Float) = 15
15 |
16 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
17 |
18 | [Header(Transition)]
19 | _TransitionTex ("Transition Texture (A)", 2D) = "white" {}
20 | _ParamTex ("Parameter Texture", 2D) = "white" {}
21 | }
22 |
23 | SubShader
24 | {
25 | Tags
26 | {
27 | "Queue"="Transparent"
28 | "IgnoreProjector"="True"
29 | "RenderType"="Transparent"
30 | "PreviewType"="Plane"
31 | "CanUseSpriteAtlas"="True"
32 | }
33 |
34 | Stencil
35 | {
36 | Ref [_Stencil]
37 | Comp [_StencilComp]
38 | Pass [_StencilOp]
39 | ReadMask [_StencilReadMask]
40 | WriteMask [_StencilWriteMask]
41 | }
42 |
43 | Cull Off
44 | Lighting Off
45 | ZWrite Off
46 | ZTest [unity_GUIZTestMode]
47 | Blend SrcAlpha OneMinusSrcAlpha
48 | ColorMask [_ColorMask]
49 |
50 | Pass
51 | {
52 | Name "Default"
53 |
54 | CGPROGRAM
55 | #pragma vertex vert
56 | #pragma fragment frag
57 | #pragma target 2.0
58 |
59 | #define REVERSE 1
60 | #define ADD 1
61 | #pragma multi_compile __ UNITY_UI_ALPHACLIP
62 |
63 | #pragma multi_compile __ FADE CUTOFF DISSOLVE
64 | #include "UnityCG.cginc"
65 | #include "UnityUI.cginc"
66 |
67 | #define UI_TRANSITION 1
68 | #include "UIEffect.cginc"
69 | #include "UIEffectSprite.cginc"
70 |
71 | fixed4 frag(v2f IN) : SV_Target
72 | {
73 | half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
74 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
75 |
76 | color = ApplyTransitionEffect(color, IN.eParam) * IN.color;
77 |
78 | #if UNITY_UI_ALPHACLIP
79 | clip (color.a - 0.001);
80 | #endif
81 |
82 | return color;
83 | }
84 | ENDCG
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Resources/UITtransition.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 85ad24dd0759947ddb117625e108d49c
3 | timeCreated: 1548078121
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures:
7 | - _MainTex: {instanceID: 0}
8 | - _NoiseTex: {fileID: 2800000, guid: 3e04c247fb2604af186173fce0bc62de, type: 3}
9 | - _ParamTex: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Samples~/Demo.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1b972071582443e2845278a859a1533
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/Demo/UIEffect_Demo.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "UIEffect_Demo",
3 | "references": [
4 | "UIEffect"
5 | ],
6 | "optionalUnityReferences": [],
7 | "includePlatforms": [],
8 | "excludePlatforms": [],
9 | "allowUnsafeCode": false,
10 | "overrideReferences": false,
11 | "precompiledReferences": [],
12 | "autoReferenced": false,
13 | "defineConstraints": []
14 | }
--------------------------------------------------------------------------------
/Samples~/Demo/UIEffect_Demo.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3ef9215e2eb5a49b997be297ae25152e
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/Demo/UIEffect_Demo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 | using UnityEngine.UI;
6 |
7 | namespace Coffee.UIEffects
8 | {
9 | public class UIEffect_Demo : MonoBehaviour
10 | {
11 | // Use this for initialization
12 | void Start()
13 | {
14 | GetComponentInChildren().enabled = true;
15 | }
16 |
17 | public void SetTimeScale(float scale)
18 | {
19 | Time.timeScale = scale;
20 | }
21 |
22 | public void Open(Animator anim)
23 | {
24 | // anim.GetComponentInChildren().Capture();
25 | anim.gameObject.SetActive(true);
26 | anim.SetTrigger("Open");
27 | }
28 |
29 | public void Close(Animator anim)
30 | {
31 | anim.SetTrigger("Close");
32 | }
33 |
34 | public void Capture(Animator anim)
35 | {
36 | // anim.GetComponentInChildren().Capture();
37 | anim.SetTrigger("Capture");
38 | }
39 |
40 | public void SetCanvasOverlay(bool isOverlay)
41 | {
42 | GetComponent