Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Path Tracing Text?

Discussion in 'HDRP Ray Tracing' started by GregBahm, Jun 21, 2021.

  1. GregBahm

    GregBahm

    Joined:
    Jul 1, 2014
    Posts:
    11
    Does anyone know how to get text to render while path tracing? Default Unity Text Mesh objects and the Text Mesh Pro UI elements seem to just be invisible while path tracing is active.
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Those shaders are just not supported with Path Tracer (same thing with 3D Text or TextMeshPro).
    Only HDRP Materials (except Hair, Eye and Decals) are added to the acceleration structure, any other shaders won't appear with Path Tracer on.

    As of right now, there's nothing you can do to make them visible.
     
  3. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    I'm using 3D mesh text (GlyphMeshZ on AssetStore) that outputs standard MeshRender, but there is a nuance if text generated runtime: there will be tremendous freezing for 1-5 seconds when 3D text is generated - ray tracing needs to update whole *?* "acceleration-structure-something" for it, even if this 3D text is just one symbol. But if all 3D text generated at level start it's possible to have only one freezing moment of that kind.
     
    Last edited: Jun 26, 2021
    PutridEx likes this.
  4. GregBahm

    GregBahm

    Joined:
    Jul 1, 2014
    Posts:
    11
    Thanks for clarifying. What is the "acceleration structure?" I am new to ray tracing but was expecting to be able to implement a path-tracing-compatible SDF shader myself if one didn't already exist. Is this not possible?
     
  5. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    I'm not graphics programmer - can't really help with that, this kind of question is for serious people )
     
  6. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
    Can you share if there is a plan to make TMP compatible with Path Tracing?
     
  7. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    AFAIK, there's no plan to support it in the near future.
     
  8. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    Here is my solution for even moving text or movies during path tracing.

    Pathtracing is started with 4096 samples. Screenshot taken at half time.

    upper plane, normal rendered spout input stream.is frozen when pathtracing started and not readable because moving time.

    lower plane, rendered per custom pass without TAA -> even during pathtracing the animated input stream is moving nicely (fast moving time counter here) and it is rendered sharp.

    moving text.JPG

    Custom Pass setup for plane. Plane is on Layer NoTAA.

    Unbenannt.JPG

    also set it up Before Post Process

    Unbenannt.JPG

    You can find the custom pass here.
    Render Video Without TAA
    https://github.com/alelievr/HDRP-Custom-Passes
    There are also other Custom Passes for UI. But i checked only this one in DXR.

    So you can render your text to an render texture and then inject it per custom pass like so.

    Even a video stream or text animation like here is working during path tracing then nicely readable and crystal sharp. In this case i send it in via spout stream which injects a render texture into an Unlit material.

    Probably it helps.
     
    Last edited: Jul 15, 2021
    chadfranklin47 and jeremedia like this.
  9. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
    Thank you @keeponshading , really appreciate the breakdown. I'll be using this technique for promo videos for sure.

    @chap-unity please let us know if there is anything we can do to help move TMP up in priority for enabling in path tracing. Scenes in my exhibition building app look amazing path traced, but the title cards are blank, which is sad.

    1a4b5dbe-b933-4180-bc40-2a45f7245c82.png
     
  10. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    jeremedia likes this.
  11. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Current version of Unity 2021.2.0f1 has some improvements on Pathtracer.
    But Pathtracer progress hangs after a second here!
    Anyone?
     
  12. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    I indeed found some issues on 2021.2.0f1 when you have scene and game view side by side. Pathtracer does not converge anymore. I made a report and it will be investigated.

    In the meantime, having ONLY scene or game view seems to make the pathtracer converge properly.
     
    jeremedia likes this.
  13. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    229
    Are there plans to support the Hair and Eye shaders?
     
  14. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    In the latest versions, Unity Pathtracer already supports the new hair model (named Physical).
    The Approximate mode (it's called that way because it's not Physically Based and does not follow the energy conservation principles) is not supported and there's no plan in the near future to support it. More detail on the doc.

    For the eyes, sadly, there's no plan either for now, but it's not impossible to support it if there's enough demand for it.
     
    TerraUnity and chadfranklin47 like this.
  15. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Hey, just want to add here to the list of workarounds.

    It's not perfect and does not support occlusion of the texts from transparent (because they aren't in the depth buffer) but it's still easy enough to consider it in certain scenarios.

    Basically, you just need to put all your texts in a specific layer (let's say UI for the sake of the exemple)
    upload_2022-3-15_14-47-43.png

    and add a Draw Renderer Custom Pass to draw all queue but only this layer after the pathtracer (Before Post Process injection point).

    upload_2022-3-15_14-48-29.png

    Hope this helps.
     
    Last edited: Mar 15, 2022