xBimTeam / XbimSamples

Code examples. Most of these examples are described and explained on our website.
https://xbimteam.github.io/
33 stars 31 forks source link

Retrieving Element Material #17

Open andreghosn opened 5 years ago

andreghosn commented 5 years ago

Can someone please tell me how we can extract the material of an element (color, alpha, transparent or not, etc. ) so it can be recreated in Unity? Thank you.

Wolgraph commented 5 years ago

Transparency is saved into the property set within the file. you can easily find it in the .ifcxml file. I think textures depends on the material library in you modelling software. I suggest you to create new materials in Unity, then you can check the material name in the xml file and assign the unity material depending on the name.

May I ask you how you managed to import Xbim libraries into Unity project? I have this issue I must solve. https://answers.unity.com/questions/1614112/integrate-xbim-tool-external-library-into-unity.html Thank you in advance

andreghosn commented 5 years ago

Hello,

Thank you for your reply.

Do you have some samples files or link showing how to get these properties?

Regarding using Xbim in Unity directly, I have not yet found a solution as there are some dependency issues. A potential workaround could be creating a separate parser and sending the data to unity via HTTP or some inter-process communication if the parser if local.

Hope this helps.

Wolgraph commented 5 years ago

If you parse the xml file, you can find the list of the materials with their ID. Then you can parse the instances of the model and read the ref related to the material field. Cattura

I've not done this yet, so I can't tell you if this makes sense. I'm quite stuck with making Unity do anything I want him to.