ThatOpen / web-ifc-viewer

Graphics engine and toolkit for client applications.
MIT License
947 stars 235 forks source link

Openning large civil 3d models - camera fitview #134

Closed Kubica91 closed 2 years ago

Kubica91 commented 2 years ago

Hi, there is some problem with opening Civil 3D models. This model is several kilometers large and the ifc camera in browser does not want to capture this model. I thing, the camere are dealing with occlusion culling - that means model is in scene, but too far to view it by camera. I tried set all meshes to .frustumCulled = false, but it doesnt work.... You can find this fix on three.js stackoverflow. https://stackoverflow.com/questions/59727192/threejs-disable-frustum-culling-for-some-objects I tried in code fit camera: ifcCamera.cameraControls.fitToBox and ifcCamera.cameraControls.fitToSphere, max and min distance, but still nothing. Image for example: image

The second way to work around this oversight, I tried to scale model geometry/scene. But there was another problem with selecting elements with doubleclick. Hitbox retains its original size and the camera fitview toi this original hitbox..
Image for example: obrázek_2022-05-24_152304301

Can you please look at this issue. Thank you.

agviegas commented 2 years ago

Hey, did you try bringing the model to the origin?

Kubica91 commented 2 years ago

yes, i have this in code: image I tried COORDINATE_TO_ORIGIN: false, too

Here are three pictures about this problem. Everything can be seen in the first picture. After zooming out, the model starts to disappear (second image) and in the next zoom out it disappears completely (third image). What can be seen in the picture is not the whole model, but only a part... image

agviegas commented 2 years ago

The problem then is that the model dissapears? Have you tried changing the camera far attribute?

Kubica91 commented 2 years ago

Yes, it is. I tried this, but result is the same.. image in the viewer is something like a white wall, which overlaps the model on the size of the zoom

agviegas commented 2 years ago

@Kubica91 can you send us that IFC?

Kubica91 commented 2 years ago

Yes of course, but not here. Can you send me please your email or contact me and I'll send it to you.

agviegas commented 2 years ago

Hey @Kubica91 I've taken a look at this in BIMvision and it's the same, so it looks like the problem is in the file and not in IFC.js. Were you able to open it successfully with other viewers?

image

Kubica91 commented 2 years ago

Hi @agviegas, we have our viewer, that is base from Autodesk Forge and it allow you to fit camera to all model pieces (geometries). image

IFC.js can open model succesfully, but camera has scroll limitation (with mouse wheel) and i dont have option to look at the main piece of model. This is the maximum scroll IFC.js in your demo: https://ifcjs.github.io/web-ifc-viewer/example/index.
image

I know this model isnt the normal ifc model.... It is automatically render from Autodesk Civil application... It would be best, when the IFC.js viewer allows you to fit the camera to all pieces of the model, so then the user can double-click left mouse button on required piece and zoom (fit) camera to it.

agviegas commented 2 years ago

Hi @Kubica91. I'm not sure if you are trying to use the viewer as an end user application? For your information, it's just a small demo for demonstrating what can be done with the library. It's not intended to be used as an end-user tool, and there are no plans of doing it more convoluted, as its main purpose is getting started with this repository.

If you are creating a BIM application using this repository, you can control the camera behaviour through ifcViewerAPI.context.ifcCamera.cameraControls. We are using this library for this. You can zoom to the selected items using the first parameter of ifcViewerAPI.IFC.selector.pickIfcItem(true).

If you have any other question regarding the use of the library for development, let us know!