Is there a way to know that Three has compiled and tesselated everything?


On startup it lags behind, and looking into devtools there’s a huge chunk of processing code, especially for the THREE.FontGeometry.

I would like to cover the scene and start animating when it’s finished with all the churn. I’ve tried LoadingManagers or calling gl.compile(), but it only seems to handle assets and shaders, now i’m messing with timeouts and idleCallbacks, but it seems dirty.

How is this normally being handled, seems like this would be a problem many apps face.

Have you already tried to precompile the shaders before you start rendering? You can do this with WebGLRenderer.compile().

this i did, also i’ve set things to frustrumCulled={false} just in case. But i guess Three parsing textgeometry just doesn’t happen in the same space.

Well, the generation of TextGeometry happens synchronous. Meaning you know right after the constructor call that the computational heavy work has been done. This overhead is also unrelated to rendering.

for real world projects, are there any guidelines how to handle objects that take long to go up? i’ve searched a while, but all i could generally find was defaultloadingmanager and pre-emptive shader compilation.

though now that you mention it, gave me an idea. in react we have suspense, it knows when objects are blocked, if they load something asnyc. if i add some callback that does synchroneous stuff afterwards i could potentially prolong loading state. i’ll play around with it, could perhaps really solve it …

have a first version ready, looks very promising i think:

will need some work, but what happens here is that you can dump anything that either loads stuff async or takes a while to process into the Suspense boundary. everything in there is now load controlled. the Startup component zooms the cam in, but since it resolves when everything else is ready, it makes for a super easy path to loading screens that don’t just mind DefaultLoadingManager fetch states, but triangulation and setup as well.