Performance of scene traversal

each mesh will cause a draw call, more draw calls mean more overhead. if you have events/raycasting it traverses all suitable meshes each frame. the edges are probably the most expensive in your scene.

  • re-using materials is good, you could go as far as using a single texture that contains all the colors
  • you should instance every repeating object to save draw calls, for instance windows, screws, etc. you can still select them
  • if your scene really just consist of boxes you could instance everything into a single draw call (!) these meshes can still have distinct colors, sizes and can be selectable, click
  • only raycast objects that are interactive, do not traverse the model
  • something like three-mesh-bvh would speed up selection
  • or change the raycast to something cheap like a bounds-only check
  • clamp off some of the resolution, instead of 2 use 1.5, it’s sharp enough
  • objects in the distance could be wrapped into a LOD
  • find a way to occlude objects if they’re not visible (inside/outside), this could be as naive as a button that transports the user inside
  • you could merge everything into one buffergeometry and use temporary mesh overlays for selections that you mount into the scene, we use that at work as well (cad system, very intense models)
  • think about removing edges, it will look like hell but you can counteract that with shadows + shadowMap.autoUpdate = false and/or a low res ssao effect
  • movement regression, for instance sink resolution to 1 while the camera is spinning

some of these i’ve collected here with examples, you could pick up some ideas or impressions there