xBimTeam / XbimWindowsUI

The home of XbimXplorer and WPF components for your desktop BIM applications.
Other
252 stars 149 forks source link

Texture on IfcSurfaceFeature not shown #140

Closed Noranius closed 3 years ago

Noranius commented 4 years ago

Starting from here: #127 I've gone further in the implementation of the texture. Theoretically I'm ready. The texture is loaded fom an image (jpg) and a Diffuse Material is created. See here: https://github.com/Noranius/XbimEssentials/blob/1ed83db09afa8d386e7f21fc6af06c53120c75d0/Xbim.Ifc/XbimTexture.cs#L165 However, the Texture is not showing up. I've tested it with the same texture in a simple 3D Application and it has worked instantly. Do somebody see what I'm missing? I checked that the geometry is drawn and so on. If i comment out entity 9100 the surface feature is shown as a patch on the surface of the beam. If i take a surface style with color it is working, too. But with the texture nothing is shown. Attached you find the ifc file with the corresponding texture. I appreciate any help in this.

SurfaceFeature.zip

Noranius commented 3 years ago

I could bring down the issue to a minimal example. Please have a look at https://stackoverflow.com/questions/64353244/3d-object-with-texture-invisible. In case you can figure out the problem, please let me know.

Noranius commented 3 years ago

The problem shortly explained: A Texture has to be mapped to each triangle of the mesh. For this purpose, the texture has four anchor points, namely the four edges of the texture with the coordinates [0,0][1,0][1,1][0,1]. Hence, three points within the texture have to be mapped to one triangle. I'm not sure how to define the positions in the texture from the geometry.

Noranius commented 3 years ago

Finally I could manage to add the texture visualization to xBIM. Please refer to #163. Thanks for all help.