Open a-gagnon opened 1 month ago
In 4.2.x and earlier did the terrain get greyed out like the non-emphasized elements?
In 4.2.x and earlier did the terrain get greyed out like the non-emphasized elements?
Pulled an back older version to create a video and I noticed the 'terrain' was not enabled by default in the map layers widget. https://github.com/iTwin/itwinjs-core/assets/3418768/8e8b7c2d-aa1b-4337-9632-1142ab4ff20d
Thanks. So, not a regression in the emphasize behavior, but a change in the widget behavior?
If you toggle "Locateable" OFF in the widget, you should be able to select things underneath the terrain.
Correct, that would be a change in widget behavior. 'Locatable: off' does not seem to fix the problem. Even when transparency is high and you would expect the hit to return the emphasized element id, it still fails.
https://github.com/iTwin/itwinjs-core/assets/3418768/73e1d329-5c1f-4d06-8493-b32e22ddb053
I'm not sure what tool you are using in your recording. See if your tool sets allowNonLocatable to false. See if the normal selection tool allows you to locate the element.
We use whatever the default is. Our tool implements filterHit
with the list of element ids we emphasized. Normal selection tool works against desired element under normal conditions. As soon as the reality data is turned off or the model height is such that it's 'brought forward' relative to the terrain everything works properly.
I'll try to setup a sandbox tomorrow.
Brief update on this. (Sandbox used for testing) Whether the terrain is enabled of it's just the map layer, it all boils down to the model being under the map/terrain. If the 'Locatable' flag is on, it's impossible to pick elements regardless if they're emphasized or not due to the map being presented in front of the model.
When the 'Locatable' flag is off, picking elements is possible.
I think the way the various options of the map layer interacts with the rest of viewport-based actions would warrant user labs in the future, especially for civil workflows where a lot may happen underneath the surface. Would be good to have someone weigh in on the hilite stuff which feels like an issue as it doesn't provide visual feedback when it should.
In the meantime, I've been looking at the code of the widget in viewer-components-react/map-layers, and seems if we set useDepthBuffer: false
while our tool is active we'll get the behavior we want/use to have. I'll check with pineapple team if we can supply reasonable default values for civil workflows.
After testing it out with useDepthBuffer: false
, this doesn't work when terrain is enabled. Will need to come up with more complicated logic to ensure the map is behind everything temporarily.
@pmconne
I've found a workaround, but it isn't trivial (or clean). As mentioned above, the useDepthBuffer
flag is ignored when the terrain is enabled.
Honoring that flag at all times is one solution. It would make it easy for us to temporarily set false
which would guarantee the terrain is always drawn behind any model elements. Perhaps the emphasizeElements function could allow default terrain appearance too?
The bottom line is, there should be an easy way to make sure elements are not hidden behind something else in the context of emphasizing elements.
Describe the bug In earlier versions of itwinjs-core libraries (I tested 4.2.x), whenever an element is emphasized, it appeared on top of everything else which made it an easy target for selection. This does not seem to be the case anymore. Emphasized elements are blended in with the terrain.
To Reproduce Open any imodel with map layers/terrain. Emphasize elements
Expected behavior Old behavior was fine -- emphasized elements should never be 'behind' any other geometry.
Please refer to the following video showcasing the issue https://github.com/iTwin/itwinjs-core/assets/3418768/23145357-74f5-4277-a7ae-fc54daf00468
Desktop (please complete the applicable information):