Skip to main content

Getting BIM data into Unity (Part 2 - Revit)

This is part 2 of a series of posts about getting BIM data into Unity.

In the first post, we managed to get an ArchiCAD model into Unity. This time we’ll tackle Revit.

Direct export from Revit to FBX

Let’s start with the “rac_basic_sample_project” which gets installed with Revit. We’re using the 2015 release.

rac_basic_sample-2015-02-6-10-03.png

Since quite a while Revit supports direct export to the FBX format. At first sight, this seems a perfect workflow option.

rac_FBX_export-2015-02-6-10-03.png

When we first imported the model and dragged it into the scene, it got too small. When switching the “Scale Factor” to 1 in the FBX Importer settings, the scale is correct. It is best to add a simple cube with known size (e.g. 1x1x1) to compare with.

PastedGraphic-2015-02-6-10-03.png

Example of the FBX structure in Unity

Looking at the GameObject hierarchy, we see that we get a reasonably structured model, made out of meshes which are named by their Family type and which contain the unique Revit Entity ID in between brackets. That is good to know, as it allows us to relate to the original objects afterwards.

As you can see in the screenshot above, the model geometry seems OK, but the material information is missing. We get a dull, grey model, but even worse, with no individual assignment of materials to specific meshes. Everything uses the same “No Name” material.

In addition, when manually assigning materials with textures, the mapping is not usable. The geometry as imported in Unity lacks the necessary UV coordinates. This is, alas, not easy to solve inside Unity, unless you use scripts to generate the necessary UV coordinates.

Passing through 3ds Max

We try another route. Autodesk 3ds Max is said to be the perfect rendering companion to Revit.

With a Desktop version of the software, you can export to FBX and load that into 3ds Max. With the Suite edition of the software, specific “Suite Workflows” are supported, which facilitate the exchange of Revit models with 3ds Max. Either way, you should be able to get your model over in good shape, although it can be a quite heavy operation. I did slow down my computer considerably, but I was running 3ds Max and Revit inside Parallels and Unity in OSX, all at the same time.

max-revit-link-menu-2015-02-6-10-03.png

Import a Revit model as a Link

The default option to organise the model is by Revit Material.

max-revit-link-view-2015-02-6-10-03.png

However, while your model organisation for rendering is ideally according to Material, this is not that usable in a BIM oriented workflow, as the building elements are not easy to identify anymore.

1__%252524%252521%252540%252521__PastedGraphic-2015-02-6-10-03.png

Model Structure when organised by materials

PastedGraphic1-2015-02-6-10-03.png

Alternative Model organisation

We end up with more entities, but now they still relate to the Revit Model structure. In 3ds Max, we are only concerned with geometry and materials from the model, but in a BIM workflow, we want to have access to the model information too. By having the Entity ID available, we might get a way back to the model information.

PastedGraphic2-2015-02-6-10-03.png

And this is the model in Max:

max-revit-model-imported-2015-02-6-10-03.png

When you view the Revit model in 3ds Max, you get a fairly complete import, including material assignments and mapping information.

3ds Max with Unity Workflow

Moreover, 3ds Max has a much easier workflow into Unity. You can either store the max-file inside the Unity Assets folder of your project (and rely on automated FBX conversion in the background) or manually export the 3ds Max model into FBX format for Unity. In both cases, you get a much better model, including (some) element hierarchy information, material assignments and UV coordinates (mapping information).

Since Unity and 3ds Max are not in the same OS on my computer, I exported the 3ds Max scene to an FBX file. We get some warnings that the geometry is adapted into Editable Meshes, which is fine for usage inside Unity.

PastedGraphic3-2015-02-6-10-03.png

And now we see how this model looks inside Unity, finally…

PastedGraphic4-2015-02-6-10-03.png

Screenshot of 3ds Max model in Unity

We see that we had to rotate the model -90 around the X-Axis (automatic upon import!) and adjust the Scale Factor to 0,0254 to convert inches to meters for Unity.

Of particular notice is the way the objects are named from the FBX import.

PastedGraphic5-2015-02-6-10-03.png

Each GameObject in the FBX hierarchy receives a name which embeds some of the object information from the Revit model: main assigned Family and the Revit object ID, placed between square brackets, e.g. [993980]. This will help us later on in relating the FBX mesh back to the original object.

Are we there yet?

No. But we got our Revit model into Unity with assigned materials, in the correct scale and we know from each GameObject in Unity from which Revit element it was derived.

There is still a lot of optimisation to be done and the model will not behave smoothly at this point. But there is only so much you can handle in a single blog post.

Comments

Popular posts from this blog

Improve usage of BIM during early design phases

When I was collecting ideas for a book chapter on BIM (that seemed to never have emerged after that), I collected 10 ideas, which I believe still reflect good recommendations to improve the usage of BIM during the early design phases. These ideas are related to BIM software, but you can apply them in any flavor, as long as you can model with Building Elements, Spaces and have control over representation. Introduction This article gives an overview of several recommendations and tips, to better apply BIM applications and BIM methodologies, in the context of the early design phases. Many of these tips are applicable in any BIM application and they are based on experience gathered from teaching, researching and using BIM software. Sometimes they could help software developers to improve the workflow of their particular BIM implementation. Tip 1 : Gradually increase the amount of information In the early design phases, the architect makes assumptions and lays out the main design in...

Getting BIM data into Unity (Part 9 - using IfcConvert)

This is part 9 of a series of posts about getting BIM data into Unity. In this post, we’ll discuss the IfcConvert utility from the IfcOpenShell Open Source IFC Library to preprocess an IFC model for integration with Unity. This is (finally?) again a coding post, with some scripts which are shared to build upon. Conversion of IFC into Unity-friendly formats The strategy with this approach is that you preprocess the IFC-file into more manageable formats for Unity integration. Most Web-platforms do some sort of pre-processing anyway, so what you see in your browsers is almost never an IFC-file, but an optimised Mesh-based geometric representation. However, it wouldn’t be BIM-related if we’d limit ourselves to the geometry, so we will parse the model information as well, albeit using another, pre-processed file. IFC to Wavefront OBJ I used a test IFC-model and used the IfcConvert-utility converted it into OBJ en XML formats. The default way to use it is very simple: ...

Getting BIM data into Unity (Part 8 - Strategies to tackle IFC)

This is part 8 of a series of posts about getting BIM data into Unity. In this post, we’ll discuss IFC as a transfer format towards Unity. As with the previous post, this is not a coding post, although hints and examples are provided. Open BIM and IFC Everybody who ever met me or heard me present on a conference or BIM-lecture will not be surprised to hear that I’m a strong believer in the Industry Foundation Classes (IFC), an open standard, with already two versions published as an ISO standard, being IFC2x2 and IFC4 (but surprisingly not IFC2x3 which is widely used). In the ideal world, this would be the format to use to transfer BIM data into another environment, such as Unity. So what are our options? Looking in the Unity Asset Store Assimp is a library which supports multiple formats, including IFC. https://assetstore.unity.com/packages/tools/modeling/trilib-unity-model-loader-package-91777   I did a few attempts, but alas without any success. It is po...