Holusion / eCorpus

3D Explorer and interface
https://ethesaurus.holusion.com
3 stars 0 forks source link

No-jitter models loading #63

Open sdumetz opened 4 months ago

sdumetz commented 4 months ago

Reducing renderer jitter on model loading would enable loading smaller models seamlessly in a (yet to be developped) dynamic LOD system.

Using WebGLRenderer.compileAsync() from THREE r161 (#27098 seems to reduce the initial blocking time by half for a given model, without much effect on other metrics.

Additionally, WebGLRenderer.initTexture() does drastically reduce upload freeze for models with large textures and low (ish) vertex count, especially if it is able to load textures through multiple frames.

sdumetz commented 4 months ago

Detailed test results. Tests were made with dev build in standalone mode, mean of 3 runs. Looking for the sum of [Violation] 'requestAnimationFrame' handler took <x>ms reported during object loading. Results should be considered accurate within ~10% of their value.

Model / Test Delay (mean)
*10M Vert. 52k tex.**
- initial 1380ms
- compileAsync 814ms
- initTexture 796ms
- compile+init 804ms
*25k Vert. 18k tex.**
- initial 675ms
- compileAsync 480ms
- initTexture 74ms
- compile+init <50ms

Both model were purposefully chosen quite large to better show the performance bottlenecks. We see that it's possible to largely speed up texture loading but large geometries will stay a problem unless we find some additional optimizations.

The geometry limit is not that much of a problem because keeping the vertex count below the 1M (arbitrary) limit is easy enough in most cases.

sdumetz commented 4 months ago

Running the previous tweaks on large multi-model scene, we go from there :

Image

To there

Image

Which is better but shows how an unoptimized model is unlikely to load seamlessly.

Ensuring a serialization on renderer.initTexture() seems to help a bit : It makes intuitive sense as models loading in parallel might otherwise try to init their textures during the same animationFrame. load time improvements were however not clear enough to be sure about this.

Compressing the scene's larger models into 2k maps (from 30MB total size to 15MB) still yields some delayed frames which tends to indicate some other source of contention to uncover.

Some of this contention seems to come from the environment map being loaded more than once.

sdumetz commented 4 months ago

See https://github.com/Holusion/dpo-voyager/tree/seamless_load_proto for ongoing efforts