Skip to content

Releases: mob-sakai/SoftMaskForUGUI

3.0.0

01 Dec 18:13
Compare
Choose a tag to compare

3.0.0 (2024-12-01)

Bug Fixes

  • fix anti-aliasing issues (e68ee7b)

Features

  • add 'SOFTMASKABLE' shader feature to improve shader build (eec3212)
  • asset upgrade system 'SOFTMASKABLE' shader feature (d36f932)
  • MaskingShape components always use stencil mask (6c6ac59), closes #203 #209
  • strip shaders using ShaderVariantCollection instead of 'Always Include Shaders' (5f4c435), closes #211
  • update asset upgrade system to unregister always included shaders (906bdb6)

BREAKING CHANGES

  • SoftMaskable shaders now require the SOFTMASKABLE shader feature.
    Please upgrade assets from Project Settings > UI > Soft Mask or refer to the 'README > Usage with Your Custom Shaders' section to manually update your shaders.

🎮 Demo

WebGL Demo



⚙ Installation

This package requires Unity 2019.4 or later.

Install via OpenUPM

openupm add com.softmask-for-ugui
# or, for a specific version
openupm add [email protected]

Install via UPM

"com.coffee.ui-effect": "https://github.com/mob-sakai/SoftMaskForUGUI.git?path=Packages/src",

Import Additional Resources

Additional resources can be imported to extend functionality.



🔄 Upgrade All Assets For V3

If you are currently using SoftMaskForUGUI v1.x/v2.x, the following breaking changes are included when upgrading to v3:

  1. (From v1) API changes: Some APIs are obsolete.

    • SoftMask.alpha: Use Graphic.color.a instead.
    • SoftMask.softness: Use SoftMask.softnessRange instead.
    • SoftMask.partOfParent: Use MaskingShape component instead.
    • SoftMask.ignoreParent: Removed.
    • SoftMask.ignoreSelfGraphic: Removed.
    • SoftMask.ignoreSelfStencil: Removed.
    • SoftMaskable.useStencil: Removed.
    • SoftMaskable.raycastFilter: Use SoftMask.alphaHitTest instead.
    • SoftMaskable.maskInteraction: If you want to use as inverse mask, use MaskingShape component and
      MaskingMethod=Subtract.
  2. (From v1) SoftMaskable component: SoftMaskable component is no longer required to be added explicitly.

    • It will be added automatically at runtime as needed.
  3. (From v1) SoftMaskable shader: SoftMask() function has been updated with additional arguments.

    // Before
    color.a *= SoftMask(IN.vertex, IN.worldPosition);
    // After
    color.a *= SoftMask(IN.vertex, IN.worldPosition, color.a);
  4. (From v2) SoftMaskable shader: SOFTMASKABLE shader feature is now required.

    #pragma shader_feature_local _ SOFTMASKABLE
  5. If you are installing via git URL, add ?path=Packages/src.

    // v1/v2
    "com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
    
    // v3
    "com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git?path=Packages/src",
  6. Hidden/UI/SoftMask, Hidden/UI/TerminalMaskingShape and SoftMaskable shader variants used at runtime must be
    registered in the Project Settings.

    • In v2, the SoftMaskable shaders were included in the "Always Included Shaders", but in v3, they must be registered
      automatically or manually.
    • You can strip unnecessary shader variants to reduce build time and file size.
    • If SoftMask does not display correctly in the player, open/play the scenes or prefabs in the editor. The shader
      variants will be automatically registered.

To apply these changes automatically, please follow the steps below:

  1. Click Edit > Project Settings to open the Project Settings window and select UI > SoftMask category.

  2. Click Upgrade All Assets For V3 to upgrade the assets.

  • ⚠️ If you select Dry Run, you can check the changes before upgrading.



🚀 Usage

Getting Started

  1. Install the package.

  2. Add a SoftMask component instead of Mask component.
    Or, convert an existing Mask component to SoftMask component from the context menu (Convert To SoftMask).

  3. Adjust the soft mask parameters in the inspector.

  4. (Optional) By placing the MaskingShape component under SoftMask, you can add or remove the masking region.

  5. Enjoy!

v2.4.6

22 Nov 05:34
Compare
Choose a tag to compare

2.4.6 (2024-11-22)

Bug Fixes

v2.4.5

17 Nov 06:43
Compare
Choose a tag to compare

2.4.5 (2024-11-17)

Bug Fixes

  • all SoftMaskable components will be removed on upgrade (c0593d4)
  • set component icons (7cf7336)

v2.4.4

16 Nov 23:47
Compare
Choose a tag to compare

2.4.4 (2024-11-16)

Bug Fixes

  • accessing game object transform hierarchy before loading of scene has completed (9dfacbf), closes #208
  • softmask elements stop drawing on resolution change sometimes in editor (f67d025), closes #208

v2.4.3

15 Nov 12:17
Compare
Choose a tag to compare

2.4.3 (2024-11-15)

Reverts

  • Revert "fix: softmask elements stop drawing on resolution change sometimes in editor" (6c864ac)

v2.4.2

14 Nov 22:15
Compare
Choose a tag to compare

2.4.2 (2024-11-14)

Bug Fixes

  • softmask elements stop drawing on resolution change sometimes in editor (380fdc6)

v2.4.1

14 Nov 08:38
Compare
Choose a tag to compare

2.4.1 (2024-11-14)

Bug Fixes

  • alpha hit test not working in demo scene (135b123), closes #210
  • If not configured as a preloaded asset, the project settings asset will be regenerated (cca61d7), closes #200 #212
  • SoftMaskable is not editable (f9937a9)
  • TerminalMaskingShape is hidden even with HideGeneratedComponents=false (8ddb586)

v2.4.0

01 Nov 00:05
Compare
Choose a tag to compare

2.4.0 (2024-11-01)

Bug Fixes

  • argumentException: RenderTextureDesc width must be greater than zero when setting the Down Sampling Rate to X8. (3ffe109), closes #204
  • compile error in UniversalRP 16 (Unity 2023.2) (80413fc), closes #206

Features

  • add ignoreSelf and ignoreChildren option for SoftMaskable element (315b86c)
  • add power option for SoftMaskable element (1362b18)

v2.3.8

29 Sep 14:34
Compare
Choose a tag to compare

2.3.8 (2024-09-29)

Bug Fixes

  • if UniversalRenderPipelineAsset.renderScale is not 1, soft masking will not be rendered correctly (6e5a7f9), closes #194
  • in URP, dynamic resolution does not work when render scale is close to 1 (afed40a)
  • recreates ProjectSettings scriptable object when the project is pulled from GitHub (9f6ea22), closes #200
  • when using dynamic resolution, soft masking will not be rendered correctly (5100e3f), closes #199

v2.3.7

16 Sep 10:33
Compare
Choose a tag to compare

2.3.7 (2024-09-16)

Bug Fixes