Download

Render tons of text?

I’m trying to pair up a HISM of variable count to text.
I tried adding a text render component to each instance.
This results in an exponential performance drop of around 90% or so. If not even 99% once you exceed 1000 instances.

The text to display is short hand alpha numeric - think chessboard cell values.
Swapping it on the texture of the object seems like a bad idea because of instancing.

Right now, I’m thinking of doing instances on a per row/column basis.
That’s 2 additional instances per original instance, and 200 additional instances overall (so the load should be horrible).

Looking for additional ideas.
Possibly stuff that doesn’t require meshes.

Ideas, well. How about using a counter-material? Texture with the numbers, use offsets to get each number. Create dynamic instance and set the number. Add up the values for each digit by shifting the UV coords. This will result in compiled shaders with no text-rendering, AA and stuff involved.

Maybe I am missing a little detail, why this should not be working or is a bad idea, than let me know.

Well, the HISM uses small meshes with localized UVs, so I was thinking it would be easier to directly output the number into the texture somehow.

But your idea can work too. Basically just use the count to cut up the proper texture of the number. on a world position basis - or something the like…
It’s not ideal maybe, but it’s not a bad idea…

I managed to prototype the material. You can use a single texture with all numbers as a flipbook. In the sample screenshot you can see a sample texture with 64 numbers as colors. You can change that to use a texture with digit 0-9. In my example it renders index 11 and index 27 from 2 parameters. Which could be the first and second digit. A simple custom node:

if ((UV.x < 1.0f) && (UV.x > 0.0f)) return RGB;
return 0.0f; 

After that you can add up the digits in that one pass to render them one after the other.

It has the benefit that the shaders are compiled and run in parallel without any extra costs. How do you like that?

Should work fairly well for what I have in mind. Thanks, I’ll give it a try.
Wouldn’t even have thought about using the flipbook tbh.