Search Unity

TextMesh Pro to texture

Discussion in 'UGUI & TextMesh Pro' started by undefined_error, Feb 11, 2019.

  1. undefined_error

    undefined_error

    Joined:
    Jan 18, 2019
    Posts:
    4
    Is there any way to get a texture out of a TextMesh Pro object? So to use it as a texture map for a material?

    Thank you.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I would suggest using a RenderTexture.

    There should be a few posts detailing how to set that up.
     
  3. undefined_error

    undefined_error

    Joined:
    Jan 18, 2019
    Posts:
    4
    Thank you Stephan for your reply.
    That is what I have been trying to do, but the result isn't that great.

    upload_2019-2-12_12-3-50.png

    I have been using the TextMeshPro/Distance Field (surface) shader on the mesh material, and playing around with dilate/softness values helps a bit, but looking at the contours it seems clear that the the tilted edges - see "Y" - are well jagged to begin with.

    upload_2019-2-12_12-23-22.png

    Unless I am doing something very wrong, it doesn't seem like RenderTarget is a good solution for this.
    I feels like it adds and extra trip which invariably worsens quality.

    I was hoping there would be a way to avoid it and get a texture straight for a textMeshPro script.
     
    Last edited: Feb 12, 2019
  4. CelesteMarina

    CelesteMarina

    Joined:
    Jul 28, 2013
    Posts:
    13
    This is a very belated reply, but this was in the google search results so I figure it's worth responding to...

    I believe what Stephan is referring to is using Graphics.Blit or a similar method to render the SDF material's output to a render texture, *not* capturing the textmesh with a camera to a render texture.

    With a bit of playing around, you should be able to use the Distance Field material from your TMP object to render to a texture.
     
    t_tutiya likes this.