GithubHelp home page GithubHelp logo

olegknyazev / softmask Goto Github PK

View Code? Open in Web Editor NEW
97.0 4.0 7.0 118.28 MB

A plugin for Unity 3D that brings alpha-friendly masking to UI.

License: Other

C# 88.80% ShaderLab 7.96% HLSL 3.08% Shell 0.15%
masking ui unity3d unity-plugin ugui

softmask's Introduction

Soft Mask

Soft Mask is a package for Unity 3D that implements smooth masking for UI (UGUI). It works almost like the standard Unity's mask, but supports alpha, which enables gradual and semi-transparent masks.

The key feature of Soft Mask is its ease of use. You don't need to be a programmer to use it—just drop the Soft Mask component on a UI object as you do with the standard Unity Mask and here you go.

The package had been sold on Asset Store for several years, but in late 2022 it was open-sourced under the MIT license with Commons Clause. In short, this license means that you're free to use this tool in your games, but you don't have the rights to resell the Soft Mask itself.

To better understand what the Soft Mask is, check out the online demo.

Getting Started

The easiest way to install Soft Mask is via the Package Manager window by using GitHub URL. Press the Add button in the Package Manager window and enter the following URL:

https://github.com/olegknyazev/SoftMask.git?path=/Packages/com.olegknyazev.softmask#1.7.0

Pay attention to the version that's encoded within this URL.

Alternatively, you can get the package directly from the Packages/com.olegknyazev.softmask subfolder. A pre-built artifact is not provided at the moment.

Useful links

  • Documentation
  • Changelog
  • Support Thread — This thread was one of the primary support lines while the package was paid. You still can find some useful information there or post a bug, but GitHub is a preferred place to reporting bugs.

Development

The remaining of the document is aimed at those who is interested in modifying the package.

Project Structure

At the root of the repository we have a regular Unity project which contains the package itself under Packages/com.olegknyazev.softmask directory as well as some additional assets and scripts for development.

Automated Tests

Soft Mask has a set of automated tests that work by comparing render results in various test scenes against the pre-recorded screenshots. In general, it's a bad idea to use rendering results in testing because they may depend on specific software (version of OS, Unity, selected render system) or hardware. But in the case of Soft Mask, which highly depends on shaders, I don't see a good alternative, so I decided to use this approach.

All the screenshot-comparing tests were recorded on MacOS 15.1 and Unity 2020 with the Metal renderer, and they may not be compatible with screenshots taken on a different setup.

The tests use the perceptualdiff utility, so you need to have it installed in order to run the tests.

To run the automated tests suite, perform the following:

  1. Import the TextMesh Pro package, essential resources, and additional examples. The additional resources are used in some TMPro-related test scenes, so you have to have them in the project in order for these tests to work.
  2. Update TextMesh Pro integration.
  3. Open scene Assets/Extra/Test/Scenes/_RunAllAutomationTests.unity.
  4. [Optional] Select the TestsRunner object and modify properties as need for this specific run.
  5. Run the scene in Play Mode.
  6. Wait for automation tests to end. Do not remove focus from the Unity Editor windows during the testing.

Besides these screenshot-comparing tests, we also have several classic editor-mode tests for the functionality that could be tested this way.

Documentation

The documentation for Soft Mask is written in Google Documents and exported as a PDF. The source document for 1.7.0 is available here.

softmask's People

Contributors

julia-petrova avatar olegknyazev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

softmask's Issues

Mac & linux build apk is not working for soft mask

os: mac or linux docker
unity ver: 2021.3.16f1 pro
paltform: android
softmask ver: v1.7.0
mode: sprite & sliced

When I use this package to compile the APK on the WINDOWS platform, it is normal, but when I compile it on MAC or LINUX, it will not work.
I just using it on ScrollView content textmesh pro and ugui button.

Thank you for reading...

=============2024.2.29 update============
I found that deleting the Library/shadercache directory will cause the softmask to become invalid. It is still being verified.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.