Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Plans For Hdrp Compatibility For Tmp?

Discussion in 'UGUI & TextMesh Pro' started by dgoyette, Apr 12, 2019.

  1. Sergey_ksubox

    Sergey_ksubox

    Joined:
    Jul 29, 2015
    Posts:
    26
    How to install 3.2.0-pre.1 version to test ? I can't see it in preview packages in 2021.1 18f.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I should become visible if you enable seeing preview packages in the Advanced tab of the Package Manager.
     
  3. Sergey_ksubox

    Sergey_ksubox

    Joined:
    Jul 29, 2015
    Posts:
    26
    Probably something changed in Unity policy for prerelease - even I enabled preview packages I can't see:
    upload_2021-8-30_7-0-19.png
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Looks like the option to see preview package or "Show All Versions" is not present in 2021.x. As such, you will need to manually add the package by editing the "manifest.json" file located in "Project/Packages/..." to edit the current reference to the following:

    "com.unity.textmeshpro": "3.2.0-pre.1",
     
    cxode likes this.
  5. Tricktale

    Tricktale

    Joined:
    Jan 23, 2015
    Posts:
    42
    I'm getting a bunch of protection level errors after upgrading to 3.2.0-pre.1 (I had to edit the manifest.json as above). Any ideas as I can't seem to find the cause?

    This is using unity 2020.3.17f1 and HDRP 10.6.0.

    tmp_errors.png
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The above errors are related to the custom inspector for the HDRP shaders. Looks like some of the needed changes in the HDRP package to allow TMP to use its custom inspectors may not be included in the HDRP package version you are using or the package containing them hasn't been released yet.

    Having said that, you can disable the custom inspector for those shaders. Take a look at the video below where at 2:30 I talk about this custom material inspector which in this case you should disable by simply removing from the field.



    Let me know if you need further assistance for this. I will check on my end when / if this new HDRP package has landed with the changed needed for the custom TMP shader inspector to work.
     
    hugokostic and Tricktale like this.
  7. Tricktale

    Tricktale

    Joined:
    Jan 23, 2015
    Posts:
    42
    Thank you for your reply Stephan. I've removed the custom inspectors from the shader graph shaders, but the errors still remain the same.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Looks like one of the needed changes to the "High Definition RP" package is not present in version 10.6.0.

    Fortunately, this is a simple change to make.

    In the Editor, select and edit the "AssemblyInfo.cs" file as seen below.

    upload_2021-9-1_21-10-24.png

    Once the file is open, make the following addition as seen below.

    upload_2021-9-1_21-12-9.png

    Because of how the package cache works, this change will be lost when you close Unity or possibly after some subsequent assembly reload.

    To make this change persistent, you will also need to make it in the Global Package Cache of version 10.6.0 of the High Definition RP package which is located in the Global Package Cache, in "...\cache\packages\packages.unity.com\com.unity.render-pipelines.high-definition@10.6.0", in there you will see the Editor folders which contains the "AssemblyInfo.cs" file that needs to be edited as seen above.

    Depending on the version of Unity, you may need to close and re-open the editor for the changes to take place as package cache (re-syncing) varies between 2020.3 and 2021.

    Since the above is the source of the errors you reported, after making these changes, you should be able to re-add / re-import the HDRP Shader to use the custom inspector.
     
  9. VeganBurrito86

    VeganBurrito86

    Joined:
    Jun 3, 2021
    Posts:
    7
    Hello, thanks for all your hard work on this Stephan. I'm using Unity 2021.1.10f1 and HDRP 11.0.0. I downloaded your shader .unitypackage from your earlier post. I got it installed, and had some errors. I updated TMP to the pre-release 3.2.0 version you instructed someone else to upgrade to above and some of the errors went away. Then I updated the AssemblyInfo.cs files you mention above in your last message with the changes you outlined (both the file through the editor and the other through the global package cache).

    I closed and re-opened the editor and still have 4 errors. So I tried deleting the new shaders and re-importing the package... still these 4 errors:

    shader_errors.png

    This is all over my head - any ideas how I might deal with these?

    Edit: I also made sure the "Custom Editor GUI" fields were empty in the shader graphs, as mentioned in your video in a recent post.
     
    Last edited: Sep 2, 2021
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just took a quick look at this before going to sleep and it looks like the HDRP team may have made recent changes in their latest package release which are now resulting in these new errors.

    I will take a closer tomorrow.
     
  11. Tricktale

    Tricktale

    Joined:
    Jan 23, 2015
    Posts:
    42
    Thank you Stephan. Following your steps, I get no errors now. However, I can't get any font asset using the new SDF HDRP-Lit or HDRP-Unlit shaders to render anything. I've tried world space, camera space and overlay canvases.

    I can get black blocks for the characters to appear if I disable alpha-clipping but that's it. Any assistance you can provide would be greatly appreciated.
     
  12. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,189
    @Stephan_B Are there shaders available for 2019.4 LTS? I noticed that 2.2.0-preview.1 was out, so I updated to it. But when I try to import the "SRP Shaders.unitypackage" containing the shaders you linked in your video above, they're just full of errors under HDRP/ShaderGraph 7.7.1. For example:

    Code (CSharp):
    1. Asset import failed, "Assets/TextMesh Pro/Shaders/TMP_SDF-HDRP UNLIT.shadergraph" > ArgumentException: JSON parse error: The document root must not follow by other values.
    2. UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at <1a491ffb1c7c42349a050cc1542277fb>:0)
    3. UnityEngine.JsonUtility.FromJson[T] (System.String json) (at <1a491ffb1c7c42349a050cc1542277fb>:0)
    4. UnityEditor.ShaderGraph.ShaderGraphImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.unity.shadergraph@7.7.1/Editor/Importers/ShaderGraphImporter.cs:90)
    5. UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at <3d9f46ac475f4fa9a3b71bacf80244a8>:0)
    6.  
    7.  
    Are there 7.x versions of these shaders?
     
  13. Liderangel

    Liderangel

    Joined:
    Jul 8, 2018
    Posts:
    100
    Hey, we found a solution by just duplicating any existing (and functioning) TMPRO Shader, and then going into that new shader to replace:

    ZTest [unity_GUIZTestMode]

    with:
    ZTest [unity_GUIZWrite]


    and voila!


    The text indeed renders on top of meshes, just like the TMPRO Overlay:


    (screencap from I See Red, which uses only a diegetic 3D GUI, reason as to why we were so concerned about resolving this issue, which we finally did in 10 seconds with that simple change)


    Hope that everyone now can start using again their World Space GUI!
     
    andylewisart and HWcoms like this.
  14. jens_unity858

    jens_unity858

    Joined:
    Nov 26, 2019
    Posts:
    17
    So this is not working in 2019.4 as far as I can tell? Any idea when it will work?
     
  15. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Since SRP (URP & HDRP) underwent massive changes between 2019.x and 2020.x, shaders developed for 2020.x are not compatible with 2019.x nor compatible with Shader Graph in 2019.x. As such, I need to create a new set of shaders just for 2019.4. which should work fine. However, I do not believe it will be possible to provide custom editors for those as this functionality was not exposed in the SRP framework in 2019.x.

    I am currently trying to address compatibility changes that broke some of the shader functionality and custom inspectors between 2020.x and 2021 using newer version of the SRP packages. Once that is all working correctly, I plan on creating those new shaders for 2019.4.

    P.S. I wish I had a better answer but I am still trying to keep up with the changes and evolution of the SRP packages in 2020.x, 2021.x and 2022.x.
     
    dgoyette likes this.
  16. jens_unity858

    jens_unity858

    Joined:
    Nov 26, 2019
    Posts:
    17
    Thanks, are there any shaders I can use in the meantime that would work? I am almost done with the project so I do not want to update to a later version of unity?
     
  17. Tricktale

    Tricktale

    Joined:
    Jan 23, 2015
    Posts:
    42
    I've tried creating a new 2020.3.17f1 HDRP project, but the problem remains. I can't get anything to render no matter what settings I use. The material preview looks correct, as does the shader graph preview and the mobile SDF shaders render correctly.

    HDRP Unlit Shader(top) / Mobile Shader(bottom):
    tmpro1.jpg tmpro2.jpg
     
    Last edited: Sep 7, 2021
  18. Liderangel

    Liderangel

    Joined:
    Jul 8, 2018
    Posts:
    100
  19. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,189
    @jens_unity858 @Liderangel

    The current state of things in 2019.4 (SRP 7.x) is that TMP generally works. There are just some ways in which it doesn't interact properly with certain SRP elements. So, @jens_unity858 should be specific about the issue they're running into. There's no need to wait for new shaders to use most of TMP's in HDRP, for example. (Same with URP?)

    I'm using TMP in both screen space and world space canvases, using the the default "TextMeshPro/DistanceField" shader included with TMP. And generally speaking, it works fine. There are just two big downsides right now that it doesn't support, both related to rendering order:
    • No support for rendering TMP "Before Refraction" in HDRP, meaning that TMP objects behind refractive materials are invisible.
    • No support for rendering TMP "After post-processing" to avoid having HUD text affected by things like motion blur.
    Again, @jens_unity858 should state what specifically isn't working, as for the most part TMP works fine in SRPs. Just that none of those new features in the demo video above work yet.
     
  20. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    @dgoyette is correct with respect to most TMP shaders. The "Surface" shaders are the ones that do not work with SRP however, the other shaders should be fine with the limitations described above.

    If anyone has a fair amount of experience in ShaderGraph, it should be possible to manually reproduce the URP and HDRP shaders included in the 2020.x TMP package. The custom functions used by those shaders are contained in the SDFFunctions.hlsl file.
     
  21. jens_unity858

    jens_unity858

    Joined:
    Nov 26, 2019
    Posts:
    17
  22. caxapexac

    caxapexac

    Joined:
    Feb 27, 2018
    Posts:
    6
    @Stephan_B

    If anyone has a fair amount of experience in ShaderGraph, it should be possible to manually reproduce the URP and HDRP shaders included in the 2020.x TMP package. The custom functions used by those shaders are contained in the SDFFunctions.hlsl file.[/QUOTE]

    Unity 2020.3.19
    Standart HDRP package material sample includes almost working TMP except:
    When trying to create new font -
    upload_2021-9-26_21-8-48.png

    it shows this:

    ArgumentNullException: Value cannot be null.
    Parameter name: shader
    UnityEngine.Material..ctor (UnityEngine.Shader shader) (at <ca496b8c93454b2f9b9924292c19379f>:0)
    TMPro.TMP_FontAsset_CreationMenu.CreateFontAssetFromSelectedObject (UnityEngine.Object target) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Editor/TMP_FontAsset_CreationMenu.cs:233)
    TMPro.TMP_FontAsset_CreationMenu.CreateFontAsset () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Editor/TMP_FontAsset_CreationMenu.cs:172)


    Also, sample's font looks like this:
    upload_2021-9-26_21-11-48.png

    And my newly created materials look like this:
    upload_2021-9-26_21-12-38.png

    Is there any quick fix for creating fonts? And how much should we wait for the official TMP HDRP support?
     
  23. caxapexac

    caxapexac

    Joined:
    Feb 27, 2018
    Posts:
    6
    Any at least temporary fix yet?

    I mean TMP is used in 'spaceship' unity hdrp example. How is it done?
     
  24. caxapexac

    caxapexac

    Joined:
    Feb 27, 2018
    Posts:
    6
    Sorry for pinging you but it is so quiet here. I don't believe nobody uses GUI in hdrp. Cuz UnityEngine.UI.Text is such cursed solution nobody in a clean mind won't use it... *smiling hiding the pain*

    (I know hdrp's UX is the piece of .. but it has cool volumetric lights works faster than Aura2. Really no more reason switching from legacy rp)
     
  25. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Been in the process of moving (new state) and without internet service for the past week or so. Now that I am back online, I will try to get a new package (uploaded) here with the needed changes to work in the latest version of URP / HDRP.

    Since the same version of TMP package is used for 2020.x and 2021 or newer where the HDRP API has changed, I still need to figure out if I can handle these API changes in the same package. Regardless, as per the above, I'll upload a .unitypackage that contains the updated file to work with the latest HDRP package.
     
    caxapexac likes this.
  26. caxapexac

    caxapexac

    Joined:
    Feb 27, 2018
    Posts:
    6
    Thanks for response so much : )
    Gonna test and give feedback on new unitypackage as soon as you post it
     
  27. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,921
    Hi @Stephan_B

    Any idea when this will be production ready? A rough estimate is fine for URP Mobile use case.

    Regards
     
  28. torstenfock

    torstenfock

    Joined:
    Oct 31, 2018
    Posts:
    3
    So again another simple feature (TMP surface shaders) is not usable in URP, despite Unity encourages you to use URP for new mobile projects. Thanks for nothing.
     
  29. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Version 3.2.0-pre.2 of the TMP package will be available this week. The package will include updated shaders and fixes to address recent changes made to the SRP package that make the TMP SRP material inspectors unhappy.

    The new release will include both Lit and Unlit URP and HDRP shaders which are replacements for the Surface shaders.
     
    jGate99 likes this.
  30. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Version 3.2.0-pre.2 has been released.

    This release includes updated material inspectors for SRP which at the time of publishing are compatible with SRP packages version 10.7 for Unity 2020.3, version 11.x for Unity 2021.1, version 12.x for Unity 2021.2 and version 13.x for Unity 2022.

    Please be sure to update the TMP Essential Resources and TMP Examples & Extras which now include a new example scene for HDRP.

    P.S. I am planning on making an official post about the new release in the next day or so but didn't want to delay let you know this new version was now available.
     
    torstenfock, Tricktale and Fribur like this.
  31. Wulf-Games

    Wulf-Games

    Joined:
    Apr 5, 2016
    Posts:
    9
    Is it available for URP as well?
     
  32. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Yes.
     
  33. jsking

    jsking

    Joined:
    Oct 5, 2020
    Posts:
    1
    Hello @Stephan_B , I'm using Unity 2020.3.24f1, URP 10.7, and version 3.2.0-pre.2 of the TMP package but I can't seem to get the TMP_SDF-URP Lit shader to work.

    I want the text on my buttons on my Screen Space - Camera canvas to react to 2D lights. Am I misunderstanding the use case for this shader? I don't have much experience in this area so it's hard to tell if this is a bug or just something that I'm doing wrong.
     

    Attached Files:

    IsDarKsly likes this.
  34. laurienash

    laurienash

    Joined:
    Mar 15, 2013
    Posts:
    61
    Hey, I'm just trying out the shader package in unity 2021.1 HDRP.
    I keep getting this error - which often happens when reloading a scene. If I delete the material and reassign it to the object the error disappears, but this is only a temp fix until it happens again.
    Do you know why?
    Capture.PNG
     
  35. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of the TMP package are you using?
     
  36. YTGameDevDave

    YTGameDevDave

    Joined:
    Jan 3, 2015
    Posts:
    13
    For anyone confused as to where to find those:
    upload_2021-12-15_19-22-55.png
     
    Stephan_B likes this.
  37. matiskp

    matiskp

    Joined:
    Feb 11, 2020
    Posts:
    1
    @Stephan_B what about previous versions of Unity as you pointed out. We are still running on 2019.4.32. What can I do to make these TMP shaders work on this version?
     
  38. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    296
    Anyone have a valid surface shader for textmesh on 2019.4?
     
  39. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    191
    @Stephan_B Just been testing the TMP_SDF-URP Lit shader in Unity 2021.2.7f1. Seems be working fine.

    I noticed that you're forcing Smoothness to 0.5 in the shader. Can you open that one up to a material property instead? For my case, a smoothness of 0 provides the desired results.

    I also saw a few settings on the shader that might not be great for performance?
    • Render Face: Both <- I would imagine for most surface shaders the default of Front would be best
    • Cast Shadows: Enabled <- Text casting shadows maybe unnecessary for the majority of cases?
    Of course, I'm happy to just clone your shader and make our own but thought I would mention it anyway.

    Separately, the bevel doesn't seem to work in the shader? Changing those settings doesn't do anything for me at least.
     
    Last edited: Feb 12, 2022
  40. Gawidev

    Gawidev

    Joined:
    Jan 28, 2021
    Posts:
    8
    Hey uhh, I seem to have the same issue but with URP instead. The Unlit shadergraph throws the same error about the same property(_ScaleRatioA), and the Lit one for multiple other properties ( '_TextureWidth', '_TextureHeight', '_WeightNormal', '_WeightBold'). I'm on Unity 2021.2.8f1, URP 12.1.3 and TMP 3.2.0-pre.2. Screenshot 2022-02-15 162345.png Screenshot 2022-02-15 162412.png
    I even did a full fresh uninstall then reinstall of tmp preview but no luck. Any ideas as to what might be the source?
     
  41. Gawidev

    Gawidev

    Joined:
    Jan 28, 2021
    Posts:
    8
    Okay well as it should have been obvious to me, that last question might be dumb. Simply adding the properties in the shadergraph files stop the errors from popping up. I guess I'm wondering if this will impact the other stuff thats also in the shader.
     
  42. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    713
    Hey @Stephan_B , firstly thanks for the shader graph thing, it really is a game changer for texts in Unity :)

    I'm now just wondering why reflectivity and such are still features of the graph when you can simply use smoothness and metallic from HDRP? Wouldn't it be much simpler to have a graph that simply outputs the text with no fancy stuff and let people extend it through the graph?

    Also, is there a VFX graph shader planned? That would be gold.

    upload_2022-3-1_7-51-36.png
     
  43. CelesteMarina

    CelesteMarina

    Joined:
    Jul 28, 2013
    Posts:
    13
    Looks like the preview works as intended!

    If I can throw in my 2 cents: It'd be neat if the package as-is had the emission nodes hooked up for the SRP shaders. The emission works just fine, but to do it properly you'd have to change the custom editor, which is a bit annoying for someone who doesn't know how the TMP editor scripts are actually structured.

    For anyone else looking to something similar: TMP_SDF_HDRPUnlitShaderGUI.cs was the relevant file for (no points for guessing) HDRP unlit.

    I added

    if (m_Material.HasProperty("_Emission"))
    {
    DoColor("_Emission", "Emission");
    }

    under DoFacePanel(). I also added an emission property within the shadergraph with the same reference "_Emission".

    Notably Unity will also fight you over trying to modify the package cache, but if you persist you seem to be able to beat it. Really bad workaround considering how fickle it is, but it works.
     
    Last edited: Mar 5, 2022
  44. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,189
    If you're going to be modifying packages, then it's probably best to copy the package to some other directory, and point the package manager at it via a "local" declaration in package.json. (https://docs.unity3d.com/Manual/upm-ui-local.html) Otherwise, if you're editing things within the package cache directly, it's probably only a matter of time until your edits get reverted by Unity. I've done this a few times when I needed a quick fix to a bug in a package.
     
  45. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    713
    Hey @Stephan_B , just so you know, the Shader Graphs don't work on consoles, all texts authored with them render in pink.
     
  46. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Do other shader graph shaders work?

    Since the shaders are no longer included in a Resources folder, they won't be included in the build unless referenced. Double check the SRP shaders are included in your build. Alternatively, you could create a simple scene with one text object using one of the shaders and see if it renders correctly.
     
  47. URocks

    URocks

    Joined:
    May 1, 2014
    Posts:
    159
    I tryed the shader graph materials but they doenot support Masking (I tried them in TextmeshproUGUI with Rect Mask 2D). Can you please add masking support? Thank you very much
     
  48. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I will have to check if that is possible in ShaderGraph.
     
    URocks likes this.
  49. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    505
    I have found several issues with the experimental SRP support (3.2.0-pre.3) using the URP Unlit shader while I was experimenting with it:

    1. I had to add this (presumably missing) check in the code (circled in red in the image below) to fix exceptions thrown when rendering some texts.

    2. Rich text (at least strings containing <size> tag) would not render. The layout size is correctly calculated, but nothing is rendered.

    3. If all characters in the text have no glyphs in the font asset, the preferred height reported by the text layout is 0 while the non-SRP shader does not share this behavior.

    4. Outline colors leak into the edges of the rendered text even when their width is 0, making the edges look jagged. My text does not need outlines while the current shader cannot disable outlines.

    5. The anti-aliasing/softness of font face does not match that of non-SRP shaders. I had to set face softness to 0.145 on the SRP materials to match.

    6. The URP Unlit shader still has (local?) lighting effects. Bypassing the EvaluateLight node appears to resolve the issue.

    upload_2022-4-25_1-16-52.png
     
  50. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    505
    @Stephan_B Please see my posts above. If you need bug report for each of the issues please let me know.