5

I'm loading several STL files (one by one) into the same scene. Those files are different LODs of the same model (from low-poly to high-poly). I'd like to simulate a continuous model update from low to high resolution.

I tried to create a separate mesh for each LOD and add it to the scene when removing the previous one. Unfortunately, as the LODs get bigger, there is a significant delay in rendering.

See the example and full code

My questions: - would it help if I just replace the geometry in the same mesh without recreating the mesh? If so, how to force rendering update? I tried to use mesh.setGeometry, but it doesn't seems to work for STL geometry - the new geometry is shown (perfectly works for Cube, for some reason). - is it possible to speed up the update somehow by any sort of pre-calculations or caching?

Thanks a lot in advance for any hints. Simon

Simon
  • 113
  • 1
  • 8
  • 1
    Can't you use the LOD mechanism already existing in three js ? See https://github.com/mrdoob/three.js/blob/master/examples/webgl_lod.html for eg – Popov May 21 '13 at 07:36
  • @Popov : The LOD example has exactly same problems - each LOD level is actually a separate Mesh object and there is a visible delay when several LODs switch levels at the same time. I thought that replacing geometry instead of recreating the Mesh object will help, but can't figure out how to make it update itself on the screen. LOD object has `update()` method - I'll try something similar. – Simon May 22 '13 at 00:26
  • Links not working anymore! – Nikola Lukic Feb 06 '17 at 07:46
  • did you tried to dispose the geometry before assigning it ? – houssk Feb 15 '21 at 15:11
  • What worked for me is `mesh.geometry = newGeometry; mesh.updateMatrix();` – Miro Oct 18 '21 at 04:33

0 Answers0