Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

TextMeshPro and Single Pass Instanced stereo rendering

Discussion in 'UGUI & TextMesh Pro' started by briank, Jul 26, 2018.

  1. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    74
    Right now, if XR settings use "Single Pass Instanced (Preview)", you only see the text in the left eye (and not the right).

    I saw another thread where someone added the instancing goo to their local copy of the TMP shader and claimed that fixed the rendering. While that is the best solution I've found, it doesn't seem very maintainable. I'm wondering if there is a better way to do this, and if not, is support going to be added to a future version?
     
    P_Jong likes this.
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    I haven't had time to look into this but most likely, this would require a custom set of shaders with single pass support. The resulting shaders might not be unlike the one in the thread you referenced.
     
  3. Kevin-VFX

    Kevin-VFX

    Joined:
    Apr 17, 2016
    Posts:
    48
    I have fixed this on my end, but it would be nice if I didn't have to manage this issue every time a new project is using stereo instancing. It only takes a few minutes per shader to implement the fix. Should I post one of the fixed shaders to give you an idea of what to do?
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    I would suggest you post your modifications as it will be useful to users in need of similar solution and until I get around to including something similar in the package.
     
  5. Kevin-VFX

    Kevin-VFX

    Joined:
    Apr 17, 2016
    Posts:
    48
    Here's one of the shaders that have been updated to support stereo instancing. Compare it to the original to see what was changed so you can update the rest. Hope this helps out some people.
     

    Attached Files:

    P_Jong and Stephan_B like this.
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    What specific shader are you using?

    Make sure you are using the latest TMP Essential Resources / Shaders from version 2.0.1.
     
  7. Deleted User

    Deleted User

    Guest

    @Stephan_B I'm not entirely sure if I'm doing something wrong.
    • I've updated TextMeshPro to 1.5.0 preview 2
    • I've created a Text (TMP) and placed it infront of the camera
    • The Text is automatically using the TextMeshPro/Mobile/Distance Field shader
    • I'm looking at it under Windows Universal Platform with the Mixed Reality Headset
    The text renders to one eye only. Isn't that supposed to be fixed or do I have to pick a shader manually?

    Edit: The Distance Field (surface) shader seems to be capable of rendering correctly

    Why is the updated shader not in the package yet, it's from April?
     
    Last edited by a moderator: Nov 22, 2019
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The Shaders are contained in the TMP Essential Resources. As such, you need to re-import the TMP Essential Resources via the Window - TextMeshPro - Import TMP Essential Resources menu option.
     
    Deleted User likes this.
  9. awesome_suri

    awesome_suri

    Joined:
    Dec 10, 2016
    Posts:
    5
    Seems like this was solved last year. But I still have this problem when using HDRP single pass instanced. Are there also special shaders to make TMP work? I tried the Distance Field (surface) but this one is not supported in HDRP.

    I'm using HDRP 7.3 on Unity 2019.3.9 with TMP 1.0.54.
     
  10. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Version 1.0.54 of TMP is a Legacy AssetStore version that is several years old. Since Unity 2018.1, TMP updates and releases have been available exclusively via the Package Manager.

    The latest release for Unity 2019.x is version 2.1.0-preview.13 which was released this week. Since you are still using a Legacy version from the Asset Store, you will need to migrate your project to the newer release formats and carefully following the instructions outlined in this sticky post in this section of the forum.

    Once you are done upgrading to the latest release, you will find the updated shaders in the TMP Essential Resources which are part of the package.
     
  11. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    301
    Hey @Stephan_B, I've got the latest (3.0.1) and have freshly imported the TMP Essential Resources, but it still only renders in the left eye in my Single Pass Instancing VR project. I've seen a few other recent threads about this. Was there a regression or is there a way to fix this?
     
  12. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    168
    Same here, any news on this topic?
     
  13. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    168
    We fixed it by re-importing the essential resources. We thought that will be done, when upgrading the package via the package manager, but this is not the case.

    So for other people which may have an outdated tmp package or the sympthoms like above (missing font on left/right eye in vr)

    * Update to newest version of tmp via the package maanger
    * Window/TextMeshPro/Import TMP Essential Resources -> There you will see that some shaders are outdated
     
  14. FlorianBernard

    FlorianBernard

    Joined:
    Jun 9, 2015
    Posts:
    165
    Thanks for sharing your solution @Zapan15 !
     
  15. Marald

    Marald

    Joined:
    Jan 16, 2015
    Posts:
    41
    @Zapan15 your a life saver! thanks for posting this solution.

    Had it before in 2017 and later in 2018. Now I just updated project to 2019.4 and again the TMP problem. But your fix fixed it. Will it batch render / instance the text shader now as well? Especially in VR when using a lot of TMP objects I noticed a big jump in CPU usage caused by TMP in the render pass in prevous versions of unity
     
  16. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    168
    You are welcome!

    Batching works here.
     
    Marald likes this.
  17. Reahreic

    Reahreic

    Joined:
    Mar 23, 2011
    Posts:
    282

    Sadly his didn't work for us, no clue why as I could have sworn the UI was working before we implemented a Custom render pass. (Turned the pass off, but it had no affect.)
     
  18. Sword111

    Sword111

    Joined:
    Feb 28, 2016
    Posts:
    19
    * Window/TextMeshPro/Import TMP Essential Resources this worked for me
     
  19. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,447
    I'm having the same issue with it not rendering in one eye, and also it skews as you rotate your head if that adds any pieces to the puzzle. Importing TMP Essential resources had no effect (other than breaking two of the shaders due to a bad #import path which I had to resolve by manually editing the shaders). This is on 2021.3.18f1, and TMPro package 3.0.6. Also using URP 12.1.10.

    I just upgraded from 2019.4 where everything was working correctly. And since upgrading, I've also noticed that this same skew and one-eyed rendering is happening to all my other existing CG-based shaders, despite them previously working correctly in URP 7.7.1. Long ago I added all the things needed for stereo instanced rendering mentioned here:

    https://docs.unity3d.com/Manual/SinglePassInstancing.html

    But now in 2021 and URP 12.1.10, they are only rendering in one eye and warp when the head is rotated. I hope this helps zero in on the TMPro issue as it seems identical to these issues and therefore likely related since they are all still in CG like all the other shaders that exhibit this same weirdness. All my HLSL and Shadergraph shaders seem to work fine.
     
    Last edited: Feb 22, 2023