Search Unity

TextMesh Pro What is USE_DERIVATIVE in TMPro_Surface.cginc?

Discussion in 'UGUI & TextMesh Pro' started by awardell, Jan 3, 2022.

  1. awardell

    awardell

    Joined:
    Feb 5, 2014
    Posts:
    71
    Around line 14 in TMPro_Surface.cginc there is the directive
    #if USE_DERIVATIVE


    What is the intent of this directive? Is it actually defined anywhere? All of my google searching only turns up the Text Mesh Pro cginc files.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    This was a potential option to use Screen Space Derivative or SSD which is functionality that is now available in the TMP shaders with the SSD suffix at the end of their names.

    With the normal shaders, we need to pass scale to the shader whenever the scale of the text object or its parent changes. With SSD shader we don't need to do that but it comes at a higher performance cost in the shader. So conveniences vs. efficiency. For text objects that won't change scale, the normal shaders are more efficient.

    These SSD shaders are contained in the TMP Essential Resources.
     
    awardell likes this.
  3. awardell

    awardell

    Joined:
    Feb 5, 2014
    Posts:
    71
    That would be TMP_SDF SSD.shader and TMP_SDF-Mobile SSD.shader? So what you're saying is the USE_DERIVATIVE option is no longer used by the surface shader?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Correct.
     
    awardell likes this.