Comments (7)
Sorry for my late reply.
The TextMeshPro shader does not work correctly in the following environments due to updates:
- Unity 2023.2 and Unity 6 (TextMeshPro is built into uGUI)
- TextMeshPro v3.2.0-pre and v4.0.0-pre
As a workaround, please try the following:
- If you have already imported the TextMeshPro Support sample, delete the folder.
- Extract the following zip file into the Assets folder:
- Add the shaders to
Project Settings > Shader Settings > Always Included Shaders
from softmaskforugui.
Seems to happen for >TextMeshPro/Distance Field< sharder .... the blocky appearance is fixed when I switch to >TextMeshPro/Mobile/Distance Field< but there still is some artifact looking like underline on each letter
Edit: Just found out that changing Vertical Mapping for the TextMeshPro component to "line" or "paragraph" seem to fix the problem.
Edit 2: No ... after further usage I found there are still some issues with the fonts looking differently or completely buggy in most scenarios :(
from softmaskforugui.
I managed to fix it by copying the default Distance Field shader from TMP and making minor adjustments.
First changed the shader name to Hidden/TextMeshPro/Distance Field (SoftMaskable)
.
Second change is in Pass
. Edit pragmas and includes like this:
#pragma target 3.0
#pragma vertex VertShader
#pragma fragment PixShader
#pragma shader_feature __ BEVEL_ON
#pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
#pragma shader_feature __ GLOW_ON
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#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
With softmask editor included you can add softmask to your text but you need to know the world position and there comes the third change.
Add float4 worldPosition : TEXCOORD6;
to struct pixel_t
.
Then you need to add world position from input to output output.worldPosition = input.position;
in VertShader
just before returning the output.
And finally you can add the softmask into PixShader
just before returning faceColor
faceColor *= SoftMask(input.position, input.worldPosition);
.
It works for soft masking the TMPro texts for me but i still do not managed to make it work for TMP inline sprites.
from softmaskforugui.
I managed to make it work with unities built in soft mask but then we had to downgrade to unity 2022 and there we had other problems so we just scraped the soft mask part and just went with the hard mask ore just mask :D.
But ty for posting this i will try and implement it for testing.
from softmaskforugui.
Make sure the TextMeshPro Support package is imported into your Asset folder as stated in
https://github.com/mob-sakai/SoftMaskForUGUI?tab=readme-ov-file#usage-with-textmeshpro
I think the author @mob-sakai maded it a bit misleading putting the resources under a folder called "Samples".
from softmaskforugui.
Make sure the TextMeshPro Support package is imported into your Asset folder as stated in https://github.com/mob-sakai/SoftMaskForUGUI?tab=readme-ov-file#usage-with-textmeshpro I think the author @mob-sakai maded it a bit misleading putting the resources under a folder called "Samples".
I am experiencing the same issue as described in this thread, and I have definitely installed the package you mentioned. (If it isn't installed, it appears in magenta.) However, even after installation, the color that was magenta just shows up as a black (or the color of the font) rectangle. In the 2023 version, the same issue occurs no matter how I bake the font asset, whereas in version 2022.3.x, everything works perfectly with the same settings. Therefore, the method you suggested does not solve the problem.
from softmaskforugui.
Related Issues (20)
- Can't use Text Mesh Pro UGUI Text as a SoftMask HOT 1
- Textmeshpro special characters not handled HOT 1
- How to use the inverted mask? HOT 2
- [v1] Soft mask doesn't work, Unity 2020.3.33f1 HOT 2
- ParticleAttractor support for List of Particles and allow them to be attached and detached at runtime HOT 1
- Unable to get Soft Mask to work - console fills with errors HOT 2
- [v1] Masked UI image vanishes when dragged HOT 2
- [v1] Soft mask problem with default mask and resolution change HOT 4
- [v1] I can't make a material for the Image based on the Default SoftMaskable shader HOT 2
- [v1] When creating AssetBundle and loading them into an Android application, SoftMaskUI does not work. HOT 4
- [v1] NullReferenceException when adding SoftMask component HOT 1
- [v1] All SoftMasks disappear when screen orientation is changed HOT 7
- SoftMaskForUGUI v2 HOT 5
- [v1] Non-maskable TMPro text masks until "Maskable" re-disabled HOT 2
- [v1] Masked elements are off-set if canvas is not full screen HOT 2
- [v1] I tried changing properties of material using softmaskable but the gameobject properties stay the same HOT 2
- [v1] Soft mask with custom shader not working on Android HOT 1
- [v1] Soft Mask breaks with render scale different than 1 on Android & iOS devices HOT 1
- [v1] TMP Texture breaks when Softmask applied, Unity 2022.3, URP, iOS target HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from softmaskforugui.