All Projects → mob-sakai → Softmaskforugui

mob-sakai / Softmaskforugui

Licence: mit
UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.

Projects that are alternatives of or similar to Softmaskforugui

Unmaskforugui
Reverse mask for uGUI element in Unity.
Stars: ✭ 259 (-62.35%)
Mutual labels:  unity, unity3d, mask
Mixedreality Webrtc
MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
Stars: ✭ 568 (-17.44%)
Mutual labels:  unity, unity3d
Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (-1.89%)
Mutual labels:  unity, unity3d
Ecs
LeoECS is a fast Entity Component System (ECS) Framework powered by C# with optional integration to Unity
Stars: ✭ 578 (-15.99%)
Mutual labels:  unity, unity3d
Assetstudio
AssetStudio is a tool for exploring, extracting and exporting assets and assetbundles.
Stars: ✭ 7,191 (+945.2%)
Mutual labels:  unity, unity3d
Jengine
JEngine是针对Unity开发者设计的开箱即用的框架,封装了强大的功能,小白也能快速上手,轻松制作可以热更新的游戏 | JEngine is a streamlined and easy-to-use framework designed for Unity Programmers which contains powerful features, beginners can start up quickly and making hot update-able games easily
Stars: ✭ 564 (-18.02%)
Mutual labels:  unity, unity3d
Lunar Unity Console
High-performance Unity iOS/Android logger built with native platform UI
Stars: ✭ 628 (-8.72%)
Mutual labels:  unity, unity3d
Unitypcss
Nvidia's PCSS soft shadow algorithm implemented in Unity
Stars: ✭ 533 (-22.53%)
Mutual labels:  unity, unity3d
Spritedicing
Unity extension for reusing sprite texture areas
Stars: ✭ 589 (-14.39%)
Mutual labels:  unity, unity3d
Unitymeshsimplifier
Mesh simplification for Unity.
Stars: ✭ 592 (-13.95%)
Mutual labels:  unity, unity3d
Dungeontemplatelibrary
🌏: Dungeon free resources (terrain & roguelike generation)
Stars: ✭ 595 (-13.52%)
Mutual labels:  unity, unity3d
Quickstart Unity
Firebase Quickstart Samples for Unity
Stars: ✭ 553 (-19.62%)
Mutual labels:  unity, unity3d
Swarm
An example of use of compute shaders and procedural instancing.
Stars: ✭ 547 (-20.49%)
Mutual labels:  unity, unity3d
Puppettest
An experiment in procedural dance animation
Stars: ✭ 631 (-8.28%)
Mutual labels:  unity, unity3d
Rsvfx
An example that shows how to connect RealSense depth camera to Unity VFX Graph
Stars: ✭ 541 (-21.37%)
Mutual labels:  unity, unity3d
Unitypack
Python deserialization library for Unity3D Asset format
Stars: ✭ 574 (-16.57%)
Mutual labels:  unity, unity3d
Unitygameframework
This is literally a game framework, based on Unity game engine. It encapsulates commonly used game modules during development, and, to a large degree, standardises the process, enhances the development speed and ensures the product quality.
Stars: ✭ 617 (-10.32%)
Mutual labels:  unity, unity3d
Unity Shadergraph Sandbox
✏️ Collection of ShaderGraph examples for Unity.
Stars: ✭ 525 (-23.69%)
Mutual labels:  unity, unity3d
Texturepanner
This repository hosts a shader for Unity3D whose main goal is to facilitate the creation of neon-like signs, conveyor belts and basically whatever based on scrolling textures
Stars: ✭ 528 (-23.26%)
Mutual labels:  unity, unity3d
Smrvfx
An example that shows how to pass data from a skinned mesh renderer to a visual effect graph.
Stars: ✭ 589 (-14.39%)
Mutual labels:  unity, unity3d

SoftMaskForUGUI

⚠️ NOTE: Do not use the obsolete tags and branches to reference the package. They will be removed in near future. ⚠️

UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.


PRs Welcome

<< Description | WebGL Demo | Installation | Usage | For Your Custom Shader | Contributing >>





Description

By using SoftMask instead of the default Mask component, you can beautifully represent the rounded edges of UI elements.

Features

  • SoftMask is compatible with Mask.
  • You can adjust the visible part.
  • Text, Image, RawImage can be used as a masking.
  • Support multiple-sprites and SpriteAtlas.
  • Support up to 4 nested soft masks.
  • Support scroll view.
  • Support inversed soft mask.
  • Support overlay, camera space and world space.
  • (Option) Raycast is filtered only for the visible part.
  • Contain soft maskable UI shader.
  • Support soft masks in your custom shaders by adding just 3 lines. For details, please see Development Note.
  • Adjust soft mask buffer size to improve performance.
  • Convert existing Mask to SoftMask from context menu.
  • Render the soft mask buffer only when needed to improve performance.
  • Add a SoftMaskable component to the child UI elements of SoftMask from the inspector.
  • Preview soft mask buffer in inspector.
  • Make multiple holes on one background by 'Parts of parent' option.
  • Support TextMeshPro

Components

Component Description Screenshot
SoftMask Use instead of Mask for smooth masking.

Show Mask Graphic: Show the graphic that is associated with the Mask render area.
Desampling Rate: The desampling rate for soft mask buffer. The larger the value, the better the performance but the lower the quality.
Softness: The value used by the soft mask to select the area of influence defined over the soft mask's graphic.
Ignore Parent: Should the soft mask ignore parent soft masks?
Part Of Parent: Is the soft mask a part of parent soft mask?
softmask
SoftMaskable Add this component to Graphic under SoftMask for smooth masking.

Use Stencil: Use stencil buffer to mask. If disabled, the stencil buffer is ignored.
RaycastFilter: Use soft-masked raycast target. This option is expensive.
Mask Interaction: The interaction for each mask layers.
softmaskable





Demo

WebGL Demo





Installation

Requirement

  • Unity 2017.1 or later (2018.x, 2019.x and 2020.x are included)
  • No other SDK are required

Using OpenUPM (for Unity 2018.3 or later)

This package is available on OpenUPM. You can install it via openupm-cli.

openupm add com.coffee.softmask-for-ugui

Using Git (for Unity 2018.3 or later)

Find the manifest.json file in the Packages folder of your project and edit it to look like this:

{
  "dependencies": {
    "com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
    ...
  },
}

To update the package, change suffix #{version} to the target version.

  • e.g. "com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git#1.0.0",

Or, use UpmGitExtension to install and update the package.

For Unity 2018.2 or earlier

  1. Download a source code zip file from Releases page
  2. Extract it
  3. Import it into the following directory in your Unity project
    • Packages (It works as an embedded package. For Unity 2018.1 or later)
    • Assets (Legacy way. For Unity 2017.1 or later)





How to play demo

  • For Unity 2019.1 or later
    • Open Package Manager window and select UI Soft Mask package in package list and click Demo > Import in project button
  • For Unity 2018.4 or earlier
    • Click Assets/Samples/UISoftMask/Import Demo from menu

The assets will be imported into Assets/Samples/UI Soft Mask/{version}/Demo.
Open UISoftMask_Demo scene and play it.





Usage

  1. Add a SoftMask component instead of Mask component.
    Or, convert an existing Mask component to SoftMask component from the context menu.
  2. Add a SoftMaskable components to the child UI elements of the SoftMask component.

    Or, add a SoftMaskable components from the inspector of the SoftMask component.
  3. Adjust softness setting of SoftMask.
  4. Enjoy!





Usage with TextMeshPro

To use SoftMask with TextMeshPro, import a sample asset.

  • For Unity 2019.1 or later
    • Open Package Manager window and select UI Soft Mask package in package list and click TextMeshPro Support > Import in project button
  • For Unity 2018.4 or earlier
    • Click Assets/Samples/UISoftMask/Import TextMeshPro Support from menu

The assets will be imported into Assets/Samples/UI Soft Mask/{version}/TextMeshPro Support.

NOTE: You must import TMP Essential Resources before using. They include shaders, fonts, etc.

NOTE: If the shader error is not resolved, reimport the shader. Or, import the TextMeshPro Support again.





Support soft masks with your custom shaders

Only a few steps are needed to support soft mask in your custom shaders!

  1. Duplicate your shader file and add the (SoftMaskable) suffix to the file name.
Your_Custom_Shader.shader
-> Your_Custom_Shader (SoftMaskable).shader
  1. Modify the shader name (defined at the beginning of the shader file) as follows:
  • Add Hidden/ prefix
  • Add (SoftMaskable) suffix
Shader "UI/Your_Custom_Shader"
-> Shader "Hidden/UI/Your_Custom_Shader (SoftMaskable)"
  1. Add #pragma and #include directives, where SOFTMASK_EDITOR is an editor-only keyword and is not included in the build. If you didn't use package manager to install, include SoftMask.cginc in the appropriate path instead.
#include "Packages/com.coffee.softmask-for-ugui/Shaders/SoftMask.cginc"
#pragma shader_feature __ SOFTMASK_EDITOR
  1. Apply a soft mask in the fragment shader.
    This operation determines the final alpha according to the soft mask buffer.
  • IN.vertex: the clip position
  • IN.worldPosition: the world position
color.a *= SoftMask(IN.vertex, IN.worldPosition);

As an example of implementation, please see UI-Default-SoftMask.shader.





Contributing

Issues

Issues are very valuable to this project.

  • Ideas are a valuable source of contributions others can make
  • Problems show where this project is lacking
  • With a question you show where contributors can improve the user experience

Pull Requests

Pull requests are, a great way to get your ideas into this repository.
See CONTRIBUTING.md.

Support

This is an open source project that I am developing in my spare time.
If you like it, please support me.
With your support, I can spend more time on development. :)






License

  • MIT
  • © UTJ/UCL

Author

See Also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].