[EXPLAINED] Optimizing Text Draw to Reduce LOAD

  • This question on the Isadora User Group from Tony Schulte: "Has anyone noticed the text draw actor eats up resources like crazy? I have 4 and my load is 200%"

    The Text Draw actor must draw into a CPU based bitmap, and this is, unfortunately, inherently slow. Performance on MacOS is a bit better than Windows in this regard, but it is still slow on both platforms.

    Why? Think of what this the operating system must do to draw a character: it must calculate all the bezier curves that make up the character, and then render that  geometrically complex image into a CPU based bitmap while anti-aliasing all of the edges. It's a lot. (It's not possible using the normal operating system text drawing functions to draw directly into a GPU based texture; you must first render it into a bitmap and then upload it to the GPU.)

    (FWIW: I feel certain that tools like Adobe Photoshop are just as slow, but you don't notice the delay in rendering when you hit "enter" after generating a large text bitmap. I just tried rendering 360pt text into a 1280x720 canvas. When I drag the text around, the "frame rate" as I drag is noticeably slow.)

    The key thing to keep in mind is resolution of the Text Draw actor bitmap and what the 'font size' input says. For example, if the 'output width' and 'output height' inputs are zero, then the Text Draw actor uses the default resoution set in your preferences. By default this is 640 x 360. If the font size input is 50%, then you are drawing characters that are 180 pixels high. If the text string you are drawing is long, this will make matters worse even if those characters go past the end of the bitmap because all of the characters still get drawn. If the resolution is large (e.g., 1920x1080) and you're drawing text at 50% font size, then you're drawing characters that are 540 pixels high, and matters are worse.

    The thing to do to improve performance is to reduce the size of the bitmap into which you're drawing. For example, let's say you need four text draw actors as you say, and the image of that text on the actual output stage is not terribly big. Set the 'output width' and 'output height' to a smaller size that accomodates the text, and then use the Projector to zoom the text to the necessary size and move it around the actual stage as needed. The smaller the bitmap used by Text Draw, the better the performance you will get. (You can also use the Matte actor to zoom and move the text if you need.)

    In my example file below you'll see the LOAD measurements on Windows for the following resolution and font sizes:

    (Resolution, Font Size, Load)

    640x360 at 10% = 17%
    640x360 at 25% = 19%
    640x360 at 50% = 23%

    1920x1080 at 10% = 83%
    1920x1080 at 25% = 102%
    1920x1080 at 50% = 107%

    1280x360 at 10% = 23%
    1280x360 at 25% = 25%
    1280x360 at 50% = 31%

    640x180 at 10% = 13%
    640x180 at 25% = 14%
    640x180 at 50% = 18%

    1280x180 at 10% = 16%
    1280x180 at 25% = 19%
    1280x180 at 50% = 19%

    As you can see, rendering into a 1920x1080 bitmap is 4.8 times slower than 640x360 with a 10% font size.

    So, to make things as efficient as possible: make the bitmap used by the Text Draw actor as small as you can, and raise the 'font size' percentage to a higher number. Then you can scale the result using the Projector or Matte actors -- which happens in the GPU -- and things will be as efficient as possible.

    I hope that helps.

    Best Wishes,

  • @mark

    Thank you for the clear explanation but a problem stay: you lost a lot of draw quality with a smaller output

    or I am missing something in the parameters?



  • @jfg said:

    Thank you for the clear explanation but a problem stay: you lost a lot of draw quality with a smaller output

    This depends entirely on how big the text appears in the output.

    If you are rendering text really large and want it to appear beautiful, then you need to use the full resolution of the stage. For example, if you wanted this the word "ISADORA" to fill the stage and have with no "jaggies", then you'd set the 'output width' to 1920 and the 'output height' to 1080, and set the projector to 100%

    Here's that image

    And a close up so you can see the "jaggies" -- obviously they are very smooth.

    But if the text is going to rendered smaller than that in the actual output, then you can optimize by using a lower resolution. Here's an image with Text Draw's horz and vert ouput size set to 640 x 360 and the font size set to 37%, but with the projector set to show that image at 25%

    And a close up to show that the edges are still smooth.

    In other words, what is not efficient is to set the horz and vert output size to 1920x1080, and then render the text using a font size of 2% or something like that. Your rendering into a giant bitmap even though the text might show up on the display like this:

    Do you get what I'm saying here?

    To reinforce the main point: rendering giant fonts is going to be slow. To empahsize that, unzip this movie and watch the slow frame rate in Photoshop when I attempt to massive text around within a 1920x1080 image.

    Best Wishes,

  • @mark

    Dear  Mark

    Thank you very clear