0

I'm developing a software that can display 3D IFC building models. I'm using Xbim, and Helix toolkit for that. I managed to display the geometry correctly, but there is something off with the shading as far as I can tell. image

Can I alter the calculation of shading either during Xbim triangulation, or in Helix toolkit? The goal is to have sharp edges, and remove the ugly shading lines from the flat surfaces which appear on the border between 2 triangles in the mesh.

I already did some research, and what I found out, that shading calculation may be based around the vertices: If they are shared by 2 polygons, the shading will be smooth, and if you have 2 vertices in the same place, each belonging to a separate polygon, there will be a hard edge. Is this theory correct?

EDIT: I think this may be more related to Xbim, and not to helix toolkit. So The question is, how to tell Xbim, that you want sharp edges, like the ones you get in Xbim.WindowsUI?

  • When you say *"like the ones you get in Xbim.WindowsUI"*, does it mean it looks correct in Xbim.WindowsUI Xplorer? If that is the case, you may just replicate the approach in there. Looking at your image, it might also be an issue with GPU or calculations precision. – Martin Cerny Jan 31 '23 at 14:53
  • Thank you for your answer! I doubt that it is a GPU problem, and I have played around with precision settings in Xbim, if that's what you meant, that did not provide any results. I'm exactly after the looks you have in Xbim Xplorer, or BIMVision. I'll have a go at replicating it. However, I would appreciate very much, if you could point me to some kind of forum, or site, that helps understanding the approach used there. I looked at the code already for some time, I think I grasped the basics, but its still kina foggy. – György Müller Feb 13 '23 at 13:56
  • Do you use *Xbim.WindowsUI* components in your viewer? – Martin Cerny Feb 15 '23 at 12:48
  • I don't think so. I take the XbimShapeInstances for each element I want to display, and get the faces, and vertices using Xbim3DModelContext. Then I create GeometryModel3D objects using those, and add the models to the Content of a HelixViewport3D. I played around trying to assign DiffuseMaterials to the models, but to no avail. – György Müller Feb 16 '23 at 13:19
  • I managed to solve the issue! For anyone who might encounter this in the future, I basically mimicked the Xbim.Presentation.WpfMeshGeometry3D class, I think especially implementing a function like ```WpfMeshGeometry3D.Read(byte[] mesh, XbimMatrix3D? transform = null).Read(byte[] mesh, XbimMatrix3D? transform = null)``` had to do something with it. As this comment is not very specific, and I'm not aware of the exact cause of the problem, and the solution, I'll don't post it as an answer. – György Müller Mar 01 '23 at 15:35

0 Answers0