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.


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


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.


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.


Import a Revit model as a Link

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


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.


Model Structure when organised by materials


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.


And this is the model in Max:


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.


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


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.


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.