Compare commits

...

50 Commits

Author SHA1 Message Date
semantic-release-bot 16be53e145 chore(release): 5.9.5 [skip ci]
## [5.9.5](https://github.com/mob-sakai/UIEffect/compare/5.9.4...5.9.5) (2025-06-26)

### Bug Fixes

* `GetGradientKeys` and `GetTransitionGradientKeys` cannot get GradientMode ([fd2d1b8](https://github.com/mob-sakai/UIEffect/commit/fd2d1b80592ac4ea62e15b6150be63964b113fa2)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
2025-06-26 07:26:57 +00:00
mob-sakai fd2d1b8059 fix: GetGradientKeys and GetTransitionGradientKeys cannot get GradientMode
close #358
2025-06-26 16:25:24 +09:00
semantic-release-bot cf43bfffb9 chore(release): 5.9.4 [skip ci]
## [5.9.4](https://github.com/mob-sakai/UIEffect/compare/5.9.3...5.9.4) (2025-06-25)

### Bug Fixes

* colors specified in UIEffect are output differently in linear color space ([0d7fb1e](https://github.com/mob-sakai/UIEffect/commit/0d7fb1eb63881b67f2658567750a83c92187df35)), closes [#359](https://github.com/mob-sakai/UIEffect/issues/359)
2025-06-25 23:17:34 +00:00
mob-sakai a2f4a2d5c9 refactor 2025-06-26 08:13:17 +09:00
mob-sakai 0d7fb1eb63 fix: colors specified in UIEffect are output differently in linear color space
close #359
2025-06-26 08:11:21 +09:00
semantic-release-bot 145f56968a chore(release): 5.9.3 [skip ci]
## [5.9.3](https://github.com/mob-sakai/UIEffect/compare/5.9.2...5.9.3) (2025-06-23)

### Bug Fixes

* add `GetGradientKeys` and `GetTransitionGradientKeys` APIs ([a0c3e49](https://github.com/mob-sakai/UIEffect/commit/a0c3e4997af181ae16744c53ad3867e2106ccff3)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
* support world canvas without UI events ([cadbb8d](https://github.com/mob-sakai/UIEffect/commit/cadbb8d68d17a2ec7e2d6e8e885d711e61fa53af)), closes [#356](https://github.com/mob-sakai/UIEffect/issues/356) [#357](https://github.com/mob-sakai/UIEffect/issues/357)
2025-06-23 09:29:53 +00:00
mob-sakai cadbb8d68d fix: support world canvas without UI events
close #356, close #357
2025-06-23 18:15:58 +09:00
mob-sakai a0c3e4997a fix: add GetGradientKeys and GetTransitionGradientKeys APIs
close #358
2025-06-23 18:15:08 +09:00
semantic-release-bot ec57c2a994 chore(release): 5.9.2 [skip ci]
## [5.9.2](https://github.com/mob-sakai/UIEffect/compare/5.9.1...5.9.2) (2025-06-12)

### Bug Fixes

* TextMeshPro 3.2.0-pre support ([804b48c](https://github.com/mob-sakai/UIEffect/commit/804b48c73ec648eaceb720cb79551fdbf3729fc9)), closes [#355](https://github.com/mob-sakai/UIEffect/issues/355)
2025-06-12 11:51:05 +00:00
mob-sakai 804b48c73e fix: TextMeshPro 3.2.0-pre support
close #355
2025-06-12 20:49:32 +09:00
semantic-release-bot 01be18bb28 chore(release): 5.9.1 [skip ci]
## [5.9.1](https://github.com/mob-sakai/UIEffect/compare/5.9.0...5.9.1) (2025-06-11)

### Bug Fixes

* prefabs will be deselected when editing them ([8addbad](https://github.com/mob-sakai/UIEffect/commit/8addbad4941340807d824e295280473d197d889f)), closes [#354](https://github.com/mob-sakai/UIEffect/issues/354)
2025-06-11 09:15:00 +00:00
mob-sakai 8addbad494 fix: prefabs will be deselected when editing them
close #354
2025-06-11 18:11:58 +09:00
mob-sakai dc5b3805d7 docs: update readme 2025-06-09 20:12:33 +09:00
semantic-release-bot bbb5ae0f3e chore(release): 5.9.0 [skip ci]
# [5.9.0](https://github.com/mob-sakai/UIEffect/compare/5.8.7...5.9.0) (2025-06-09)

### Bug Fixes

* `GradationMode.RadialFast` and `GradationMode.RadialDetail` are obsolete ([1a923dd](https://github.com/mob-sakai/UIEffect/commit/1a923dd72c263de5480d71bd17b697feca317ef1))
* soft masking not working with `DetailFilter.Masking` ([ffdeaa7](https://github.com/mob-sakai/UIEffect/commit/ffdeaa7e2f1c2a9ccb7eb21d5674e2c19021aef9))

### Features

* `GradationGradient` supports HDR color ([50f6b3c](https://github.com/mob-sakai/UIEffect/commit/50f6b3c5d20b93a2245f6d54b6eb4bc13565c3b5))
* add `Clear` method to reset properties via script ([264c453](https://github.com/mob-sakai/UIEffect/commit/264c453bb6ebad08ef950b0cec2f38e60a1710d8)), closes [#337](https://github.com/mob-sakai/UIEffect/issues/337)
* add `GradationMode.RadialGradient` feature ([179ec89](https://github.com/mob-sakai/UIEffect/commit/179ec89a0215af9d8046e150d98fa06371155e93)), closes [#348](https://github.com/mob-sakai/UIEffect/issues/348)
* add `GradationReverse` option for gradient ([c0fec32](https://github.com/mob-sakai/UIEffect/commit/c0fec32d502ec1f9d03172ed200f4d9233506eb9)), closes [#348](https://github.com/mob-sakai/UIEffect/issues/348)
* add `GradationWrapMode` option ([f98929d](https://github.com/mob-sakai/UIEffect/commit/f98929d7e9656b4c02d5545b3893748c963d1118))
* add `TransitionFilter.Blaze` feature ([ed4716d](https://github.com/mob-sakai/UIEffect/commit/ed4716d7ada102fe0053480941925e9f27b1c2c3))
* add new built-in presets ([4f2c9f1](https://github.com/mob-sakai/UIEffect/commit/4f2c9f12b5e115bab1418a7a0b1187269a041fc4))
* improve performance for TextMeshPro ([6af520e](https://github.com/mob-sakai/UIEffect/commit/6af520ed408f2e5eb4d84ec0df484338719ebc8e))
* timeline package support ([742a5cd](https://github.com/mob-sakai/UIEffect/commit/742a5cd8dc47500de4b111a132d7a8b242844342)), closes [#347](https://github.com/mob-sakai/UIEffect/issues/347)
* update shaders in samples ([4c6cd11](https://github.com/mob-sakai/UIEffect/commit/4c6cd11d86582f2351c40374180828ad1c8955c3))
2025-06-09 09:36:30 +00:00
mob-sakai ffdeaa7e2f fix: soft masking not working with DetailFilter.Masking 2025-06-09 18:35:23 +09:00
mob-sakai f879424b3f chore: update samples 2025-06-09 18:35:23 +09:00
mob-sakai effdd6d06e chore: update dev proj 2025-06-09 18:35:23 +09:00
mob-sakai b39ba58a85 docs: update readme 2025-06-09 18:35:23 +09:00
mob-sakai 742a5cd8dc feat: timeline package support
Tracks for changing properties have been added. Also, `ControlTrack` enables `UIEffect` only within the clip.

close #347
2025-06-09 18:13:20 +09:00
mob-sakai 1a923dd72c fix: GradationMode.RadialFast and GradationMode.RadialDetail are obsolete
Use `GradationMode.Radial` instead.
2025-06-09 18:11:34 +09:00
mob-sakai c0fec32d50 feat: add GradationReverse option for gradient
close #348
2025-06-09 18:11:33 +09:00
mob-sakai 4f2c9f12b5 feat: add new built-in presets 2025-06-09 17:11:08 +09:00
mob-sakai 264c453bb6 feat: add Clear method to reset properties via script
close #337
2025-06-09 17:11:08 +09:00
mob-sakai 4c6cd11d86 feat: update shaders in samples
NOTE: Imported samples will be automatically updated.
2025-06-09 17:11:08 +09:00
mob-sakai 50f6b3c5d2 feat: GradationGradient supports HDR color 2025-06-09 17:11:08 +09:00
mob-sakai f98929d7e9 feat: add GradationWrapMode option 2025-06-09 17:11:08 +09:00
mob-sakai 179ec89a02 feat: add GradationMode.RadialGradient feature
close #348
2025-06-09 17:11:08 +09:00
mob-sakai ed4716d7ad feat: add TransitionFilter.Blaze feature 2025-06-09 17:11:08 +09:00
mob-sakai 6af520ed40 feat: improve performance for TextMeshPro 2025-06-09 17:11:08 +09:00
semantic-release-bot 9b1af29cd4 chore(release): 5.8.7 [skip ci]
## [5.8.7](https://github.com/mob-sakai/UIEffect/compare/5.8.6...5.8.7) (2025-06-09)

### Bug Fixes

* `GradationGradient` and `TransitionGradient` in reprica will be not dirty (editor) ([58b197e](https://github.com/mob-sakai/UIEffect/commit/58b197e551aea8efca10e12da8df132853d4a24e))
* changes not reflected in rendering when TextMeshPro is cleared ([f508eb3](https://github.com/mob-sakai/UIEffect/commit/f508eb32caf6757eb4c27b98ac29a1582dcd14b4)), closes [#351](https://github.com/mob-sakai/UIEffect/issues/351)
* setting `gradationScale` to 0 throws `DivideByZeroException` ([ecd265e](https://github.com/mob-sakai/UIEffect/commit/ecd265e4828c7f81c96a76c16df147b6c4804429))
2025-06-09 08:10:01 +00:00
mob-sakai 65a00b480f chore: update test workflow 2025-06-09 16:16:31 +09:00
mob-sakai f508eb32ca fix: changes not reflected in rendering when TextMeshPro is cleared
close #351
2025-06-09 16:16:30 +09:00
mob-sakai ecd265e482 fix: setting gradationScale to 0 throws DivideByZeroException 2025-06-09 16:16:30 +09:00
mob-sakai 58b197e551 fix: GradationGradient and TransitionGradient in reprica will be not dirty (editor) 2025-06-09 16:14:30 +09:00
semantic-release-bot 8a0e7d6b26 chore(release): 5.8.6 [skip ci]
## [5.8.6](https://github.com/mob-sakai/UIEffect/compare/5.8.5...5.8.6) (2025-05-22)

### Bug Fixes

* some methods may be called multiple times when domain reload on play is disabled (editor) ([3b52c3a](https://github.com/mob-sakai/UIEffect/commit/3b52c3a8fc67980d426b8e4e2ed2067c725ca262))
2025-05-22 12:09:00 +00:00
mob-sakai 3b52c3a8fc fix: some methods may be called multiple times when domain reload on play is disabled (editor) 2025-05-22 21:08:27 +09:00
semantic-release-bot 88261e2af0 chore(release): 5.8.5 [skip ci]
## [5.8.5](https://github.com/mob-sakai/UIEffect/compare/5.8.4...5.8.5) (2025-05-22)

### Bug Fixes

* skip processing when graphic is invalid ([5cd48a4](https://github.com/mob-sakai/UIEffect/commit/5cd48a463309270ec3d6501bde2add9944bbaf02))
* TextMeshPro strikethrough and underline not displaying ([68ebae2](https://github.com/mob-sakai/UIEffect/commit/68ebae28e02045cb45996bf5b77d7d93d2f0ca82)), closes [#344](https://github.com/mob-sakai/UIEffect/issues/344)
* TMP SubMeshUI generates overhead every frame (since 5.6.0) ([791d867](https://github.com/mob-sakai/UIEffect/commit/791d8670761902466d81412d832cddf013cd28cd)), closes [#343](https://github.com/mob-sakai/UIEffect/issues/343) [#345](https://github.com/mob-sakai/UIEffect/issues/345)
2025-05-22 11:14:57 +00:00
mob-sakai 791d867076 fix: TMP SubMeshUI generates overhead every frame (since 5.6.0)
close #343, close #345
2025-05-22 19:48:34 +09:00
mob-sakai 68ebae28e0 fix: TextMeshPro strikethrough and underline not displaying
close #344
2025-05-22 19:48:34 +09:00
mob-sakai 5cd48a4633 fix: skip processing when graphic is invalid 2025-05-22 19:48:34 +09:00
semantic-release-bot 3ff52e4735 chore(release): 5.8.4 [skip ci]
## [5.8.4](https://github.com/mob-sakai/UIEffect/compare/5.8.3...5.8.4) (2025-04-30)

### Bug Fixes

* NRE while canvas is disabled ([a3773e3](https://github.com/mob-sakai/UIEffect/commit/a3773e33028c60517fb4e6c534f6280194df8e64)), closes [#342](https://github.com/mob-sakai/UIEffect/issues/342)
2025-04-30 22:53:37 +00:00
mob-sakai a3773e3302 fix: NRE while canvas is disabled
close #342
2025-05-01 07:53:04 +09:00
semantic-release-bot 5a9f335bf8 chore(release): 5.8.3 [skip ci]
## [5.8.3](https://github.com/mob-sakai/UIEffect/compare/5.8.2...5.8.3) (2025-04-30)

### Bug Fixes

* the alpha of the gradation color and gradient was being ignored ([3807e4c](https://github.com/mob-sakai/UIEffect/commit/3807e4c69aefaef04b2245522e7c5085ccc65a36)), closes [#341](https://github.com/mob-sakai/UIEffect/issues/341)
2025-04-30 09:49:34 +00:00
mob-sakai 3807e4c69a fix: the alpha of the gradation color and gradient was being ignored
close #341
2025-04-30 18:48:27 +09:00
semantic-release-bot 184967c120 chore(release): 5.8.2 [skip ci]
## [5.8.2](https://github.com/mob-sakai/UIEffect/compare/5.8.1...5.8.2) (2025-04-23)

### Bug Fixes

* `Flip` is ignored when loading a preset ([e1f3abf](https://github.com/mob-sakai/UIEffect/commit/e1f3abf7a65b62718b28e33ac2f7d700c3ae3f5a))
* fix detail color ([90ab16c](https://github.com/mob-sakai/UIEffect/commit/90ab16c3fd46435ebf7c8e47ffb4ec521d2f61c9))
* indicate in the inspector using tooltips and asterisks that `Rotation` and `Keep Aspect Ratio` are shared properties ([2cca822](https://github.com/mob-sakai/UIEffect/commit/2cca822413aa7580e1eb777c3295d1de928cd65f))
2025-04-23 23:24:29 +00:00
mob-sakai 2cca822413 fix: indicate in the inspector using tooltips and asterisks that Rotation and Keep Aspect Ratio are shared properties 2025-04-19 10:22:34 +09:00
mob-sakai 90ab16c3fd fix: fix detail color 2025-04-19 10:22:34 +09:00
mob-sakai e1f3abf7a6 fix: Flip is ignored when loading a preset 2025-04-19 10:21:16 +09:00
mob-sakai 770e61bb12 chore: refactor 2025-04-18 17:32:30 +09:00
mob-sakai a0820bf847 chore: update coffee.internal 2025-04-18 17:14:44 +09:00
185 changed files with 14553 additions and 11021 deletions
+2 -1
View File
@@ -86,7 +86,8 @@ jobs:
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git merge origin/${{ github.event.pull_request.base.ref }} --no-edit
git rebase ${{ github.event.pull_request.base.sha }}
git log --oneline -n 10
- name: 📥 Cache library
uses: actions/cache@v4
File diff suppressed because it is too large Load Diff
@@ -31,6 +31,8 @@ ShaderVariantCollection:
passType: 0
- keywords: GLOW_ON TONE_RETRO UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_BLAZE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_BURN UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_DISSOLVE UNDERLAY_ON
@@ -72,6 +74,8 @@ ShaderVariantCollection:
passType: 0
- keywords: DETAIL_MULTIPLY
passType: 0
- keywords: DETAIL_MULTIPLY GRADATION_GRADIENT
passType: 0
- keywords: DETAIL_MULTIPLY_ADDITIVE
passType: 0
- keywords: DETAIL_REPLACE
@@ -126,6 +130,10 @@ ShaderVariantCollection:
passType: 0
- keywords: TONE_SEPIA
passType: 0
- keywords: TRANSITION_BLAZE
passType: 0
- keywords: TRANSITION_BLAZE UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_BURN
passType: 0
- keywords: TRANSITION_BURN UNITY_UI_CLIP_RECT
+4 -4
View File
@@ -5,14 +5,14 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.minimal-resource": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2bd2bf356dd692a39de9db2ff11faaf79fbfaea3"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.nano-monitor": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
@@ -21,14 +21,14 @@
"dependencies": {
"com.unity.ugui": "1.0.0"
},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.symbolic-linker": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.ui-effect": {
"version": "file:src",
+106
View File
@@ -1,3 +1,109 @@
## [5.9.5](https://github.com/mob-sakai/UIEffect/compare/5.9.4...5.9.5) (2025-06-26)
### Bug Fixes
* `GetGradientKeys` and `GetTransitionGradientKeys` cannot get GradientMode ([fd2d1b8](https://github.com/mob-sakai/UIEffect/commit/fd2d1b80592ac4ea62e15b6150be63964b113fa2)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
## [5.9.4](https://github.com/mob-sakai/UIEffect/compare/5.9.3...5.9.4) (2025-06-25)
### Bug Fixes
* colors specified in UIEffect are output differently in linear color space ([0d7fb1e](https://github.com/mob-sakai/UIEffect/commit/0d7fb1eb63881b67f2658567750a83c92187df35)), closes [#359](https://github.com/mob-sakai/UIEffect/issues/359)
## [5.9.3](https://github.com/mob-sakai/UIEffect/compare/5.9.2...5.9.3) (2025-06-23)
### Bug Fixes
* add `GetGradientKeys` and `GetTransitionGradientKeys` APIs ([a0c3e49](https://github.com/mob-sakai/UIEffect/commit/a0c3e4997af181ae16744c53ad3867e2106ccff3)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
* support world canvas without UI events ([cadbb8d](https://github.com/mob-sakai/UIEffect/commit/cadbb8d68d17a2ec7e2d6e8e885d711e61fa53af)), closes [#356](https://github.com/mob-sakai/UIEffect/issues/356) [#357](https://github.com/mob-sakai/UIEffect/issues/357)
## [5.9.2](https://github.com/mob-sakai/UIEffect/compare/5.9.1...5.9.2) (2025-06-12)
### Bug Fixes
* TextMeshPro 3.2.0-pre support ([804b48c](https://github.com/mob-sakai/UIEffect/commit/804b48c73ec648eaceb720cb79551fdbf3729fc9)), closes [#355](https://github.com/mob-sakai/UIEffect/issues/355)
## [5.9.1](https://github.com/mob-sakai/UIEffect/compare/5.9.0...5.9.1) (2025-06-11)
### Bug Fixes
* prefabs will be deselected when editing them ([8addbad](https://github.com/mob-sakai/UIEffect/commit/8addbad4941340807d824e295280473d197d889f)), closes [#354](https://github.com/mob-sakai/UIEffect/issues/354)
# [5.9.0](https://github.com/mob-sakai/UIEffect/compare/5.8.7...5.9.0) (2025-06-09)
### Bug Fixes
* `GradationMode.RadialFast` and `GradationMode.RadialDetail` are obsolete ([1a923dd](https://github.com/mob-sakai/UIEffect/commit/1a923dd72c263de5480d71bd17b697feca317ef1))
* soft masking not working with `DetailFilter.Masking` ([ffdeaa7](https://github.com/mob-sakai/UIEffect/commit/ffdeaa7e2f1c2a9ccb7eb21d5674e2c19021aef9))
### Features
* `GradationGradient` supports HDR color ([50f6b3c](https://github.com/mob-sakai/UIEffect/commit/50f6b3c5d20b93a2245f6d54b6eb4bc13565c3b5))
* add `Clear` method to reset properties via script ([264c453](https://github.com/mob-sakai/UIEffect/commit/264c453bb6ebad08ef950b0cec2f38e60a1710d8)), closes [#337](https://github.com/mob-sakai/UIEffect/issues/337)
* add `GradationMode.RadialGradient` feature ([179ec89](https://github.com/mob-sakai/UIEffect/commit/179ec89a0215af9d8046e150d98fa06371155e93)), closes [#348](https://github.com/mob-sakai/UIEffect/issues/348)
* add `GradationReverse` option for gradient ([c0fec32](https://github.com/mob-sakai/UIEffect/commit/c0fec32d502ec1f9d03172ed200f4d9233506eb9)), closes [#348](https://github.com/mob-sakai/UIEffect/issues/348)
* add `GradationWrapMode` option ([f98929d](https://github.com/mob-sakai/UIEffect/commit/f98929d7e9656b4c02d5545b3893748c963d1118))
* add `TransitionFilter.Blaze` feature ([ed4716d](https://github.com/mob-sakai/UIEffect/commit/ed4716d7ada102fe0053480941925e9f27b1c2c3))
* add new built-in presets ([4f2c9f1](https://github.com/mob-sakai/UIEffect/commit/4f2c9f12b5e115bab1418a7a0b1187269a041fc4))
* improve performance for TextMeshPro ([6af520e](https://github.com/mob-sakai/UIEffect/commit/6af520ed408f2e5eb4d84ec0df484338719ebc8e))
* timeline package support ([742a5cd](https://github.com/mob-sakai/UIEffect/commit/742a5cd8dc47500de4b111a132d7a8b242844342)), closes [#347](https://github.com/mob-sakai/UIEffect/issues/347)
* update shaders in samples ([4c6cd11](https://github.com/mob-sakai/UIEffect/commit/4c6cd11d86582f2351c40374180828ad1c8955c3))
## [5.8.7](https://github.com/mob-sakai/UIEffect/compare/5.8.6...5.8.7) (2025-06-09)
### Bug Fixes
* `GradationGradient` and `TransitionGradient` in reprica will be not dirty (editor) ([58b197e](https://github.com/mob-sakai/UIEffect/commit/58b197e551aea8efca10e12da8df132853d4a24e))
* changes not reflected in rendering when TextMeshPro is cleared ([f508eb3](https://github.com/mob-sakai/UIEffect/commit/f508eb32caf6757eb4c27b98ac29a1582dcd14b4)), closes [#351](https://github.com/mob-sakai/UIEffect/issues/351)
* setting `gradationScale` to 0 throws `DivideByZeroException` ([ecd265e](https://github.com/mob-sakai/UIEffect/commit/ecd265e4828c7f81c96a76c16df147b6c4804429))
## [5.8.6](https://github.com/mob-sakai/UIEffect/compare/5.8.5...5.8.6) (2025-05-22)
### Bug Fixes
* some methods may be called multiple times when domain reload on play is disabled (editor) ([3b52c3a](https://github.com/mob-sakai/UIEffect/commit/3b52c3a8fc67980d426b8e4e2ed2067c725ca262))
## [5.8.5](https://github.com/mob-sakai/UIEffect/compare/5.8.4...5.8.5) (2025-05-22)
### Bug Fixes
* skip processing when graphic is invalid ([5cd48a4](https://github.com/mob-sakai/UIEffect/commit/5cd48a463309270ec3d6501bde2add9944bbaf02))
* TextMeshPro strikethrough and underline not displaying ([68ebae2](https://github.com/mob-sakai/UIEffect/commit/68ebae28e02045cb45996bf5b77d7d93d2f0ca82)), closes [#344](https://github.com/mob-sakai/UIEffect/issues/344)
* TMP SubMeshUI generates overhead every frame (since 5.6.0) ([791d867](https://github.com/mob-sakai/UIEffect/commit/791d8670761902466d81412d832cddf013cd28cd)), closes [#343](https://github.com/mob-sakai/UIEffect/issues/343) [#345](https://github.com/mob-sakai/UIEffect/issues/345)
## [5.8.4](https://github.com/mob-sakai/UIEffect/compare/5.8.3...5.8.4) (2025-04-30)
### Bug Fixes
* NRE while canvas is disabled ([a3773e3](https://github.com/mob-sakai/UIEffect/commit/a3773e33028c60517fb4e6c534f6280194df8e64)), closes [#342](https://github.com/mob-sakai/UIEffect/issues/342)
## [5.8.3](https://github.com/mob-sakai/UIEffect/compare/5.8.2...5.8.3) (2025-04-30)
### Bug Fixes
* the alpha of the gradation color and gradient was being ignored ([3807e4c](https://github.com/mob-sakai/UIEffect/commit/3807e4c69aefaef04b2245522e7c5085ccc65a36)), closes [#341](https://github.com/mob-sakai/UIEffect/issues/341)
## [5.8.2](https://github.com/mob-sakai/UIEffect/compare/5.8.1...5.8.2) (2025-04-23)
### Bug Fixes
* `Flip` is ignored when loading a preset ([e1f3abf](https://github.com/mob-sakai/UIEffect/commit/e1f3abf7a65b62718b28e33ac2f7d700c3ae3f5a))
* fix detail color ([90ab16c](https://github.com/mob-sakai/UIEffect/commit/90ab16c3fd46435ebf7c8e47ffb4ec521d2f61c9))
* indicate in the inspector using tooltips and asterisks that `Rotation` and `Keep Aspect Ratio` are shared properties ([2cca822](https://github.com/mob-sakai/UIEffect/commit/2cca822413aa7580e1eb777c3295d1de928cd65f))
## [5.8.1](https://github.com/mob-sakai/UIEffect/compare/5.8.0...5.8.1) (2025-04-17)
@@ -3,7 +3,9 @@
"rootNamespace": "",
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:735c8f008d0ad4caa9cdc4306f1c3042"
"GUID:735c8f008d0ad4caa9cdc4306f1c3042",
"GUID:f06555f75b070af458a003d92f9efb00",
"GUID:02f771204943f4a40949438e873e3eff"
],
"includePlatforms": [
"Editor"
@@ -24,6 +26,11 @@
"name": "com.unity.ugui",
"expression": "2.0.0",
"define": "TMP_ENABLE"
},
{
"name": "com.unity.timeline",
"expression": "1.0.0",
"define": "TIMELINE_ENABLE"
}
],
"noEngineReferences": false
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3150c4c70d45b46d389368100b181ee4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,183 @@
#if TIMELINE_ENABLE
using System;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.Timeline;
using UnityEngine;
using UnityEngine.Timeline;
namespace Coffee.UIEffects.Timeline
{
public abstract class UIEffectClipEditor : ClipEditor
{
public override void DrawBackground(TimelineClip clip, ClipBackgroundRegion region)
{
var director = TimelineEditor.inspectedDirector;
if (!director) return;
var viewDuration = region.endTime - region.startTime;
var inDuration = (float)Math.Max(clip.easeInDuration, clip.blendInDuration);
var outDuration = (float)Math.Max(clip.easeOutDuration, clip.blendOutDuration);
inDuration = 0 < inDuration ? Mathf.Max(inDuration - (float)region.startTime, 0) : 0f;
outDuration = 0 < outDuration ? Mathf.Max(outDuration - (float)(clip.duration - region.endTime), 0) : 0f;
var p = region.position;
p.x += p.width * (float)(inDuration / viewDuration);
p.width -= p.width * (float)((inDuration + outDuration) / viewDuration);
DrawBackground(p, clip);
}
public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom)
{
clip.displayName = ObjectNames.NicifyVariableName(track.GetType().Name.Replace("Track", ""));
if (clip.asset is UIEffectClip uiEffectClip)
{
uiEffectClip.timelineClip = clip;
}
var floatClip = clip.asset as UIEffectFloatClip;
if (floatClip)
{
if (track is GradationRotationTrack || track is GradationOffsetTrack)
{
floatClip.m_Data.m_From = 0f;
floatClip.m_Data.m_Value = 0f;
}
}
}
protected abstract void DrawBackground(Rect rect, TimelineClip clip);
}
[CustomTimelineEditor(typeof(UIEffectFloatClip))]
public class UIEffectFloatClipEditor : UIEffectClipEditor
{
private static GUIStyle s_FromStyle;
private static GUIStyle s_ToStyle;
protected override void DrawBackground(Rect rect, TimelineClip clip)
{
var asset = clip.asset as UIEffectFloatClip;
if (!asset) return;
if (s_FromStyle == null)
{
s_FromStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.UpperLeft, fontSize = 9 };
s_ToStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.UpperRight, fontSize = 9 };
}
var d = asset.m_Data;
if (d.m_Tween)
{
DrawLabelWithShadow(rect, asset.m_Data.m_From.ToString("F2"), s_FromStyle);
DrawLabelWithShadow(rect, asset.m_Data.m_Value.ToString("F2"), s_ToStyle);
}
else
{
DrawLabelWithShadow(rect, asset.m_Data.m_Value.ToString("F2"), s_FromStyle);
}
}
private static void DrawLabelWithShadow(Rect position, string text, GUIStyle style)
{
GUI.color = Color.black;
EditorGUI.LabelField(position, text, style);
GUI.color = Color.white;
position.x -= 1f;
position.y -= 1f;
EditorGUI.LabelField(position, text, style);
}
}
[CustomTimelineEditor(typeof(UIEffectColorClip))]
public class UIEffectColorClipEditor : UIEffectClipEditor
{
protected override void DrawBackground(Rect p, TimelineClip clip)
{
var asset = clip.asset as UIEffectColorClip;
if (!asset) return;
var d = asset.m_Data;
if (d.m_Tween)
{
EditorGUIUtility.DrawColorSwatch(new Rect(p.x + 2, p.y, 8, 8), d.m_From);
EditorGUIUtility.DrawColorSwatch(new Rect(p.x + p.width - 8, p.y, 8, 8), d.m_Value);
}
else
{
EditorGUIUtility.DrawColorSwatch(new Rect(p.x + 2, p.y, 8, 8), d.m_Value);
}
}
}
[CustomEditor(typeof(UIEffectClip<>), true)]
public class UIEffectClipAssetEditor : Editor
{
private SerializedProperty _tween;
private SerializedProperty _from;
private SerializedProperty _curve;
private SerializedProperty _value;
private FloatClipUsageAttribute _floatUsage;
private ColorClipUsageAttribute _colorUsage;
private GUIContent _label;
private void OnEnable()
{
var data = serializedObject.FindProperty("m_Data");
_tween = data.FindPropertyRelative("m_Tween");
_from = data.FindPropertyRelative("m_From");
_curve = data.FindPropertyRelative("m_Curve");
_value = data.FindPropertyRelative("m_Value");
var clip = target as UIEffectClip;
var type = clip.timelineClip.GetParentTrack().GetType();
_floatUsage = type.GetCustomAttribute<FloatClipUsageAttribute>();
_colorUsage = type.GetCustomAttribute<ColorClipUsageAttribute>();
_label = new GUIContent(ObjectNames.NicifyVariableName(type.Name).Replace(" Track", ""));
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(_tween);
if (_tween.boolValue)
{
EditorGUI.indentLevel++;
DrawProperty(_from, EditorGUIUtility.TrTempContent("From"));
EditorGUILayout.PropertyField(_curve);
EditorGUI.indentLevel--;
}
DrawProperty(_value, _label);
serializedObject.ApplyModifiedProperties();
}
private void DrawProperty(SerializedProperty property, GUIContent label)
{
if (_floatUsage != null)
{
EditorGUILayout.Slider(property, _floatUsage.min, _floatUsage.max, label);
}
else if (property.propertyType == SerializedPropertyType.Color)
{
var hdr = UIEffectProjectSettings.useHdrColorPicker;
var alpha = _colorUsage?.alpha ?? true;
EditorGUI.BeginChangeCheck();
var color = EditorGUILayout.ColorField(label, property.colorValue, true, alpha, hdr);
if (EditorGUI.EndChangeCheck())
{
property.colorValue = color;
}
}
else
{
EditorGUILayout.PropertyField(property, label);
}
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d108727fec4d48d28c1609b01a3a8c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+26 -8
View File
@@ -47,6 +47,7 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _transitionColorGlow;
private SerializedProperty _transitionPatternReverse;
private SerializedProperty _transitionAutoPlaySpeed;
private SerializedProperty _transitionGradient;
private SerializedProperty _targetMode;
private SerializedProperty _targetColor;
@@ -80,6 +81,8 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _gradationOffset;
private SerializedProperty _gradationScale;
private SerializedProperty _gradationRotation;
private SerializedProperty _gradationWrapMode;
private SerializedProperty _gradationReverse;
private SerializedProperty _edgeMode;
private SerializedProperty _edgeWidth;
@@ -101,6 +104,8 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _detailTexSpeed;
private SerializedProperty _flip;
private static GUIContent s_RotationLabel = new GUIContent("* Rotation");
private static GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
protected virtual void OnEnable()
{
@@ -133,6 +138,10 @@ namespace Coffee.UIEffects.Editors
_transitionColorGlow = serializedObject.FindProperty("m_TransitionColorGlow");
_transitionPatternReverse = serializedObject.FindProperty("m_TransitionPatternReverse");
_transitionAutoPlaySpeed = serializedObject.FindProperty("m_TransitionAutoPlaySpeed");
_transitionGradient = serializedObject.FindProperty("m_TransitionGradient");
s_RotationLabel.tooltip = _transitionRotation.tooltip;
s_KeepAspectRatioLabel.tooltip = _transitionKeepAspectRatio.tooltip;
_targetMode = serializedObject.FindProperty("m_TargetMode");
_targetColor = serializedObject.FindProperty("m_TargetColor");
@@ -176,6 +185,8 @@ namespace Coffee.UIEffects.Editors
_gradationOffset = serializedObject.FindProperty("m_GradationOffset");
_gradationScale = serializedObject.FindProperty("m_GradationScale");
_gradationRotation = serializedObject.FindProperty("m_GradationRotation");
_gradationWrapMode = serializedObject.FindProperty("m_GradationWrapMode");
_gradationReverse = serializedObject.FindProperty("m_GradationReverse");
_detailFilter = serializedObject.FindProperty("m_DetailFilter");
_detailIntensity = serializedObject.FindProperty("m_DetailIntensity");
@@ -251,9 +262,8 @@ namespace Coffee.UIEffects.Editors
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUILayout.PropertyField(_transitionRotation, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionRotation, s_RotationLabel);
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUILayout.PropertyField(_transitionReverse, EditorGUIUtility.TrTempContent("Reverse"));
EditorGUI.indentLevel--;
@@ -265,6 +275,11 @@ namespace Coffee.UIEffects.Editors
EditorGUIUtility.TrTempContent("Pattern Reverse"));
DrawColor(_transitionColorFilter, _transitionColor, null);
}
else if (_transitionFilter.intValue == (int)TransitionFilter.Blaze)
{
EditorGUILayout.PropertyField(_transitionWidth);
DrawGradientField(_transitionGradient);
}
else if (2 < _transitionFilter.intValue)
{
EditorGUILayout.PropertyField(_transitionWidth);
@@ -359,7 +374,12 @@ namespace Coffee.UIEffects.Editors
case GradationMode.HorizontalGradient:
case GradationMode.VerticalGradient:
case GradationMode.AngleGradient:
case GradationMode.RadialGradient:
DrawGradientField(_gradationGradient);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_gradationWrapMode, EditorGUIUtility.TrTempContent("Wrap Mode"));
EditorGUILayout.PropertyField(_gradationReverse, EditorGUIUtility.TrTempContent("Reverse"));
EditorGUI.indentLevel--;
break;
case GradationMode.Diagonal:
DrawColorPickerField("Top", _gradationColor1, _gradationColor2);
@@ -387,8 +407,7 @@ namespace Coffee.UIEffects.Editors
EditorGUILayout.PropertyField(_gradationRotation);
}
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUI.indentLevel--;
}
@@ -442,9 +461,8 @@ namespace Coffee.UIEffects.Editors
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUILayout.PropertyField(_transitionRotation, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionRotation, s_RotationLabel);
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
+44 -16
View File
@@ -7,6 +7,7 @@
![](https://img.shields.io/badge/Unity-6000.0+-57b9d3.svg?style=flat&logo=unity)
![](https://img.shields.io/badge/TextMeshPro_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/ShaderGraph_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/Timeline_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/UPR%2FHDPR_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/VR_Support-57b9d3.svg?style=flat)
[![](https://img.shields.io/github/license/mob-sakai/UIEffect.svg)](https://github.com/mob-sakai/UIEffect/blob/main/LICENSE.md)
@@ -20,9 +21,12 @@
## 📝 Description <!-- omit in toc -->
**_"Decorate your UI, simply and powerfully."_**
UIEffect is an open-source package that allows you to intuitively apply rich Unity UI effects directly from the Inspector or via code.
Combine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!
**_"Decorate your UI, simply and powerfully."_**
UIEffect is a powerful, open-source Unity package that transforms your UI with stunning visual effects.
Apply professional-grade filters like grayscale, blur, and dissolve directly from the Inspector—no coding required!
✨ **Perfect for**: Game developers, UI designers, and anyone looking to enhance their Unity UI with minimal effort
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-title.png)
@@ -55,6 +59,7 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
- [Usage with TextMeshPro](#usage-with-textmeshpro)
- [Usage with SoftMaskForUGUI](#usage-with-softmaskforugui)
- [Usage with ShaderGraph](#usage-with-shadergraph)
- [Usage with Timeline](#usage-with-timeline)
- [Runtime/Editor Preset for UIEffect](#runtimeeditor-preset-for-uieffect)
- [Usage with Code](#usage-with-code)
- [Project Settings](#project-settings)
@@ -88,18 +93,18 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
- **v4 compatible components (optional)**: For easy upgrading with minimal changes, compatible v4 components are available optionally.
- **SoftMaskForUGUI support (optional)**: Compatible with SoftMaskForUGUI for creating soft masks for UI elements. See for more details [here](#usage-with-softmaskforugui).
- **ShaderGraph support (optional)**: Add `Canvas (UIEffect)` sub target (material) for UIEffect shaders. See for more details [here](#usage-with-shadergraph).
- **Timeline support**: Control UIEffect using Timeline with `ControlTrack` and `UIEffect Tracks`. See for more details [here](#usage-with-timeline).
<br><br>
## 🎮 Demo
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-available.png)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749461316801.png)
<img src="https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-pattern.gif" width="582"/>
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-showcase.png)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-tmp.png)
[WebGL Demo](https://mob-sakai.github.io/UIEffect/)
[Try the WebGL Demo](https://mob-sakai.github.io/UIEffect/)
<br><br>
@@ -117,7 +122,7 @@ _This package requires **Unity 2020.3 or later**._
```
- To update the package, use Package Manager UI (`Window > Package Manager`) or run the following command with `@{version}`:
```
openupm add com.coffee.ui-effect@5.7.0
openupm add com.coffee.ui-effect@5.9.0
```
### Install via UPM (with Package Manager UI)
@@ -126,7 +131,7 @@ _This package requires **Unity 2020.3 or later**._
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/UIEffect.git?path=Packages/src`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/upm-add-from-url.png)
- To update the package, change suffix `#{version}` to the target version.
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.7.0`
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.9.0`
### Install via UPM (Manually)
@@ -141,7 +146,7 @@ _This package requires **Unity 2020.3 or later**._
```
- To update the package, change suffix `#{version}` to the target version.
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.7.0",`
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.9.0",`
### Install as Embedded Package
@@ -198,10 +203,17 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
2. Add a `UIEffect` component to a UI element (Image, RawImage, Text, TextMeshProUGUI, etc...) from the `Add Component` in the inspector or `Component > UI > UIEffect` menu.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-add-component.png)
3. Adjust the effect filters and parameters in the inspector.
3. Set `Tone Filter` to `Grayscale` and `Tone Intensity` to `1.0`.
<img src="https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749029605043.png" width="480"/>
4. Try other effect filters and parameters in the inspector.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744308178360.gif)
4. From the top menu, you can load/append preset.
5. From the top menu, you can load/append preset.
> [!TIP]
> `Load` overwrites all properties with the preset, while `Append` only overwrites enabled filters and modes with the preset.
> You can easily build effects by combining them with `Append`.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744800851739.gif)
5. Enjoy!
@@ -256,8 +268,8 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-transition.png)
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`, `Pattern`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-transition.png)
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`, `Blaze`, `Pattern`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749466907712.gif)
- **Transition Rate**: 0.0 (no effect) - 1.0 (full effect).
- **Transition Tex**: The texture used for the transition filter.
- **Scale**, **Offset**, **Speed**, **Rotation**, **Keep Aspect Ratio**, **Reverse**: Additional properties for the texture.
@@ -271,6 +283,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
- **Transition Color**: The color of the transition.
- **Transition Color Glow**: Set the transition color to glow.
- **Transition Auto Play Speed**: The speed of the transition animation (using shader side `_Time`). You can use this property to loop the `TransitionRate` without tweener or animation.
- ⚠️ NOTE: This uses scaled time (affected by `Time.timeScale`). If you need unscaled time (useful for pause-resistant effects), use the [UIEffectTweener](#component-uieffecttweener) component instead.
> [!TIP]
> **Transition Tex** applies transitions using its alpha channel.
@@ -325,10 +338,10 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305109784.png)
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-gradation.png)
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749461050342.png)
- **Gradation Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`
- **Gradation Gradient**: The gradient of the gradation.
- **Gradation Gradient**: The gradient of the gradation. HDR colors are supported.
- `Blend` and `Fixed` modes are available.
- **Gradation Color 1**: The first color of the gradation.
- **Gradation Color 2**: The second color of the gradation.
@@ -336,6 +349,8 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
- **Gradation Offset**: The offset of the gradation range.
- **Gradation Scale**: The scale of the gradation range.
- **Gradation Rotation** (`Angle` or `AngleGradient` only): The rotation of the gradation range.
- **Gradation Wrap Mode**: `Repaet`, `Clamp`, `Mirror`, `Mirror Once`
- **Gradation Reverse**: Reverse the gradient.
- **Keep Aspect Ratio**:
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
@@ -353,6 +368,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
- **Edge Color Glow**: Set the shadow color to glow.
- **Edge Shiny Width**: The width of the edge shiny.
- **Edge Shiny Auto Play Speed**: The speed of the edge shiny (using shader side `_Time`).
- ⚠️ NOTE: This uses scaled time (affected by `Time.timeScale`). If you need unscaled time (useful for pause-resistant effects), use the [UIEffectTweener](#component-uieffecttweener) component instead.
<br>
@@ -515,6 +531,18 @@ To use UIEffect with ShaderGraph, you need to import additional resources.
<br><br>
### Usage with Timeline
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749028017092.png)
Timeline is a powerful animation tool that can control UIEffect using `ControlTrack` and UIEffect tracks.
- `Control Track`: One of the built-in tracks. When you assign a GameObject with `UIEffect`, `UIEffect` will be enabled during the clip duration.
- `UIEffect Tracks`: Tracks for UIEffect. They control `float` or `Color` type properties.
- Supports blending, extrapolation, and tween.
<br><br>
### Runtime/Editor Preset for UIEffect
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-preset.png)
+12 -1
View File
@@ -2,7 +2,8 @@
"name": "Coffee.UIEffect",
"rootNamespace": "",
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f"
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:f06555f75b070af458a003d92f9efb00"
],
"includePlatforms": [],
"excludePlatforms": [],
@@ -21,6 +22,16 @@
"name": "com.unity.ugui",
"expression": "2.0.0",
"define": "TMP_ENABLE"
},
{
"name": "com.unity.timeline",
"expression": "1.0.0",
"define": "TIMELINE_ENABLE"
},
{
"name": "com.unity.textmeshpro",
"expression": "[1.0.0,3.2.0-pre.1)",
"define": "LEGACY_TMP_ENABLE"
}
],
"noEngineReferences": false
+7
View File
@@ -59,6 +59,7 @@ namespace Coffee.UIEffects
Mask = 5,
Melt = 6,
Burn = 7,
Blaze = 9,
Pattern = 8
}
@@ -110,8 +111,14 @@ namespace Coffee.UIEffects
HorizontalGradient = 2,
Vertical = 3,
VerticalGradient = 4,
Radial = 5,
[Obsolete]
RadialFast = 5,
[Obsolete]
RadialDetail = 6,
RadialGradient = 12,
Diagonal = 11,
DiagonalToRightBottom = 7,
DiagonalToLeftBottom = 8,
@@ -20,16 +20,18 @@ namespace Coffee.UIEffectInternal
UpdateTmpCgincPath();
}
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
private static void OnPostprocessAllAssets(string[] imported, string[] __, string[] ___, string[] ____)
{
UpdateTmpCgincPath();
if (imported.Any(x => x.EndsWith(".cginc") || x.EndsWith(".shader")))
{
UpdateTmpCgincPath();
}
}
private static void UpdateTmpCgincPath()
{
if (s_CgincPattern == null || s_ShaderNames == null || s_ShaderNames.Length == 0) return;
AssetDatabase.StartAssetEditing();
string[] cgincs = null;
foreach (var shaderName in s_ShaderNames)
{
@@ -47,8 +49,6 @@ namespace Coffee.UIEffectInternal
UpdateTmpCgincPath(shader, cgincs);
}
AssetDatabase.StopAssetEditing();
}
private static void UpdateTmpCgincPath(Shader shader, string[] cgincs)
@@ -282,7 +282,7 @@ namespace Coffee.UIEffectInternal
_errorOnUnregisteredVariant = property.FindPropertyRelative("m_ErrorOnUnregisteredVariant");
_asset = property.FindPropertyRelative("m_Asset");
_rlOptionalShaders = new ReorderableList(so, optionalShaders, false, true, true, true);
_rlOptionalShaders = new ReorderableList(so, optionalShaders, true, true, true, true);
_rlOptionalShaders.drawHeaderCallback = rect =>
{
var rLabel = new Rect(rect.x, rect.y, rect.width - 80, rect.height);
@@ -302,12 +302,10 @@ namespace Coffee.UIEffectInternal
optionalShaders.ClearArray();
}
};
_rlOptionalShaders.elementHeightCallback = _ => _expandOptionalShaders
? EditorGUIUtility.singleLineHeight * 2 + 4
: 0;
_rlOptionalShaders.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
_rlOptionalShaders.drawElementCallback = (r, index, isActive, isFocused) =>
{
if (optionalShaders.arraySize <= index || !_expandOptionalShaders) return;
if (optionalShaders.arraySize <= index) return;
var element = optionalShaders.GetArrayElementAtIndex(index);
if (element == null) return;
@@ -322,7 +320,7 @@ namespace Coffee.UIEffectInternal
}
var rArrow = new Rect(r.x, r.y + h + 4, 20, h);
EditorGUI.LabelField(rArrow, "->");
EditorGUI.LabelField(rArrow, GUIContent.none, "ArrowNavigationRight");
var rValue = new Rect(r.x + 20, r.y + h + 4, r.width - 20, h);
if (GUI.Button(rValue, value.stringValue, EditorStyles.popup))
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3278a8b3cb92d4cc69862f0d45f150ad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 014b76346c11643a89303ed3b5681733
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,44 @@
#if TIMELINE_ENABLE
using System;
using System.ComponentModel;
using UnityEngine;
namespace Coffee.UIEffects.Timeline
{
[DisplayName("Clip")]
public class UIEffectColorClip : UIEffectClip<UIEffectColorBehaviour>
{
}
[Serializable]
public class UIEffectColorBehaviour : UIEffectBehaviour, IGetValue<Color>
{
[ColorUsage(true, true)]
public Color m_Value = Color.white;
[ColorUsage(true, true)]
public Color m_From = Color.white;
public Color Get(float time)
{
return m_Tween
? Color.Lerp(m_From, m_Value, m_Curve.Evaluate(time))
: m_Value;
}
}
public abstract class UIEffectColorMixerBehaviour : UIEffectMixerBehaviour<Color, UIEffectColorBehaviour>
{
protected override Color Add(Color baseValue, Color value, float weight)
{
return baseValue + value * weight;
}
protected override Color Lerp(Color defaultValue, Color value, float weight)
{
return Color.Lerp(defaultValue, value, weight);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c402544dc0be48afa6e9d3eb88120be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
#if TIMELINE_ENABLE
using System;
using System.ComponentModel;
using UnityEngine;
namespace Coffee.UIEffects.Timeline
{
[DisplayName("Clip")]
public class UIEffectFloatClip : UIEffectClip<UIEffectFloatBehaviour>
{
}
[Serializable]
public class UIEffectFloatBehaviour : UIEffectBehaviour, IGetValue<float>
{
public float m_Value = 1;
public float m_From = 1;
public float Get(float time)
{
return m_Tween
? Mathf.Lerp(m_From, m_Value, m_Curve.Evaluate(time))
: m_Value;
}
}
public abstract class UIEffectFloatMixerBehaviour : UIEffectMixerBehaviour<float, UIEffectFloatBehaviour>
{
protected override float Add(float baseValue, float value, float weight)
{
return baseValue + value * weight;
}
protected override float Lerp(float defaultValue, float value, float weight)
{
return Mathf.Lerp(defaultValue, value, weight);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ffaa25511fc8148839e36bda4414e944
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,177 @@
#if TIMELINE_ENABLE
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Coffee.UIEffects.Timeline
{
[AttributeUsage(AttributeTargets.Class)]
public class FloatClipUsageAttribute : PropertyAttribute
{
public readonly float min;
public readonly float max;
public readonly float defaultValue;
public FloatClipUsageAttribute(float min, float max, float defaultValue = 0f)
{
this.min = min;
this.max = max;
this.defaultValue = defaultValue;
}
}
[AttributeUsage(AttributeTargets.Class)]
public class ColorClipUsageAttribute : PropertyAttribute
{
public readonly bool alpha;
public ColorClipUsageAttribute(bool alpha)
{
this.alpha = alpha;
}
}
public interface IGetValue<out T>
{
T Get(float time);
}
[TrackColor(0.92f, 0.54f, 0.17f)]
[TrackBindingType(typeof(UIEffect), TrackBindingFlags.AllowCreateComponent)]
public abstract class UIEffectTrack<T> : TrackAsset
where T : PlayableBehaviour, new()
{
protected abstract string fieldName { get; }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
{
var playable = ScriptPlayable<T>.Create(graph, inputCount);
foreach (var timelineClip in GetClips())
{
if (timelineClip.asset is UIEffectClip clip)
{
clip.timelineClip = timelineClip;
}
}
return playable;
}
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
{
var trackBinding = director.GetGenericBinding(this) as UIEffect;
if (!trackBinding) return;
driver.AddFromName<UIEffect>(trackBinding.gameObject, fieldName);
base.GatherProperties(director, driver);
}
}
public abstract class UIEffectClip : PlayableAsset, ITimelineClipAsset
{
public TimelineClip timelineClip { get; set; }
public ClipCaps clipCaps => ClipCaps.Blending | ClipCaps.Extrapolation;
private void OnValidate()
{
}
}
public abstract class UIEffectClip<T> : UIEffectClip
where T : UIEffectBehaviour, new()
{
[NotKeyable]
[SerializeField]
public T m_Data = new T();
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
{
var playable = ScriptPlayable<T>.Create(graph, m_Data);
var behaviour = playable.GetBehaviour();
behaviour.clip = this;
return playable;
}
}
[Serializable]
public abstract class UIEffectBehaviour : PlayableBehaviour
{
public bool m_Tween;
public AnimationCurve m_Curve = AnimationCurve.Linear(0, 0, 1, 1);
public UIEffectClip clip { get; set; }
}
public abstract class UIEffectMixerBehaviour<T, TBehavior> : PlayableBehaviour
where TBehavior : UIEffectBehaviour, IGetValue<T>, new()
{
private T _defaultValue;
protected abstract T currentValue { get; set; }
protected UIEffect effect { get; private set; }
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
{
InitializeIfNeeded(playerData as UIEffect);
if (!effect) return;
var inputCount = playable.GetInputCount();
var value = default(T);
var totalWeight = GetTotalWeight(playable);
for (var i = 0; i < inputCount; i++)
{
var weight = playable.GetInputWeight(i);
if (weight <= 0) continue;
var playableInput = (ScriptPlayable<TBehavior>)playable.GetInput(i);
var input = playableInput.GetBehaviour();
var normalizedTime = (float)(playableInput.GetTime() / input.clip.timelineClip.duration);
value = Add(value, input.Get(normalizedTime), weight / totalWeight);
totalWeight += weight;
}
currentValue = Lerp(_defaultValue, value, totalWeight);
}
public override void OnPlayableDestroy(Playable playable)
{
if (effect)
{
currentValue = _defaultValue;
}
}
private static float GetTotalWeight(Playable playable)
{
var totalWeight = 0f;
var inputCount = playable.GetInputCount();
for (var i = 0; i < inputCount; i++)
{
totalWeight += playable.GetInputWeight(i);
}
return totalWeight;
}
private void InitializeIfNeeded(UIEffect newEffect)
{
if (effect == newEffect) return;
if (effect)
{
currentValue = _defaultValue;
}
effect = newEffect;
_defaultValue = newEffect ? currentValue : default;
}
protected abstract T Add(T current, T value, float weight);
protected abstract T Lerp(T defaultValue, T value, float weight);
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a54d6ecf5bae485db4b0df376bebc35
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Color Intensity Track")]
public class ColorIntensityTrack : UIEffectTrack<ColorIntensityMixer>
{
protected override string fieldName => "m_ColorIntensity";
}
public class ColorIntensityMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.colorIntensity;
set => effect.colorIntensity = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 66d61d709d31c4220bc59365f78584ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[ColorClipUsage(false)]
[TrackClipType(typeof(UIEffectColorClip))]
[DisplayName("UIEffect Tracks/Color Track")]
public class ColorTrack : UIEffectTrack<ColorMixer>
{
protected override string fieldName => "m_Color";
}
public class ColorMixer : UIEffectColorMixerBehaviour
{
protected override Color currentValue
{
get => effect.color;
set => effect.color = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: edfa6dc975b3446d8bc2cf6ca1fdd40f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[ColorClipUsage(true)]
[TrackClipType(typeof(UIEffectColorClip))]
[DisplayName("UIEffect Tracks/Detail Color Track")]
public class DetailColorTrack : UIEffectTrack<DetailColorMixer>
{
protected override string fieldName => "m_DetailColor";
}
public class DetailColorMixer : UIEffectColorMixerBehaviour
{
protected override Color currentValue
{
get => effect.detailColor;
set => effect.detailColor = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88051c9178d704e47a12db836b6343c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Detail Intensity Track")]
public class DetailIntensityTrack : UIEffectTrack<DetailIntensityMixer>
{
protected override string fieldName => "m_DetailIntensity";
}
public class DetailIntensityMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.detailIntensity;
set => effect.detailIntensity = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e901a5dfc37104d2182dcc49fe370305
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[ColorClipUsage(true)]
[TrackClipType(typeof(UIEffectColorClip))]
[DisplayName("UIEffect Tracks/Detail Color Track")]
public class EdgeColorTrack : UIEffectTrack<EdgeColorMixer>
{
protected override string fieldName => "m_EdgeColor";
}
public class EdgeColorMixer : UIEffectColorMixerBehaviour
{
protected override Color currentValue
{
get => effect.edgeColor;
set => effect.edgeColor = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f78a05c2255e94329a1b7bd465ac8f8a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Edge Shiny Rate Track")]
public class EdgeShinyRateTrack : UIEffectTrack<EdgeShinyRateMixer>
{
protected override string fieldName => "m_EdgeShinyRate";
}
public class EdgeShinyRateMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.edgeShinyRate;
set => effect.edgeShinyRate = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 118c294bc3dfa4e7a96de50b410ad846
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Gradation Intensity Track")]
public class GradationIntensityTrack : UIEffectTrack<GradationIntensityMixer>
{
protected override string fieldName => "m_GradationIntensity";
}
public class GradationIntensityMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.gradationIntensity;
set => effect.gradationIntensity = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7b4c7c51d8c8c4d9ebfacb4ec8e7f73e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Gradation Offset Track")]
public class GradationOffsetTrack : UIEffectTrack<GradationOffsetMixer>
{
protected override string fieldName => "m_GradationOffset";
}
public class GradationOffsetMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.gradationOffset;
set => effect.gradationOffset = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: deb67c01293914e41a70a7570c3a539e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Gradation Rotation Track")]
public class GradationRotationTrack : UIEffectTrack<GradationRotationMixer>
{
protected override string fieldName => "m_GradationRotation";
}
public class GradationRotationMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.gradationRotation;
set => effect.gradationRotation = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb2c49df5c5af40d189179c70f3f4e8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0.01f, 10f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Gradation Scale Track")]
public class GradationScaleTrack : UIEffectTrack<GradationScaleMixer>
{
protected override string fieldName => "m_GradationScale";
}
public class GradationScaleMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.gradationScale;
set => effect.gradationScale = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0e9a4fc9655b64a399feaf134500daad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Sampling Intensity Track")]
public class SamplingIntensityTrack : UIEffectTrack<SamplingIntensityMixer>
{
protected override string fieldName => "m_SamplingIntensity";
}
public class SamplingIntensityMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.samplingIntensity;
set => effect.samplingIntensity = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ae43eda84464f470db063babd75d86ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Tone Intensity Track")]
public class ToneIntensityTrack : UIEffectTrack<ToneIntensityMixer>
{
protected override string fieldName => "m_ToneIntensity";
}
public class ToneIntensityMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.toneIntensity;
set => effect.toneIntensity = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c08d90226dd3d48c7b26e4148a627c30
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[ColorClipUsage(true)]
[TrackClipType(typeof(UIEffectColorClip))]
[DisplayName("UIEffect Tracks/Transition Color Track")]
public class TransitionColorTrack : UIEffectTrack<TransitionColorMixer>
{
protected override string fieldName => "m_TransitionColor";
}
public class TransitionColorMixer : UIEffectColorMixerBehaviour
{
protected override Color currentValue
{
get => effect.transitionColor;
set => effect.transitionColor = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6cbbddc14d5744997a755e56c474a436
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
#if TIMELINE_ENABLE
using System.ComponentModel;
using UnityEngine.Timeline;
using Coffee.UIEffects.Timeline;
namespace Coffee.UIEffects
{
[FloatClipUsage(0f, 1f)]
[TrackClipType(typeof(UIEffectFloatClip))]
[DisplayName("UIEffect Tracks/Transition Rate Track")]
public class TransitionRateTrack : UIEffectTrack<TransitionRateMixer>
{
protected override string fieldName => "m_TransitionRate";
}
public class TransitionRateMixer : UIEffectFloatMixerBehaviour
{
protected override float currentValue
{
get => effect.transitionRate;
set => effect.transitionRate = value;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 97f54e7d118464cd099026c08294dc29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+124 -2
View File
@@ -69,10 +69,14 @@ namespace Coffee.UIEffects
[SerializeField]
protected Vector2 m_TransitionTexSpeed = new Vector2(0, 0);
[Tooltip("Effect rotation (0–360).\n" +
"NOTE: This property is shared between `Transition Filter` and `Detail Filter`.")]
[SerializeField]
[Range(0, 360)]
private float m_TransitionRotation = 0;
[Tooltip("The effect maintains its aspect ratio.\n" +
"NOTE: This property is shared between `Transition Filter`, `Gradation Mode`, and `Detail Filter`.")]
[SerializeField]
protected bool m_TransitionKeepAspectRatio = true;
@@ -103,6 +107,9 @@ namespace Coffee.UIEffects
[SerializeField]
protected float m_TransitionAutoPlaySpeed = 0f;
[SerializeField]
private Gradient m_TransitionGradient = new Gradient();
[SerializeField]
protected TargetMode m_TargetMode = TargetMode.None;
@@ -194,6 +201,12 @@ namespace Coffee.UIEffects
[Range(0, 360)]
private float m_GradationRotation = 0;
[SerializeField]
protected TextureWrapMode m_GradationWrapMode = TextureWrapMode.Repeat;
[SerializeField]
protected bool m_GradationReverse = false;
[SerializeField]
protected bool m_AllowToModifyMeshShape = true;
@@ -1259,6 +1272,7 @@ namespace Coffee.UIEffects
get => m_GradationScale;
set
{
value = Mathf.Clamp(value, 0.01f, 10f);
if (Mathf.Approximately(m_GradationScale, value)) return;
context.m_GradationScale = m_GradationScale = value;
SetMaterialDirty();
@@ -1276,6 +1290,30 @@ namespace Coffee.UIEffects
}
}
public TextureWrapMode gradationWrapMode
{
get => m_GradationWrapMode;
set
{
if (m_GradationWrapMode == value) return;
context.m_GradationWrapMode = m_GradationWrapMode = value;
context.SetGradationDirty();
SetMaterialDirty();
}
}
public bool gradationReverse
{
get => m_GradationReverse;
set
{
if (m_GradationReverse == value) return;
context.m_GradationReverse = m_GradationReverse = value;
context.SetGradationDirty();
SetMaterialDirty();
}
}
public DetailFilter detailFilter
{
get => m_DetailFilter;
@@ -1393,13 +1431,13 @@ namespace Coffee.UIEffects
set => m_CustomRoot = value;
}
public override Flip flip
public Flip flip
{
get => m_Flip;
set
{
if (m_Flip == value) return;
m_Flip = value;
context.m_Flip = m_Flip = value;
SetVerticesDirty();
}
}
@@ -1434,6 +1472,7 @@ namespace Coffee.UIEffects
{
(m_SrcBlendMode, m_DstBlendMode) = (m_BlendType, m_SrcBlendMode, m_DstBlendMode).Convert();
context?.SetGradationDirty();
context?.SetTransitionGradationDirty();
base.OnValidate();
}
@@ -1480,6 +1519,36 @@ namespace Coffee.UIEffects
SetGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
}
/// <summary>
/// Get gradation gradient's keys.
/// </summary>
public void GetGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys,
out GradientMode mode)
{
colorKeys = m_GradationGradient?.colorKeys ?? Array.Empty<GradientColorKey>();
alphaKeys = m_GradationGradient?.alphaKeys ?? Array.Empty<GradientAlphaKey>();
mode = m_GradationGradient?.mode ?? GradientMode.Blend;
}
/// <summary>
/// Set transition gradient's keys.
/// </summary>
public void SetTransitionGradientKeys(Gradient gradient)
{
SetTransitionGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
}
/// <summary>
/// Get transition gradation gradient's keys.
/// </summary>
public void GetTransitionGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys,
out GradientMode mode)
{
colorKeys = m_TransitionGradient?.colorKeys ?? Array.Empty<GradientColorKey>();
alphaKeys = m_TransitionGradient?.alphaKeys ?? Array.Empty<GradientAlphaKey>();
mode = m_TransitionGradient?.mode ?? GradientMode.Blend;
}
/// <summary>
/// Set gradation gradient's keys.
/// </summary>
@@ -1493,6 +1562,19 @@ namespace Coffee.UIEffects
SetMaterialDirty();
}
/// <summary>
/// Set transition gradient's keys.
/// </summary>
public void SetTransitionGradientKeys(GradientColorKey[] colorKeys, GradientAlphaKey[] alphaKeys,
GradientMode mode = GradientMode.Blend)
{
m_TransitionGradient ??= new Gradient();
m_TransitionGradient.SetKeys(colorKeys, alphaKeys);
m_TransitionGradient.mode = mode;
context?.SetTransitionGradationDirty();
SetMaterialDirty();
}
public override void ApplyContextToMaterial(Material material)
{
base.ApplyContextToMaterial(material);
@@ -1557,6 +1639,15 @@ namespace Coffee.UIEffects
}
}
public void Clear()
{
m_SamplingScale = 1;
m_AllowToModifyMeshShape = true;
m_CustomRoot = null;
LoadPreset(UIEffectPreset.GetDefaultPreset());
}
/// <summary>
/// Load preset settings.
/// </summary>
@@ -1645,6 +1736,7 @@ namespace Coffee.UIEffects
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.SetTransitionGradientKeys(src.m_TransitionGradient);
}
if (!append || src.m_TargetMode != TargetMode.None)
@@ -1701,6 +1793,8 @@ namespace Coffee.UIEffects
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_GradationWrapMode = src.m_GradationWrapMode;
dst.m_GradationReverse = src.m_GradationReverse;
}
if (!append || src.m_DetailFilter != DetailFilter.None)
@@ -1714,6 +1808,11 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
}
if (!append || src.m_Flip != 0)
{
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
}
Misc.SetDirty(dst);
UpdateContext(context);
SetVerticesDirty();
@@ -1768,6 +1867,7 @@ namespace Coffee.UIEffects
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.SetTransitionGradientKeys(src.m_TransitionGradient);
}
if (!append || src.m_TargetMode != TargetMode.None)
@@ -1824,6 +1924,8 @@ namespace Coffee.UIEffects
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_GradationWrapMode = src.m_GradationWrapMode;
dst.m_GradationReverse = src.m_GradationReverse;
}
if (!append || src.m_DetailFilter != DetailFilter.None)
@@ -1838,6 +1940,11 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
}
if (!append || src.m_Flip != 0)
{
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
}
Misc.SetDirty(dst);
UpdateContext(context);
SetVerticesDirty();
@@ -1889,6 +1996,9 @@ namespace Coffee.UIEffects
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.m_TransitionGradient.SetKeys(src.m_TransitionGradient.colorKeys,
src.m_TransitionGradient.alphaKeys);
dst.m_TransitionGradient.mode = src.m_TransitionGradient.mode;
}
if (!append || src.m_TargetMode != TargetMode.None)
@@ -1946,6 +2056,8 @@ namespace Coffee.UIEffects
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_GradationWrapMode = src.m_GradationWrapMode;
dst.m_GradationReverse = src.m_GradationReverse;
}
if (!append || src.m_DetailFilter != DetailFilter.None)
@@ -1960,6 +2072,11 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
}
if (!append || src.m_Flip != 0)
{
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
}
Misc.SetDirty(dst);
}
@@ -1995,6 +2112,7 @@ namespace Coffee.UIEffects
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.m_TransitionGradient = src.m_TransitionGradient;
dst.m_TargetMode = src.m_TargetMode;
dst.m_TargetColor = src.m_TargetColor;
@@ -2035,6 +2153,8 @@ namespace Coffee.UIEffects
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_GradationWrapMode = src.m_GradationWrapMode;
dst.m_GradationReverse = src.m_GradationReverse;
dst.m_DetailFilter = src.m_DetailFilter;
dst.m_DetailIntensity = src.m_DetailIntensity;
@@ -2044,6 +2164,8 @@ namespace Coffee.UIEffects
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
}
}
+34 -9
View File
@@ -6,6 +6,9 @@ using UnityEngine.EventSystems;
using UnityEngine.Profiling;
using UnityEngine.UI;
using UnityEditor;
#if TIMELINE_ENABLE
using UnityEngine.Timeline;
#endif
[assembly: InternalsVisibleTo("UIEffect")]
[assembly: InternalsVisibleTo("Coffee.UIEffect.Editor")]
@@ -15,6 +18,9 @@ namespace Coffee.UIEffects
[ExecuteAlways]
[DisallowMultipleComponent]
public abstract class UIEffectBase : UIBehaviour, IMeshModifier, IMaterialModifier, ICanvasRaycastFilter
#if TIMELINE_ENABLE
, ITimeControl
#endif
{
private static readonly InternalObjectPool<UIEffectContext> s_ContextPool =
new InternalObjectPool<UIEffectContext>(() => new UIEffectContext(), x => true, x => x.Reset());
@@ -62,14 +68,9 @@ namespace Coffee.UIEffects
public virtual RectTransform transitionRoot => transform as RectTransform;
public virtual Flip flip
{
get => 0;
set { }
}
protected override void OnEnable()
{
_canModifyMesh = true;
_onBeforeCanvasRebuild ??= OnBeforeCanvasRebuild;
_onAfterCanvasRebuild ??= OnAfterCanvasRebuild;
UIExtraCallbacks.onBeforeCanvasRebuild += _onBeforeCanvasRebuild;
@@ -105,17 +106,19 @@ namespace Coffee.UIEffects
protected virtual void OnBeforeCanvasRebuild()
{
// If the mesh is not modified in the previous frame, try to modify it if possible.
if (!_canModifyMesh && CanModifyMesh())
{
_canModifyMesh = true;
SetVerticesDirty();
}
}
protected virtual void OnAfterCanvasRebuild()
{
if (!_material || !graphic || context == null) return;
if (!_material || !graphic || !graphic.canvas || context == null) return;
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, graphic.canvas.rootCanvas, flip);
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, graphic.canvas.rootCanvas);
}
public void ModifyMesh(Mesh mesh)
@@ -129,12 +132,14 @@ namespace Coffee.UIEffects
_canModifyMesh = CanModifyMesh();
if (_canModifyMesh)
{
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape, flip);
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape);
}
}
private bool CanModifyMesh()
{
if (!graphic || !graphic.isActiveAndEnabled) return false;
// The transitionRoot is same as the transform => true.
var root = transitionRoot;
if (transform == root) return true;
@@ -255,5 +260,25 @@ namespace Coffee.UIEffects
public abstract void SetRate(float rate, UIEffectTweener.CullingMask cullingMask);
public abstract bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera);
public void SetTime(double _)
{
}
public void OnControlTimeStart()
{
if (this)
{
enabled = true;
}
}
public void OnControlTimeStop()
{
if (this)
{
enabled = false;
}
}
}
}
+103 -33
View File
@@ -35,6 +35,7 @@ namespace Coffee.UIEffects
private static readonly int s_TransitionColorGlow = Shader.PropertyToID("_TransitionColorGlow");
private static readonly int s_TransitionPatternReverse = Shader.PropertyToID("_TransitionPatternReverse");
private static readonly int s_TransitionAutoPlaySpeed = Shader.PropertyToID("_TransitionAutoPlaySpeed");
private static readonly int s_TransitionGradientTex = Shader.PropertyToID("_TransitionGradientTex");
private static readonly int s_TargetColor = Shader.PropertyToID("_TargetColor");
private static readonly int s_TargetRange = Shader.PropertyToID("_TargetRange");
private static readonly int s_TargetSoftness = Shader.PropertyToID("_TargetSoftness");
@@ -64,6 +65,7 @@ namespace Coffee.UIEffects
private static readonly int s_GradationColor4 = Shader.PropertyToID("_GradationColor4");
private static readonly int s_GradationTex = Shader.PropertyToID("_GradationTex");
private static readonly int s_GradationTex_ST = Shader.PropertyToID("_GradationTex_ST");
private static readonly int s_GradationRadial = Shader.PropertyToID("_GradationRadial");
private static readonly int s_RootViewMatrix = Shader.PropertyToID("_RootViewMatrix");
private static readonly int s_GradViewMatrix = Shader.PropertyToID("_GradViewMatrix");
private static readonly int s_MirrorRootViewMatrix = Shader.PropertyToID("_MirrorRootViewMatrix");
@@ -108,7 +110,8 @@ namespace Coffee.UIEffects
"TRANSITION_MASK",
"TRANSITION_MELT",
"TRANSITION_BURN",
"TRANSITION_PATTERN"
"TRANSITION_PATTERN",
"TRANSITION_BLAZE"
};
private static readonly string[] s_TargetKeywords =
@@ -140,7 +143,6 @@ namespace Coffee.UIEffects
{
"",
"GRADATION_GRADIENT",
"GRADATION_RADIAL",
"GRADATION_COLOR2",
"GRADATION_COLOR4"
};
@@ -188,6 +190,7 @@ namespace Coffee.UIEffects
public bool m_TransitionColorGlow;
public bool m_TransitionPatternReverse;
public float m_TransitionAutoPlaySpeed;
public Gradient m_TransitionGradient;
public TargetMode m_TargetMode;
public Color m_TargetColor;
@@ -228,6 +231,8 @@ namespace Coffee.UIEffects
public float m_GradationOffset;
public float m_GradationScale;
public float m_GradationRotation;
public TextureWrapMode m_GradationWrapMode;
public bool m_GradationReverse;
public DetailFilter m_DetailFilter;
public float m_DetailIntensity;
@@ -238,6 +243,8 @@ namespace Coffee.UIEffects
public Vector2 m_DetailTexOffset;
public Vector2 m_DetailTexSpeed;
public Flip m_Flip;
public bool willModifyMaterial => m_ToneFilter != ToneFilter.None
|| m_ColorFilter != ColorFilter.None
|| m_SamplingFilter != SamplingFilter.None
@@ -252,13 +259,15 @@ namespace Coffee.UIEffects
public bool willModifyVertex => willModifyMaterial;
private Texture2D _gradationRampTex;
private Texture2D _transitionRampTex;
private bool _isGradientDirty = true;
private static readonly Color32[] s_Colors = new Color32[256];
private bool _isTransitionGradientDirty = true;
private static readonly Color[] s_Colors = new Color[256];
private static readonly InternalObjectPool<Texture2D> s_TexturePool = new InternalObjectPool<Texture2D>(
() =>
{
var texture = new Texture2D(s_Colors.Length, 1, TextureFormat.RGBA32, false, false)
var texture = new Texture2D(s_Colors.Length, 1, TextureFormat.RGBAFloat, false, false)
{
name = "GradationRamp",
hideFlags = HideFlags.DontSave,
@@ -283,22 +292,55 @@ namespace Coffee.UIEffects
var w = s_Colors.Length;
for (var i = 0; i < w; i++)
{
s_Colors[i] = m_GradationGradient.Evaluate((float)i / (w - 1));
var x = m_GradationReverse ? w - 1 - i : i;
var t = (float)i / (w - 1);
s_Colors[x] = ApplyColorSpace(m_GradationGradient.Evaluate(t));
}
_gradationRampTex.wrapMode = m_GradationWrapMode;
_gradationRampTex.filterMode = m_GradationGradient.mode == GradientMode.Blend
? FilterMode.Bilinear
: FilterMode.Point;
_gradationRampTex.SetPixels32(s_Colors);
_gradationRampTex.SetPixels(s_Colors);
_gradationRampTex.Apply();
return _gradationRampTex;
}
}
private Texture2D transitionRampTex
{
get
{
if (m_TransitionGradient == null) return null;
if (!_transitionRampTex) _transitionRampTex = s_TexturePool.Rent();
if (!_isTransitionGradientDirty) return _transitionRampTex;
_isTransitionGradientDirty = false;
var w = s_Colors.Length;
for (var i = 0; i < w; i++)
{
var t = (float)i / (w - 1);
s_Colors[i] = ApplyColorSpace(m_TransitionGradient.Evaluate(t));
}
s_Colors[w - 1].a = 0;
_transitionRampTex.wrapMode = TextureWrapMode.Clamp;
_transitionRampTex.filterMode = m_TransitionGradient.mode == GradientMode.Blend
? FilterMode.Bilinear
: FilterMode.Point;
_transitionRampTex.SetPixels(s_Colors);
_transitionRampTex.Apply();
return _transitionRampTex;
}
}
public void Reset()
{
_isGradientDirty = true;
_isTransitionGradientDirty = true;
s_TexturePool.Return(ref _gradationRampTex);
s_TexturePool.Return(ref _transitionRampTex);
CopyFrom(s_DefaultContext);
}
@@ -334,6 +376,7 @@ namespace Coffee.UIEffects
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.m_TransitionGradient = src.m_TransitionGradient;
dst.m_TargetMode = src.m_TargetMode;
dst.m_TargetColor = src.m_TargetColor;
@@ -374,6 +417,8 @@ namespace Coffee.UIEffects
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_GradationWrapMode = src.m_GradationWrapMode;
dst.m_GradationReverse = src.m_GradationReverse;
dst.m_DetailFilter = src.m_DetailFilter;
dst.m_DetailIntensity = src.m_DetailIntensity;
@@ -383,6 +428,8 @@ namespace Coffee.UIEffects
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
public void SetGradationDirty()
@@ -390,6 +437,11 @@ namespace Coffee.UIEffects
_isGradientDirty = true;
}
public void SetTransitionGradationDirty()
{
_isTransitionGradientDirty = true;
}
public void ApplyToMaterial(Material material, float actualSamplingScale = 1f)
{
if (!material) return;
@@ -402,7 +454,7 @@ namespace Coffee.UIEffects
material.SetFloat(s_ToneIntensity, Mathf.Clamp01(m_ToneIntensity));
material.SetInt(s_ColorFilter, (int)m_ColorFilter);
material.SetColor(s_ColorValue, m_Color);
material.SetColor(s_ColorValue, ApplyColorSpace(m_Color));
material.SetFloat(s_ColorIntensity, Mathf.Clamp01(m_ColorIntensity));
material.SetInt(s_ColorGlow, m_ColorGlow ? 1 : 0);
@@ -421,12 +473,14 @@ namespace Coffee.UIEffects
material.SetFloat(s_TransitionSoftness, Mathf.Clamp01(m_TransitionSoftness));
material.SetVector(s_TransitionRange, new Vector2(m_TransitionRange.min, m_TransitionRange.max));
material.SetInt(s_TransitionColorFilter, (int)m_TransitionColorFilter);
material.SetColor(s_TransitionColor, m_TransitionColor);
material.SetColor(s_TransitionColor, ApplyColorSpace(m_TransitionColor));
material.SetInt(s_TransitionColorGlow, m_TransitionColorGlow ? 1 : 0);
material.SetInt(s_TransitionPatternReverse, m_TransitionPatternReverse ? 1 : 0);
material.SetFloat(s_TransitionAutoPlaySpeed, m_TransitionAutoPlaySpeed);
material.SetTexture(s_TransitionGradientTex,
m_TransitionFilter == TransitionFilter.Blaze ? transitionRampTex : null);
material.SetColor(s_TargetColor, m_TargetColor);
material.SetColor(s_TargetColor, ApplyColorSpace(m_TargetColor));
material.SetFloat(s_TargetRange, Mathf.Clamp01(m_TargetRange));
material.SetFloat(s_TargetSoftness, Mathf.Clamp01(m_TargetSoftness));
@@ -443,12 +497,12 @@ namespace Coffee.UIEffects
}
material.SetInt(s_ShadowColorFilter, (int)m_ShadowColorFilter);
material.SetColor(s_ShadowColor, m_ShadowColor);
material.SetColor(s_ShadowColor, ApplyColorSpace(m_ShadowColor));
material.SetInt(s_ShadowColorGlow, m_ShadowColorGlow ? 1 : 0);
material.SetFloat(s_EdgeWidth, Mathf.Clamp01(m_EdgeWidth));
material.SetInt(s_EdgeColorFilter, (int)m_EdgeColorFilter);
material.SetColor(s_EdgeColor, m_EdgeColor);
material.SetColor(s_EdgeColor, ApplyColorSpace(m_EdgeColor));
material.SetInt(s_EdgeColorGlow, m_EdgeColorGlow ? 1 : 0);
material.SetFloat(s_EdgeShinyRate, Mathf.Clamp01(m_EdgeShinyRate));
material.SetFloat(s_EdgeShinyWidth, Mathf.Clamp01(m_EdgeShinyWidth));
@@ -460,13 +514,18 @@ namespace Coffee.UIEffects
material.SetFloat(s_GradationIntensity, m_GradationIntensity);
material.SetInt(s_GradationColorFilter, (int)m_GradationColorFilter);
material.SetColor(s_GradationColor1, m_GradationColor1);
material.SetColor(s_GradationColor2, m_GradationColor2);
material.SetColor(s_GradationColor3, m_GradationColor3);
material.SetColor(s_GradationColor4, m_GradationColor4);
material.SetColor(s_GradationColor1, ApplyColorSpace(m_GradationColor1));
material.SetColor(s_GradationColor2, ApplyColorSpace(m_GradationColor2));
material.SetColor(s_GradationColor3, ApplyColorSpace(m_GradationColor3));
material.SetColor(s_GradationColor4, ApplyColorSpace(m_GradationColor4));
material.SetInt(s_GradationRadial, m_GradationMode == GradationMode.Radial
#pragma warning disable CS0612 // Type or member is obsolete
|| m_GradationMode == GradationMode.RadialDetail
#pragma warning restore CS0612
|| m_GradationMode == GradationMode.RadialGradient ? 1 : 0);
material.SetFloat(s_DetailIntensity, Mathf.Clamp01(m_DetailIntensity));
material.SetColor(s_DetailColor, m_DetailColor);
material.SetColor(s_DetailColor, ApplyColorSpace(m_DetailColor));
material.SetVector(s_DetailThreshold, new Vector2(m_DetailThreshold.min, m_DetailThreshold.max));
material.SetTexture(s_DetailTex, m_DetailFilter != 0 ? m_DetailTex : null);
material.SetVector(s_DetailTex_ST,
@@ -490,21 +549,22 @@ namespace Coffee.UIEffects
case GradationMode.HorizontalGradient:
case GradationMode.VerticalGradient:
case GradationMode.AngleGradient:
case GradationMode.RadialGradient:
SetKeyword(material, s_GradationKeywords, 1);
break;
case GradationMode.RadialFast:
case GradationMode.RadialDetail:
SetKeyword(material, s_GradationKeywords, 2);
break;
case GradationMode.Horizontal:
case GradationMode.Vertical:
case GradationMode.DiagonalToRightBottom:
case GradationMode.DiagonalToLeftBottom:
case GradationMode.Angle:
SetKeyword(material, s_GradationKeywords, 3);
case GradationMode.Radial:
#pragma warning disable CS0612 // Type or member is obsolete
case GradationMode.RadialDetail:
#pragma warning restore CS0612
SetKeyword(material, s_GradationKeywords, 2);
break;
case GradationMode.Diagonal:
SetKeyword(material, s_GradationKeywords, 4);
SetKeyword(material, s_GradationKeywords, 3);
break;
}
@@ -520,7 +580,7 @@ namespace Coffee.UIEffects
material.SetFloat(s_EdgeShinyAutoPlaySpeed, enable ? m_EdgeShinyAutoPlaySpeed : 0);
}
public void UpdateViewMatrix(Material material, RectTransform transitionRoot, Canvas canvas, Flip flip)
public void UpdateViewMatrix(Material material, RectTransform transitionRoot, Canvas canvas)
{
if (!material) return;
@@ -531,10 +591,10 @@ namespace Coffee.UIEffects
scale.x = scale.y = Mathf.Min(scale.x, scale.y);
}
if (0 != (flip & Flip.Effect))
if (0 != (m_Flip & Flip.Effect))
{
scale.x = 0 != (flip & Flip.Horizontal) ? -scale.x : scale.x;
scale.y = 0 != (flip & Flip.Vertical) ? -scale.y : scale.y;
scale.x = 0 != (m_Flip & Flip.Horizontal) ? -scale.x : scale.x;
scale.y = 0 != (m_Flip & Flip.Vertical) ? -scale.y : scale.y;
}
var pivot = new Vector2(0.5f, 0.5f);
@@ -563,7 +623,11 @@ namespace Coffee.UIEffects
* Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat);
}
if (canvas.renderMode == RenderMode.ScreenSpaceOverlay || !canvas.worldCamera)
if (canvas.renderMode == RenderMode.WorldSpace)
{
material.SetMatrix(s_CanvasToWorldMatrix, Matrix4x4.identity);
}
else if (canvas.renderMode == RenderMode.ScreenSpaceOverlay || !canvas.worldCamera)
{
material.SetMatrix(s_CanvasToWorldMatrix, canvas.transform.localToWorldMatrix);
}
@@ -582,8 +646,10 @@ namespace Coffee.UIEffects
case GradationMode.VerticalGradient:
case GradationMode.AngleGradient:
return new Vector4(gScale, 1, -0.5f * (gScale + 1) - m_GradationOffset, 0);
case GradationMode.RadialFast:
case GradationMode.Radial:
#pragma warning disable CS0612 // Type or member is obsolete
case GradationMode.RadialDetail:
#pragma warning restore CS0612
{
return new Vector4(gScale, 1, m_GradationOffset, 0);
}
@@ -635,11 +701,10 @@ namespace Coffee.UIEffects
}
}
public void ModifyMesh(Graphic graphic, RectTransform transitionRoot, VertexHelper vh,
bool canModifyShape, Flip flip)
public void ModifyMesh(Graphic graphic, RectTransform transitionRoot, VertexHelper vh, bool canModifyShape)
{
// Apply flip (without effect).
ApplyFlipWithoutEffect(vh, flip);
ApplyFlipWithoutEffect(vh, m_Flip);
var count = vh.currentIndexCount;
if (!willModifyVertex || count == 0) return;
@@ -678,10 +743,10 @@ namespace Coffee.UIEffects
}
// Apply flip (with effect).
ApplyFlipWithEffect(verts, flip);
ApplyFlipWithEffect(verts, m_Flip);
// Apply shadow.
ApplyShadow(verts, transitionRoot, flip);
ApplyShadow(verts, transitionRoot, m_Flip);
vh.Clear();
vh.AddUIVertexTriangleStream(verts);
@@ -769,5 +834,10 @@ namespace Coffee.UIEffects
return expandSize;
}
private static Color ApplyColorSpace(Color color)
{
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
}
}
}
+21
View File
@@ -8,6 +8,19 @@ namespace Coffee.UIEffects
[ExecuteAlways]
public class UIEffectPreset : ScriptableObject
{
internal static UIEffectPreset s_DefaultPreset;
internal static UIEffectPreset GetDefaultPreset()
{
if (!s_DefaultPreset)
{
s_DefaultPreset = CreateInstance<UIEffectPreset>();
s_DefaultPreset.hideFlags = HideFlags.HideAndDontSave;
}
return s_DefaultPreset;
}
public ToneFilter m_ToneFilter = ToneFilter.None;
[Range(0, 1)] public float m_ToneIntensity = 1;
@@ -37,6 +50,7 @@ namespace Coffee.UIEffects
public bool m_TransitionColorGlow = false;
public bool m_TransitionPatternReverse = false;
[Range(-5, 5)] public float m_TransitionAutoPlaySpeed = 0f;
public Gradient m_TransitionGradient = new Gradient();
public TargetMode m_TargetMode = TargetMode.None;
public Color m_TargetColor = Color.white;
@@ -68,6 +82,8 @@ namespace Coffee.UIEffects
[Range(-1, 1)] public float m_GradationOffset = 0;
[PowerRange(0.01f, 10, 10)] public float m_GradationScale = 1;
[Range(0, 360)] public float m_GradationRotation = 0;
public TextureWrapMode m_GradationWrapMode = TextureWrapMode.Repeat;
public bool m_GradationReverse;
public EdgeMode m_EdgeMode = EdgeMode.None;
[Range(0, 1)] public float m_EdgeWidth = 0.5f;
@@ -122,6 +138,7 @@ namespace Coffee.UIEffects
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.m_TransitionGradient = src.m_TransitionGradient;
dst.m_TargetMode = src.m_TargetMode;
dst.m_TargetColor = src.m_TargetColor;
@@ -162,6 +179,8 @@ namespace Coffee.UIEffects
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_GradationWrapMode = src.m_GradationWrapMode;
dst.m_GradationReverse = src.m_GradationReverse;
dst.m_DetailFilter = src.m_DetailFilter;
dst.m_DetailIntensity = src.m_DetailIntensity;
@@ -171,6 +190,8 @@ namespace Coffee.UIEffects
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
}
}
@@ -91,12 +91,12 @@ namespace Coffee.UIEffects
[InitializeOnLoadMethod]
private static void InitializeOnLoadMethod()
{
#if UNITY_2023_2_OR_NEWER
#if !LEGACY_TMP_ENABLE
const string tmpSupport = "TextMeshPro Support (Unity 6)";
const string version = "v5.8.0 (Unity 6)";
const string version = "v5.9.0 (Unity 6)";
#else
const string tmpSupport = "TextMeshPro Support";
const string version = "v5.8.0";
const string version = "v5.9.0";
#endif
ShaderSampleImporter.RegisterShaderSamples(new[]
{
@@ -111,8 +111,8 @@ namespace Coffee.UIEffects
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
// ShaderGraph Support
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.8.0"),
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.8.0")
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.9.0"),
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.9.0")
});
ShaderSampleImporter.RegisterShaderAliases(new[]
{
+7 -2
View File
@@ -95,8 +95,6 @@ namespace Coffee.UIEffects
}
}
public override Flip flip => target ? target.flip : 0;
public override float actualSamplingScale => Mathf.Clamp(m_SamplingScale, 0.01f, 100);
public override bool canModifyShape => m_AllowToModifyMeshShape;
@@ -151,6 +149,13 @@ namespace Coffee.UIEffects
protected override void OnValidate()
{
RefreshTarget(target);
if (preset || (target && !isTargetInScene))
{
context?.SetGradationDirty();
context?.SetTransitionGradationDirty();
}
base.OnValidate();
}
+26 -20
View File
@@ -59,7 +59,7 @@ namespace Coffee.UIEffects
{
if (enabled)
{
OnChangeText(textMeshProUGUI);
s_ChangedInstances.Add(textMeshProUGUI);
}
else if (0 < textMeshProUGUI.textInfo?.meshInfo?.Length
&& 0 < textMeshProUGUI.textInfo.meshInfo[0].vertexCount)
@@ -111,15 +111,21 @@ namespace Coffee.UIEffects
private static readonly HashSet<TextMeshProUGUI> s_RegisteredInstances = new HashSet<TextMeshProUGUI>();
private static readonly Dictionary<int, float> s_SdfScaleCache = new Dictionary<int, float>();
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#endif
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void InitializeOnLoad()
private static void RuntimeInitializeOnLoadMethod()
{
s_ChangedInstances.Clear();
s_RegisteredInstances.Clear();
s_SdfScaleCache.Clear();
}
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#else
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
#endif
private static void InitializeOnLoad()
{
Register(new TmpProxy());
// When the text is changed, add it to the changed list
@@ -145,11 +151,11 @@ namespace Coffee.UIEffects
// If the scale has changed, add to the changed list
if (s_SdfScaleCache.TryGetValue(id, out var prev) && !Mathf.Approximately(prev, lossyScaleY))
{
OnChangeText(textMeshProUGUI);
s_ChangedInstances.Add(textMeshProUGUI);
}
// Update the scale cache
s_SdfScaleCache[id] = textMeshProUGUI.transform.lossyScale.y;
s_SdfScaleCache[id] = lossyScaleY;
}
// Remove destroyed objects later
else if (!ReferenceEquals(textMeshProUGUI, null))
@@ -174,6 +180,9 @@ namespace Coffee.UIEffects
foreach (var textMeshProUGUI in s_ChangedInstances)
{
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
if (!textMeshProUGUI.TryGetComponent<IMeshModifier>(out var _)) continue;
s_RegisteredInstances.Add(textMeshProUGUI);
ModifyMesh(textMeshProUGUI);
}
@@ -198,14 +207,6 @@ namespace Coffee.UIEffects
#endif
}
private static void OnChangeText(Object obj)
{
if (obj is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
s_ChangedInstances.Add(textMeshProUGUI);
}
}
private static void ModifyMesh(TextMeshProUGUI textMeshProUGUI)
{
if (!s_Mesh)
@@ -214,19 +215,25 @@ namespace Coffee.UIEffects
s_Mesh.MarkDynamic();
}
s_RegisteredInstances.Add(textMeshProUGUI);
var effect = textMeshProUGUI.GetComponent<UIEffectBase>();
var subMeshes = InternalListPool<TMP_SubMeshUI>.Rent();
var modifiers = InternalListPool<IMeshModifier>.Rent();
var subModifiers = InternalListPool<IMeshModifier>.Rent();
textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect);
textMeshProUGUI.GetComponentsInChildren(subMeshes, 1);
textMeshProUGUI.GetComponents(modifiers);
for (var i = 0; i < textMeshProUGUI.textInfo.meshInfo.Length; i++)
{
var meshInfo = textMeshProUGUI.textInfo.meshInfo[i];
if (meshInfo.vertexCount == 0)
{
s_Mesh.Clear(false);
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
continue;
}
s_VertexHelper.Clear();
meshInfo.mesh.CopyTo(s_VertexHelper, meshInfo.vertexCount, meshInfo.vertexCount * 6 / 4);
meshInfo.mesh.CopyTo(s_VertexHelper);
if (i == 0)
{
foreach (var modifier in modifiers)
@@ -254,7 +261,6 @@ namespace Coffee.UIEffects
replica.target = pEffect;
replica.useTargetTransform = true;
replica.customRoot = null;
replica.flip = pEffect.flip;
}
else if (effect is UIEffectReplica pReplica && pReplica.isActiveAndEnabled)
{
@@ -262,7 +268,6 @@ namespace Coffee.UIEffects
replica.preset = pReplica.preset;
replica.useTargetTransform = pReplica.useTargetTransform;
replica.customRoot = pReplica.customRoot;
replica.flip = pReplica.flip;
}
else
{
@@ -289,6 +294,7 @@ namespace Coffee.UIEffects
InternalListPool<IMeshModifier>.Return(ref modifiers);
InternalListPool<IMeshModifier>.Return(ref subModifiers);
s_Mesh.Clear(false);
Misc.QueuePlayerLoopUpdate();
}
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material, int start)
@@ -20,7 +20,7 @@ TextureImporter:
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
@@ -53,7 +53,7 @@ TextureImporter:
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
@@ -69,7 +69,7 @@ TextureImporter:
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
@@ -100,7 +100,7 @@ TextureImporter:
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
@@ -112,7 +112,7 @@ TextureImporter:
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 5b4bb77fa760f487cac2866aeb002588
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
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: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
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: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -10,7 +10,9 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
internal class BuiltInUIEffectSubTarget : BuiltInCanvasSubTarget
{
// UIEffectForShaderGraph.hlsl
internal static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath("5109b2ad9b8be459592190a5678464e3");
private static GUID s_UIEffectCgincGuid => new GUID("2dd0ed35b98b345218d9aa8ac5a3ad6b");
private static GUID s_UIEffectHlslGuid => new GUID("5109b2ad9b8be459592190a5678464e3");
private static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath(s_UIEffectHlslGuid.ToString());
public BuiltInUIEffectSubTarget() { displayName = "Canvas (UIEffect)"; }
@@ -25,6 +27,13 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
protected override IncludeCollection postgraphIncludes => base.postgraphIncludes
.Add(s_UIEffectHlsl, IncludeLocation.Postgraph); // Include UIEffectForShaderGraph.hlsl on postgraph
public override void Setup(ref TargetSetupContext context)
{
base.Setup(ref context);
context.AddAssetDependency(s_UIEffectHlslGuid, AssetCollection.Flags.SourceDependency);
context.AddAssetDependency(s_UIEffectCgincGuid, AssetCollection.Flags.SourceDependency);
}
/// <summary>
/// Modify pass descriptor for UIEffect.
/// </summary>
@@ -1,5 +1,6 @@
// ==== UIEFFECT START ====
SurfaceDescriptionInputs _fragInput;
half4 uieffect_frag(float2 uv)
{
float2 prevUv = _fragInput.uv0.xy;
@@ -34,25 +35,25 @@ half4 frag_override(PackedVaryings packedInput) : SV_TARGET
_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;
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);
@@ -62,10 +63,10 @@ half4 frag_override(PackedVaryings packedInput) : SV_TARGET
#if defined(_ALPHATEST_ON) || defined(_BUILTIN_ALPHATEST_ON)
clip(color.a - surfaceDescription.AlphaClipThreshold);
#endif
#if UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return color;
}
return color;
}
@@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -6,6 +6,11 @@ namespace UnityEditor.Rendering.Universal.ShaderGraph
{
internal class UniversalUIEffectSubTarget : UniversalCanvasSubTarget
{
// UIEffectForShaderGraph.hlsl
private static GUID s_UIEffectCgincGuid => new GUID("2dd0ed35b98b345218d9aa8ac5a3ad6b");
private static GUID s_UIEffectHlslGuid => new GUID("5109b2ad9b8be459592190a5678464e3");
private static string s_UIEffectHlsl => AssetDatabase.GUIDToAssetPath(s_UIEffectHlslGuid.ToString());
[MenuItem("Assets/Create/Shader Graph/URP/Canvas Shader Graph (UIEffect)", priority = 1000)]
private static void CreateUnlitGraph()
{
@@ -18,7 +23,14 @@ namespace UnityEditor.Rendering.Universal.ShaderGraph
public UniversalUIEffectSubTarget() { displayName = "Canvas (UIEffect)"; }
protected override IncludeCollection postgraphIncludes => base.postgraphIncludes
.Add(BuiltInUIEffectSubTarget.s_UIEffectHlsl, IncludeLocation.Postgraph);
.Add(s_UIEffectHlsl, IncludeLocation.Postgraph);
public override void Setup(ref TargetSetupContext context)
{
base.Setup(ref context);
context.AddAssetDependency(s_UIEffectHlslGuid, AssetCollection.Flags.SourceDependency);
context.AddAssetDependency(s_UIEffectCgincGuid, AssetCollection.Flags.SourceDependency);
}
public override PassDescriptor GenerateUIPassDescriptor(bool isSRP)
{
@@ -61,11 +61,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -60,11 +60,11 @@ SubShader{
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -130,11 +130,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -131,11 +131,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -92,11 +92,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -95,11 +95,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -93,11 +93,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -130,11 +130,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0 (Unity 6)
userData: v5.9.0 (Unity 6)
assetBundleName:
assetBundleVariant:
@@ -61,11 +61,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -60,11 +60,11 @@ SubShader{
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -130,11 +130,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -130,11 +130,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -92,11 +92,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -95,11 +95,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -92,11 +92,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
@@ -130,11 +130,11 @@ SubShader {
#pragma shader_feature_local_fragment _ TONE_GRAYSCALE TONE_SEPIA TONE_NEGATIVE TONE_RETRO TONE_POSTERIZE
#pragma shader_feature_local_fragment _ COLOR_FILTER
#pragma shader_feature_local_fragment _ SAMPLING_BLUR_FAST SAMPLING_BLUR_MEDIUM SAMPLING_BLUR_DETAIL SAMPLING_PIXELATION SAMPLING_RGB_SHIFT SAMPLING_EDGE_LUMINANCE SAMPLING_EDGE_ALPHA
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN
#pragma shader_feature_local_fragment _ TRANSITION_FADE TRANSITION_CUTOFF TRANSITION_DISSOLVE TRANSITION_SHINY TRANSITION_MASK TRANSITION_MELT TRANSITION_BURN TRANSITION_PATTERN TRANSITION_BLAZE
#pragma shader_feature_local_fragment _ EDGE_PLAIN EDGE_SHINY
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_RADIAL GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData: v5.8.0
userData: v5.9.0
assetBundleName:
assetBundleVariant:
+33 -19
View File
@@ -32,6 +32,7 @@ uniform const float2 _TransitionRange;
uniform const float _TransitionWidth;
uniform const int _TransitionPatternReverse;
uniform const float _TransitionAutoPlaySpeed;
uniform const sampler2D _TransitionGradientTex;
uniform const half4 _TargetColor;
uniform const float _TargetRange;
uniform const float _TargetSoftness;
@@ -61,6 +62,7 @@ uniform const half4 _GradationColor3;
uniform const half4 _GradationColor4;
uniform const sampler2D _GradationTex;
uniform const float4 _GradationTex_ST;
uniform const int _GradationRadial;
uniform const matrix _RootViewMatrix;
uniform const matrix _GradViewMatrix;
uniform const matrix _MirrorRootViewMatrix;
@@ -81,7 +83,7 @@ uniform const matrix _CanvasToWorldMatrix;
#define TONE_NONE (!TONE_GRAYSCALE && !TONE_SEPIA && !TONE_NEGATIVE && !TONE_RETRO && !TONE_POSTERIZE)
#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 TRANSITION_NONE (!TRANSITION_FADE && !TRANSITION_CUTOFF && !TRANSITION_DISSOLVE && !TRANSITION_SHINY && !TRANSITION_MASK && !TRANSITION_MELT && !TRANSITION_BURN && !TRANSITION_PATTERN && !TRANSITION_BLAZE)
#define TARGET_NONE (!TARGET_HUE && !TARGET_LUMINANCE)
#define EDGE_NONE (!EDGE_PLAIN && !EDGE_SHINY)
#define DETAIL_NONE (!DETAIL_MASKING && !DETAIL_MULTIPLY && !DETAIL_ADDITIVE && !DETAIL_SUBTRACTIVE && !DETAIL_REPLACE && !DETAIL_MULTIPLY_ADDITIVE)
@@ -550,6 +552,20 @@ half4 apply_transition_filter(half4 color, const float alpha, const float2 uvLoc
}
#endif
}
// Transition.Blaze
#elif TRANSITION_BLAZE
{
const float maxValue = transition_rate();
const float minValue = maxValue - _TransitionWidth / 2;
const float rate = 1 - inv_lerp(minValue, maxValue, alpha * (1 - _TransitionWidth / 2));
const float4 gradColor = tex2D(_TransitionGradientTex, float2(rate, 0.5));
const float4 burntColor = gradColor * color;
const float4 flameColor = float4(gradColor.rgb, gradColor.a * color.a);
// 0-0.5: burnt color, 0.5-1: flame color
color = lerp(burntColor, flameColor, step(0.5, rate));
color.rgb *= color.a;
}
#endif
return color;
@@ -558,20 +574,16 @@ half4 apply_transition_filter(half4 color, const float alpha, const float2 uvLoc
half4 apply_gradation_filter(const half4 inColor, const float2 uvGrad)
{
const float2 uv = uvGrad * _GradationTex_ST.x + _GradationTex_ST.z;
const float uvRad = length((uvGrad - float2(0.5, 0.5)) * 2 * _GradationTex_ST.x) + _GradationTex_ST.z;
half4 factor = inColor;
#if GRADATION_GRADIENT // Gradation.Gradient
{
factor = tex2D(_GradationTex, uv);
}
#elif GRADATION_RADIAL // Gradation.Radial
{
float t = saturate(length((uvGrad - float2(0.5, 0.5)) * 2 * _GradationTex_ST.x) + _GradationTex_ST.z);
factor = lerp(_GradationColor1, _GradationColor2, t);
factor = tex2D(_GradationTex, float2(_GradationRadial ? uvRad : uv.x, 0.5));
}
#elif GRADATION_COLOR2 // Gradation.Color2
{
factor = lerp(_GradationColor1, _GradationColor2, saturate(uv.x));
factor = lerp(_GradationColor1, _GradationColor2, _GradationRadial ? saturate(uvRad) : saturate(uv.x));
}
#elif GRADATION_COLOR4 // Gradation.Color4
{
@@ -592,26 +604,28 @@ half4 apply_gradation_filter(const half4 inColor, const float2 uvGrad)
if (mode == 1) // Color.Multiply
{
color.rgb = color.rgb * factor.rgb;
color *= factor.a;
}
else if (mode == 2) // Color.Additive
{
color.rgb = color.rgb + factor.rgb * color.a;
color.rgb = color.rgb + factor.rgb * color.a * factor.a;
}
else if (mode == 3) // Color.Subtractive
{
color.rgb = color.rgb - factor.rgb * color.a;
color.rgb = color.rgb - factor.rgb * color.a * factor.a;
}
else if (mode == 4) // Color.Replace
{
color.rgb = factor.rgb * color.a;
color *= factor.a;
}
else if (mode == 5) // Color.MultiplyLuminance
{
color.rgb = (1 + Luminance(color.rgb)) * factor.rgb / 2 * color.a;
color.rgb = (1 + Luminance(color.rgb)) * factor.rgb * factor.a / 2 * color.a;
}
else if (mode == 6) // Color.MultiplyAdditive
{
color.rgb = color.rgb * (1 + factor.rgb);
color.rgb = color.rgb * (1 + factor.rgb * factor.a);
}
if (0 < mode)
@@ -635,19 +649,19 @@ half4 apply_detail_filter(half4 color, float2 uvLocal)
{
detail *= _DetailColor;
color.rgb *= detail.rgb;
color = lerp(inColor, color * detail.a, _DetailIntensity);
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#elif DETAIL_ADDITIVE // Detail.Additive
{
detail *= _DetailColor;
color.rgb += detail.rgb * detail.a * color.a;
color = lerp(inColor, color, _DetailIntensity);
color.rgb += detail.rgb * color.a;
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#elif DETAIL_SUBTRACTIVE // Detail.Subtractive
{
detail *= _DetailColor;
color.rgb -= detail.rgb * detail.a * color.a;
color = lerp(inColor, color, _DetailIntensity);
color.rgb -= detail.rgb * color.a;
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#elif DETAIL_REPLACE // Detail.Replace
{
@@ -658,8 +672,8 @@ half4 apply_detail_filter(half4 color, float2 uvLocal)
#elif DETAIL_MULTIPLY_ADDITIVE // Detail.MultiplyAdditive
{
detail *= _DetailColor;
color.rgb *= (1 + detail.rgb * detail.a);
color = lerp(inColor, color, _DetailIntensity);
color.rgb *= (1 + detail.rgb);
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#else
{

Some files were not shown because too many files have changed in this diff Show More