Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    54
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    54
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    305
    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:
    186
    Same here, any news on this topic?
     
  13. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    186
    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. FloBeber

    FloBeber

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

    Marald

    Joined:
    Jan 16, 2015
    Posts:
    42
    @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:
    186
    You are welcome!

    Batching works here.
     
    Marald likes this.
  17. Reahreic

    Reahreic

    Joined:
    Mar 23, 2011
    Posts:
    254

    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:
    20
    * Window/TextMeshPro/Import TMP Essential Resources this worked for me
     
  19. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    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
    bluemountain98 likes this.
  20. bluemountain98

    bluemountain98

    Joined:
    Jan 6, 2019
    Posts:
    1
    @Brady I'm seeing the same thing. Did you figure it out?
     
  21. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    No, not yet. But I am able to reproduce the issue by creating a new project in 2021, add URP 12.1.10, TMPro 3.0.6, and in my case I'm using Valve's OpenVR XR plugin ver 1.1.4, and making sure it's set to single-pass instanced rendering.
     
  22. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Bizarrely, after perfectly reproducing the issue with the above mentioned empty project, I toggled some XR plugins on and off again, went back to the original configuration that was reproducing the issue before, and suddenly the issue will no longer reproduce in the empty sample project, no matter what I do. But I tried doing the same in my actual production project and the issue persists. So I inexplicably lost my repro test case. I'm utterly confused and still at a loss for what to do to solve the problem in my actual project.
     
  23. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    245
    I'm suffering from this, and swapping out shaders and using TMPro ones I found online isn't helping - is there a definitive solution out there yet?
     
  24. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I think in my case, it may have been an issue with some kind of interplay between the newer URP version I'm using and Valve's OpenVR XR plugin. After removing the OpenVR plugin and using the generic OpenXR plugin instead, the problem appeared to go away, even after re-installing the OpenVR plugin again later. If I learn more, I'll update this thread.
     
  25. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Okay, the above may be inaccurate. It resurfaced later on at random after the Valve OpenVR plugin had been removed from the project. Strangely, this time however, it would start out as usual with not rendering in the right eye and being warped, but then after a second or so, it would snap correctly into place, and the text would render in the right eye...sort of...but just as solid, filled blocks of color. In other words, the text looked normal in the left eye, but in the right eye, its as if each character was just a colored quad fitting the dimensions of the character it was meant to contain.

    Steps I took to "fix" it (in quotes, because this seems like something that in its present state could randomly and unexpectedly resurface again later):

    1. My project was using the Oculus XR Plugin, so I switched it from Single-pass instanced to Multi-pass just to confirm that the problem would disappear, and indeed it did.

    2. So reasoning that this HAD to be some kind of shader issue, I selected the shader of the text in question (TMP_SDF), right-clicked it, and chose "Reimport". Re-ran the game and BAM, problem solved.

    I'm increasingly disturbed by how many things I keep finding can be fixed by simply manually reimporting an asset, which tells me there's some weakness in the way Unity caches things that's subject to corruption.