Option to make selected objects not appear floating in front of others
xeolabs opened this issue · 5 comments
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...).
Possible options:
- have a BIMViewer configuration that switches the Selection tool between using the "selected" rendering effect and the "colorized" rendering effect
- 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)
This is what I meant with xeokit/xeokit-sdk#493, but it's way better explained here
Solution
xeokit-bim-viewer
- @xeokit/xeokit-bim-viewer 2.4.6
- Added the BIMViewer configuration "selectedGlowThrough" - see https://github.com/xeokit/xeokit-bim-viewer
- Added that config to the URL params parsed by the demo app - see example: https://xeokit.github.io/xeokit-bim-viewer/app/index.html?projectId=Duplex&tab=models&configs=selectedGlowThrough:false
xeokit-sdk
- @xeokit/xeokit-sdk 2.2.5
- Added an option to
EmphasisMaterial
to not make selected and/or highlighted objects appear to float over other objects: https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial.html#instance-set-glowThrough
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?
Is it possible to define different behavior for over and select?
@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