xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

[FEATURE SUGGESTION] FastNavPlugin - ability to configure IFC types to hide while moving

Open xeolabs opened this issue 2 years ago • 1 comments

What is FastNavPlugin

FastNavPlugin is a xeokit Viewer plugin that makes interaction smoother with large models, by temporarily switching the Viewer to faster, lower-quality rendering modes whenever we interact.

New Feature

Extend FastNavPlugin with the options to:

  • hide certain IFC types while the camera is moving
  • hide objects that are small and complex while camera is moving

I started this experiment a while back, which I'll resurrect: https://gist.github.com/xeolabs/f6a7d6292155b6b7d0e05f861b916849

Don't try to use that experimental code BTW, it's not supposed to work yet.

The code shows how these new options would look.

In this example, we're hiding objects that meet the following conditions:

  1. are IfcWindow or IfcSpace
  2. have a boundary that is less than 4 units across and more than 14 triangles
  3. are not IfcSlab or IfcWall
 import {Viewer, XKTLoaderPlugin, FastNavPlugin} from "xeokit-sdk.es.js";

 const viewer = new Viewer({
      canvasId: "myCanvas"
  });

 viewer.scene.camera.eye = [-66.26, 105.84, -281.92];
 viewer.scene.camera.look = [42.45, 49.62, -43.59];
 viewer.scene.camera.up = [0.05, 0.95, 0.15];

new FastNavPlugin(viewer, {
     hideTypes: ["IfcWindow", "IfcSpace"...],
     dontHideTypes: ["IfcSlab", "IfcWall"...],
     hideSmallerThan : 4,
     hideMoreTrianglesThan : 14,

     //...
});

const xktLoader = new XKTLoaderPlugin(viewer);

const model = xktLoader.load({
      id: "myModel",
      src: "./models/xkt/HolterTower.xkt"
});

xeolabs avatar Jun 13 '22 11:06 xeolabs

The LOD mechanism by @tmarti in https://github.com/xeokit/xeokit-sdk/pull/824 could work very well with this. Instead of always hiding objects, it hides objects only if FPS drops below a defined threshold. It feels better on high-end computers while being more performant on mobile/company laptops.

Amoki avatar Jun 14 '22 08:06 Amoki