Ericky14 Posted February 7, 2018 Share Posted February 7, 2018 Hello, I am making this post to discuss possible improvements to the GUI text system. Right now, when generating new text, it can be very slow if you have a lot of it in the screen. One clear improvement would be to pre-generate (or cache) each letter as an object and just generate instances of that object, which turns out to be very very very fast. However, that is not very easy to do as letter spacing can be a hard thing to manage when positioning each letter next to each other. Is there any easy way this could be improved in the babylonjs side to increase GUI text creation speed? Or is there any other solutions for this problem? Quote Link to comment Share on other sites More sharing options...
Guest Posted February 7, 2018 Share Posted February 7, 2018 Not sure this could work as you will trade text writing for image copy + text wrapping and so on How do you measure that text generation is slow? Do you have a repro case? If you let the text unchanged it should not be regenerated Quote Link to comment Share on other sites More sharing options...
Ericky14 Posted February 7, 2018 Author Share Posted February 7, 2018 It's pretty simple to repro. What I mean is that I am trying to generate 100+ dynamic texts with a few different fonts and depending on the amount, it can take up to 30+ seconds. Even if I offset the generation of each by a few milliseconds, it still drops the fps quite a bit. The dynamic resolution is 256x256 btw. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2018 Share Posted February 8, 2018 Please repro in the Playground so I can have a look Quote Link to comment Share on other sites More sharing options...
Ericky14 Posted February 10, 2018 Author Share Posted February 10, 2018 Here, http://www.babylonjs-playground.com/#9U086#181 This is a basic example, you can see how it takes a few seconds to instantiate everything.. in my use case, I have 3 different types of fonts and about the same amount of texts. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted February 10, 2018 Share Posted February 10, 2018 beeeteee dubs... if you add a sting to a number it converts it to a sting automatically... so toString()+'px' is useless. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 12, 2018 Share Posted February 12, 2018 it is immediate on my computer This is weird can you profile it? Quote Link to comment Share on other sites More sharing options...
Ericky14 Posted February 14, 2018 Author Share Posted February 14, 2018 Sorry, I posted the wrong one... I guess the one I did didn't save. Here's the right one. http://www.babylonjs-playground.com/#9U086#187 Quote Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2018 Share Posted February 15, 2018 Even if I remove the text the start is slow due to the number of textures to generate it is clearly faster if you reduce the texture size: http://www.babylonjs-playground.com/#9U086#189(line #39) Quote Link to comment Share on other sites More sharing options...
Ericky14 Posted February 15, 2018 Author Share Posted February 15, 2018 Here, this is the kind of solution I proposed. Maybe we could have something similar on the babylonjs side... just a suggestion. This is just a simple example of the system I built. http://www.babylonjs-playground.com/#9U086#197 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.