iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
616 stars 210 forks source link

View clipping error when zooming after moving graphic #6275

Closed matthaleky closed 4 weeks ago

matthaleky commented 11 months ago

Describe the bug In the following video, notice that I can zoom in very close. After moving the graphic it then clips too soon as I zoom in. 2023-12-07_09-30-07 Here is a simpler model that shows the problem with a cylinder and using only iTwinjs Edit Tools. 2023-12-07_13-14-27 If I close that model and open another model or restart the app, zooming is correct again. Turning EditScope off and on again does not help.

To Reproduce cylinder.zip has the bim file in the second example. I placed the cylinder using iTwin Edit Tools. I used the keyin "editor move elements" to move the cylinder.

  1. Open the example bim with an App that has the Edit Tools enabled. I tried in Display-Test-App but it errors with "Key-in Failed to run"
  2. Use the keyin "editor move elements" to move the cylinder to other locations
  3. There is a certain distance from the original location when zooming in close clips too soon.

iTwin.js: 4.3.0-dev.25 iTwinUI: 2.11.10 AppUI: 4.6.1 React: 17.0.2 Node.js: 18.16.1 Electron: 26.0.0 Build Tools Commit: 842412e

pmconne commented 11 months ago

Are you moving the element outside of the initial project extents?

matthaleky commented 11 months ago

It is within the project extents.

matthaleky commented 11 months ago

Notice project extents are displayed. I moved the right cylinder until zoom started clipping too soon. I then placed the right cylinder and recorded. 2023-12-12_08-24-27

markschlosseratbentley commented 11 months ago

How small is your geometry? (meters)

matthaleky commented 11 months ago

About 8' tall with 2.5' radius. 1.6 m high with 0.77 diameter.

markschlosseratbentley commented 10 months ago

About 8' tall with 2.5' radius. 1.6 m high with 0.77 diameter.

I wonder if that is too small of a size for the frustum code. @pmconne what do you think? In the past when very tiny things (and only very tiny things) have been modeled in a .bim (sub-1-meter?), it is a known shortcoming that the the frustum can go bad (in a similar way to what is shown above).

pmconne commented 10 months ago

@pmconne what do you think?

I think @matthaleky described a synchronization problem. He notes the problem begins after making an edit, and is resolved when reloading the iModel. Presumably the frustum is not being adjusted to account for the geometric changes he made to the model.

MarcNeely commented 3 months ago

@matthaleky I cannot reproduce this currently with a move command that I implemented in DisplayTestApp. Does this problem still occur in whatever App you were using?

matthaleky commented 3 months ago

Sounds promising, we are currently using version 4.7.0. What version are you using?

matthaleky commented 3 months ago

@MarcNeely, I cannot run any editing commands in display-test-app.(except for "projectLocationTool"). Please tell me how to run the move command in the display-test-app. Also, please send me the imodel you are using.

matthaleky commented 3 months ago

https://github.com/user-attachments/assets/7ed7c33a-e76f-4aa8-a525-f020d7812288

In the video, I am using the Editing Studio-App, I can give you the steps to use it, if needed. I placed the two circles, moved the one on the right and now it disappears before the other circle when zooming in like the previous videos above. In the background are normal sized real world geometry and I am well within the project extents. Perhaps it looks subtle in this video, i only did one simple move, after doing more moves, the effect becomes more dramatic.

markschlosseratbentley commented 3 months ago

@matthaleky As @pmconne mentioned separately, this is actively being investigated by @MarcNeely, which included work creating this PR (https://github.com/iTwin/itwinjs-core/pull/7060) in order to add a move ability to display-test-app in order to attempt to reproduce.

MarcNeely commented 3 months ago

OK, I think that I've been able to reproduce this in display-test-app now. When you do the zooming in, are you still in edit mode?

matthaleky commented 3 months ago

Yes, if "edit mode" = "edit scope".

MarcNeely commented 2 months ago

OK, I think that I have tracked this down. It looks to me like the bounding ranges are all OK, but the bounding sphere of the temporary tiles is not getting updated, so it's throwing the tile out if the un-updated bounding sphere is not in the view. I'll look at updating the bounding sphere properly as the ranges are updated.

matthaleky commented 2 months ago

Thank you for the update.