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

Text is black in game view when using Distance Field (Surface)

Discussion in 'UGUI & TextMesh Pro' started by Deleted User, Aug 16, 2019.

  1. Deleted User

    Deleted User

    Guest

    Delete me
     
    Last edited by a moderator: Aug 16, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The Distance Field Surface Shader is a lit shader and as such requires lighting. Otherwise the text will be black.
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    Thanks for the clarification.

    I need an unlit version though. All I need is bevel and glow to work on normal text. I'm trying to modifying the shaders myself by removing all the lighting code, and the glow works, but for some reason, the bevel won't show up in the Game view.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Why are you not using the normal full Distance Field shader? It is unlit and has support for bevel and glow.
     
    Deleted User likes this.
  5. Deleted User

    Deleted User

    Guest

    Ok, I see the problem now. I was using black for the Glow color to create a non-directional drop-shadow effect, which worked fine with Distance Field (Surface), but produces no results with the regular version. I've used the underlay effect instead, which gives the same results with the normal Distance Field shader.

    I had a bit of a tough time getting the bevel to look as soft as it was with Distance Field (Surface), but eventually got it to work with two tweaks to the shader:

    1) increased range of _BevelWidth from (-0.5, 0.5) to (-1.0, 1.0) in TMP_SDF.shader (A value of 0.875 worked for me)

    2) in the function GetSurfaceNormal from the file TMPro.cginc, I had to replace _GradientScale with 3 to get a nice soft bevel. Decreasing it from 17 down to 3 in the Debug section of the inspector gave strange results with dark shading everywhere.

    Anyways, it looks exactly liked wanted now, so thanks for the help!
     
    Stephan_B likes this.