Compare commits

...

5 Commits
1.0.0 ... main

Author SHA1 Message Date
semantic-release-bot b870d64b57 chore(release): 1.0.2 [skip ci]
## [1.0.2](https://github.com/mob-sakai/SoftMaskForUGUI/compare/1.0.1...1.0.2) (2022-05-15)

### Bug Fixes

* support TextMeshPro v2 or later ([c85409e](c85409e56f))
2022-05-15 06:52:50 +00:00
mob-sakai c85409e56f fix: support TextMeshPro v2 or later 2022-05-15 15:47:53 +09:00
semantic-release-bot 29def6dbe5 chore(release): 1.0.1 [skip ci]
## [1.0.1](https://github.com/mob-sakai/SoftMaskForUGUI/compare/1.0.0...1.0.1) (2022-05-15)

### Bug Fixes

* applied a workaround to fix a Microsoft HLSL compiler issue ([50c41f2](50c41f29cc)), closes [#131](https://github.com/mob-sakai/SoftMaskForUGUI/issues/131)
* fixed shader compilation in some platforms ([40b450b](40b450ba24))
2022-05-15 06:18:12 +00:00
jnncoutinho 40b450ba24 fix: fixed shader compilation in some platforms
The overload abs(float4x4, float4x4) is not present in some platforms
supported by Unity
Decomposing the operation fixes the problem
2022-05-15 15:17:00 +09:00
Mane Function 50c41f29cc fix: applied a workaround to fix a Microsoft HLSL compiler issue
close #131
https://fogbugz.unity3d.com/default.asp?934464_sjh4cs4ok77ne0cj&_ga=2.124069071.432066521.1640792064-45545210.1640792064
2022-05-15 15:17:00 +09:00
5 changed files with 42 additions and 6 deletions

View File

@ -1,3 +1,18 @@
## [1.0.2](https://github.com/mob-sakai/SoftMaskForUGUI/compare/1.0.1...1.0.2) (2022-05-15)
### Bug Fixes
* support TextMeshPro v2 or later ([c85409e](https://github.com/mob-sakai/SoftMaskForUGUI/commit/c85409e56ff09607244061c59518f5d1f460a918))
## [1.0.1](https://github.com/mob-sakai/SoftMaskForUGUI/compare/1.0.0...1.0.1) (2022-05-15)
### Bug Fixes
* applied a workaround to fix a Microsoft HLSL compiler issue ([50c41f2](https://github.com/mob-sakai/SoftMaskForUGUI/commit/50c41f29ccc9b70acdd7f15490debd8eacf5a102)), closes [#131](https://github.com/mob-sakai/SoftMaskForUGUI/issues/131)
* fixed shader compilation in some platforms ([40b450b](https://github.com/mob-sakai/SoftMaskForUGUI/commit/40b450ba24e77c34c97fe8411f7b0b1dd103d487))
# [1.0.0](https://github.com/mob-sakai/SoftMaskForUGUI/compare/0.9.1...1.0.0) (2021-02-24)

View File

@ -124,8 +124,13 @@ SubShader {
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#if UNITY_VERSION < 201910
#include "Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc"
#include "Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc"
#else
#include "Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc"
#include "Assets/TextMesh Pro/Shaders/TMPro.cginc"
#endif
#include "Packages/com.coffee.softmask-for-ugui/Shaders/SoftMask.cginc"
#pragma shader_feature __ SOFTMASK_EDITOR

View File

@ -93,7 +93,11 @@ SubShader {
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#if UNITY_VERSION < 201910
#include "Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc"
#else
#include "Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc"
#endif
#include "Packages/com.coffee.softmask-for-ugui/Shaders/SoftMask.cginc"
#pragma shader_feature __ SOFTMASK_EDITOR

View File

@ -7,9 +7,21 @@ float4x4 _GameVP;
float4x4 _GameTVP;
half4 _MaskInteraction;
float CustomStep(float a, float x)
{
return x >= a;
}
fixed Approximately(float4x4 a, float4x4 b)
{
float4x4 d = abs(a - b);
float4x4 d = a - b;
d = float4x4(
abs(d[0]),
abs(d[1]),
abs(d[2]),
abs(d[3])
);
return step(
max(d._m00,max(d._m01,max(d._m02,max(d._m03,
max(d._m10,max(d._m11,max(d._m12,max(d._m13,
@ -30,16 +42,16 @@ float SoftMaskInternal(float4 clipPos)
float4 cpos = mul(_GameTVP, mul(UNITY_MATRIX_M, wpos));
view = lerp(view, cpos.xy / cpos.w * 0.5 + 0.5, isSceneView);
#if UNITY_UV_STARTS_AT_TOP
view.y = lerp(view.y, 1 - view.y, step(0, _ProjectionParams.x));
view.y = lerp(view.y, 1 - view.y, CustomStep(0, _ProjectionParams.x));
#endif
#elif UNITY_UV_STARTS_AT_TOP
view.y = lerp(view.y, 1 - view.y, step(0, _ProjectionParams.x));
view.y = lerp(view.y, 1 - view.y, CustomStep(0, _ProjectionParams.x));
#endif
fixed4 mask = tex2D(_SoftMaskTex, view);
half4 alpha = saturate(lerp(fixed4(1, 1, 1, 1), lerp(mask, 1 - mask, _MaskInteraction - 1), _MaskInteraction));
#if SOFTMASK_EDITOR
alpha *= step(0, view.x) * step(view.x, 1) * step(0, view.y) * step(view.y, 1);
alpha *= CustomStep(0, view.x) * CustomStep(view.x, 1) * CustomStep(0, view.y) * CustomStep(view.y, 1);
#endif
return alpha.x * alpha.y * alpha.z * alpha.w;
@ -53,4 +65,4 @@ float SoftMaskInternal(float4 clipPos)
#define SoftMask(clipPos, worldPosition) SoftMaskInternal(clipPos)
#endif
#endif // UI_SOFTMASK_INCLUDED
#endif // UI_SOFTMASK_INCLUDED

View File

@ -2,7 +2,7 @@
"name": "com.coffee.softmask-for-ugui",
"displayName": "UI Soft Mask",
"description": "UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.\nBy using SoftMask instead of the default Mask component, you can beautifully represent the rounded edges of UI elements.",
"version": "1.0.0",
"version": "1.0.2",
"unity": "2017.1",
"license": "MIT",
"repository": {