Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: IFC 3D Visualization pipe line #127

Closed
Noranius opened this issue Sep 16, 2019 · 6 comments
Closed

Question: IFC 3D Visualization pipe line #127

Noranius opened this issue Sep 16, 2019 · 6 comments

Comments

@Noranius
Copy link

I want to add the visualization of textures in xBIM. This feature is necessary to support the visualization of IfcSurfaceTexture and sub classes. I have chosen to understand how the visualization of the model works first. What I have understood until now is that the model is loaded (IfcStore.Open) and after that the DrawingControl3D cares about the 3D visualization. Further, the Scene is created as SurfaceLayerStyle. I stuck at that point.

The method SurfaceLayerStyler.BuildScene(...)creates a scene, on top of the model. However, that scene is never touched again, only returned at the end. I guess other calls upon the model affect the scene, don't they?

I have not seen any call to the Canvas (HelixViewport3D) in the DrawingControl3D. How get the xBIM shape data transformed and handed over to the HelixViewPort3D?

Thanks in advance
Noran

@Noranius
Copy link
Author

Any Help on this topic?

@CBenghi
Copy link
Member

CBenghi commented Sep 23, 2019

Hi @Noranius,

have a look at the 'AddLayerToDrawingControl' function in DrawingControl3D.
There's where the elements get added to the tree of elements in the viewer:

 if (layer.Style.IsTransparent)
   Transparents.Children.Add(mv);
else
   Opaques.Children.Add(mv);
end if

Is this what you were after?

@bekraft
Copy link
Contributor

bekraft commented Sep 23, 2019

Concerning textures in IFC: There's similar question maybe associated to yours:
xBimTeam/XbimGeometry#183

The tesselation pipeline is staged. So far, your are right. The data is never changed. Any update to the geometry means to reload the whole scene. The WPF UI only uses a readonly view on a binary encoded geometry representation based on triangulation.

So far I understood the visualization pipeline:

  • OCC builds up the fundation of geometry modelling wrapped by some Xbim features (i.e. XbimFace)
  • Tesselation is done partially in OCC partially by tesselation algorithm (LibTess wrapped in XbimEssentials)
  • Handover to the UI is done in binary chunks (encoded in XbimShapeGeometry)
  • Reimport is done by the presentation layer in WpfMeshGeometry3D
    public void Read(byte[] mesh, XbimMatrix3D? transform = null)
    having the knowledge of placement nodes in prior
  • It hands the visualization over to the WPF presentation

Last:

  • The geometry representation is encapsulated into the Media3D scene description. There's no direct call to any drawing method

@Noranius
Copy link
Author

The last week i got to work on this. What I searched for is not in the XbimWindowsUI, it is in XbimGeometry repository. When the Xbim3DModelContext is created in the main Window.

context.CreateContext(worker.ReportProgress, true);

Within this method all 3D objects are created for visualization. Hence, I have to step in this part of the XbimGeometry repo.

https://github.com/xBimTeam/XbimGeometry/blob/8c5db8c8ea02662bfac6639b6136d478471b62cf/Xbim.ModelGeometry.Scene/Xbim3DModelContext.cs#L680

to be continued...

@Noranius
Copy link
Author

The next point is where are the textures loaded:
The textures are loaded within the XbimTexture.cs within https://github.com/xBimTeam/XbimEssentials
https://github.com/xBimTeam/XbimEssentials/blob/cb6bfe1440201d8bf3f9ae1922635274011dacfc/Xbim.Ifc/XbimTexture.cs#L38
This method has to be extended by another Case
if (style is IIfcSurfaceStyleWithTextures) AddTexture((IIfcSurfaceStyleWithTextures)style);
I'm on it, o implement the method AddTexture.

Second the texture has to be transformed for that I'm on to implement the necessary methods, which generate the materials from the image textures within the WpfMaterial.

public class WpfMaterial : IXbimRenderMaterial

Pull requests will follow, when all is ready.

@Noranius
Copy link
Author

Finally the problem is solved an xBIM is now capable to display textures. Refer to #163.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants