https://github.com/smkplus/kamalitransition
Unity Shader transition between panels
https://github.com/smkplus/kamalitransition
shader unity
Last synced: 8 months ago
JSON representation
Unity Shader transition between panels
- Host: GitHub
- URL: https://github.com/smkplus/kamalitransition
- Owner: smkplus
- Created: 2020-01-25T19:53:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-25T20:32:49.000Z (over 6 years ago)
- Last Synced: 2025-04-13T22:09:45.884Z (about 1 year ago)
- Topics: shader, unity
- Language: C#
- Homepage:
- Size: 1.37 MB
- Stars: 47
- Watchers: 6
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [KamaliTransition](https://twitter.com/ShaderGuy/status/1220922020701114368?s=20)
I made this by using [stencil buffer](https://docs.unity3d.com/Manual/SL-Stencil.html)

Stencil Op/Comparison Values
# Comparison Functions
```
0 - Always
1 - Never
2 - Less
3 - Equal
4 - LEqual
5 - Greater
6 - NotEqual
7 - GEqual
8 - Always // (This is the default for the UI shaders so I suspect this one is technically the 'correct' Always, but any value beyond it will also count as Always)
```
# Stencil Operations
```
0 - Keep
1 - Zero
2 - Replace
3 - IncrSat
4 - DecrSat
5 - Invert
6 - IncrWrap
7 - DecrWrap
```
References:
[unity forum](https://forum.unity.com/threads/stencil-op-comparison-values.362425/) & [khronos](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkStencilOp.html)
I explained more about [UI stencil Buffer here](https://gamedev.stackexchange.com/questions/158128/how-to-write-a-transparent-shader-for-a-sprite-that-ignores-transparent-sprites/158132#158132)
# Adding Enum to Inspector
change your properties like this:
```
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Int) = 0
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Int) = 0
```
____________________
# Mask Material

# Foreground UI Material

# Masking TextMeshPro
I explained here how to mask [Textmesh Pro](https://gamedev.stackexchange.com/questions/176170/how-to-use-a-sprite-mask-or-shader-to-mask-a-text
)
