microsoft / mixed-reality-extension-sdk

The Mixed Reality Extension SDK enables developers to build 3D world extensions for AltspaceVR, using Node.JS.
MIT License
142 stars 61 forks source link

Text is backward #124

Closed stevenvergenz closed 5 years ago

stevenvergenz commented 5 years ago

Text faces the wrong way: -Z instead of the Unity conventional +Z.

sorenhan commented 5 years ago

We can either fix it, or provide helper functions for the cases where it hurts, or choose to live with this. There is a cost (both code complexity and performance) with simply flipping the text and leaving everything the same)

eanders-ms commented 5 years ago

Seems like something we should account for on the Unity side.

stevenvergenz commented 5 years ago

Agreed, except for that I don't know of a way to apply a transform to it without generating a new GameObject. And that introduces a lot of complexity too.

sorenhan commented 5 years ago

Text flipping investigation:

  1. Testbed/TextMesh: We currently don't have a custom shader in our unity samples. We actually have a z-sorting shader in the testbed unity scene, and use it for all the custom testbed elements, we just don't use it in the actual SDK elements. We should be able to switch that, and make the flip-on-x change in there. Sounds pretty easy.
  2. AltspaceVR/TextMeshPro: The shader is available, and we can modify it, and it mostly worked when doing vert.x*=1.0f; - it does look like it's just one drawcall with all letters being added relative to an offset. There were problems: a. it would affect altspace elements, too -> we'd need to fix things b. culling needs to also be updated, that's outside the shader c. it still does some weird jumping in some instances, as if the origin can move around, and the shader counteracts d. sometimes, but not always, text changed to purple squares.

I see 3 possible solutions:

  1. add extra child gameObject for the text issues, with x=-1. Extra gameObject overhead
  2. modify shaders, and compensate in TextMeshPro as needed. Custom TMP shader=overhead when merging in new TMP changes, and possibly a per-pixel overhead. Not sure how extensive the TMP changes would be - it may be easy and reliable, or may end up being fragile, more investigation needed
  3. Accept that text is backwards, and add a LookAwayFrom option to the lookAt functionality
sorenhan commented 5 years ago

We've decided that "text is backward" is the a perfectly fine solution, so we won't even try to change it