xeokit / xeokit-bim-viewer

A browser-based BIM viewer, built on the xeokit SDK
https://xeokit.github.io/xeokit-bim-viewer
Other
421 stars 361 forks source link

Option to make selected objects not appear floating in front of others #100

Open xeolabs opened 2 years ago

xeolabs commented 2 years ago

Feedback from user:

We would like to have Selection Tool work like Colorize Objects. The main difference is that we do not want the Selected Entity to be visible behind other solid materials (walls etc...).

unnamed

Possible options:

  1. have a BIMViewer configuration that switches the Selection tool between using the "selected" rendering effect and the "colorized" rendering effect
  2. have an EmphasisMaterial property that indicates whether we want selected objects to "glow through" other objects (current behaviour, where selected objects are post-rendered over the top of normal objects), or to just to have a different color

Notes:

(1) would allow us to have different colors on selected objects (2) restricts us to the same color for all selected objects
(2) is likely cleaner than (1) architecturally, because xeokit's "colorized" was not intended for visualizing selected objects and may break user expectations (and require hacks)

Amoki commented 2 years ago

This is what I meant with https://github.com/xeokit/xeokit-sdk/issues/493, but it's way better explained here

xeolabs commented 2 years ago

Solution

xeokit-bim-viewer

xeokit-sdk

Caveat

To make this work within the renderer, we need to make selected objects always appear opaque when selectedGlowThrough is false. Even transparent windows will appear opaque, as shown in the screenshot below.

This is a necessary hack at this point, because of the way renderer is currently architected. It will take a slightly deeper change to be able to preserve the original transparency of each selected object. However, perhaps the opacity is desirable?

Screenshot from 2022-02-21 16-24-44

Amoki commented 2 years ago

Is it possible to define different behavior for over and select?

xeolabs commented 2 years ago

@Amoki at the xeokit-sdk level it's supported for highlight and select, so could also be made to work for mouse-over as well.

Examples of selection and highlighting objects on mouse hover:

https://xeokit.github.io/xeokit-sdk/examples/#picking_canvas_mesh_highlight_glowThroughFalse https://xeokit.github.io/xeokit-sdk/examples/#picking_canvas_mesh_selection_glowThroughFalse

xeolabs commented 2 years ago

Another possibility: Add Colorize tool #107