In one of my previous blog posts, my goal was to test a large scale model by covering the Infraworks to Stingray workflow. This time, my thirst for knowledge led me to investigate another massive model importing workflow: Navisworks to Stingray. Can we easily import a Navisworks model into st
Stingray? Let’s find out!
Navisworks is mainly used in the construction industry to combine 3d models originating from various sources. It allows users to review their projects, detect impediments and simulate construction phases.
To get started, I opened the Eircom Park Navisworks sample file and exported it as an FBX file. I chose to include textures, lights and cameras. I didn’t want to use the polygon limiting option since I was planning to optimize the geometry in 3ds Max. The model isn’t spectacular, but for testing purposes, it’s perfect.
As I imported the FBX file in 3ds Max, I could see that this was going to be challenging. I had to deal with over 12000 elements and more than 5400 materials. For better performance in a real-time game engine, it’s always better to minimize the number of materials and objects in a scene. First, I put all the cameras on a separate layer (in case I wanted to use them to frame specific viewpoints in Stingray). I also made use of the Selection Filter to restrict all 6700 helpers.
I then checked the information in the 3ds Max scene by typing sceneMaterials.count in the MAXScript Listener window. Looking at the result I saw that my scene contained 5435 materials and 5435 separate objects. In fact, each object had a unique material assigned to it, which would drastically reduce my scene’s performance in a real-time engine. The best way to resolve this problem was to use a bit of MAXScript. Unfortunately I don’t have much knowledge of MAXScript, so I asked my very talented colleague Martin Ashton to lend me a hand.
At this point, the solution could be broken down into two main steps: (1) remove the duplicated materials, and (2) reduce the number of individual objects. In light of this, Martin wrote two scripts for me. The first one combined all the materials with the same name into a single master material. The second one attached all the objects with the same material into a single mesh.
After running the first script (?unique_materials_by_name.ms Click here to download?), it seemed like nothing happened. However, after saving the file and re-typing sceneMaterials.count in the MAXScript Listener window, the number of materials was down to 151. Running the second script (merge_polys_by_material.ms Click here to download) took a bit more time, but once the merge was complete, the number of objects was also 151. This was perfect!
During the FBX import process inside Stingray, I chose to omit animations and skeletons since my scene did not contain any animations. Doing otherwise would cause Stingray to create a skeleton joint for every object in the file.
After the import process had completed, I dragged the stadium unit from the Asset Browser into the Level Viewport.
At a closer glance, my Stingray project still contained quite a few materials. After a bit of detective work, I discovered the main offender: the VIP lounge within the stadium. I didn’t need it for my project, so I deleted this room inside my 3ds Max scene. The trees also looked uninspiring, so I chose to delete them as well.
To refresh my changes in Stingray, I selected the Update function from 3ds Max’s Stingray menu. Looking at my stadium in Stingray, I could see the trees had correctly disappeared.
However, this update process had left some orphaned materials in my Asset Browser. Although the VIP lounge meshes were deleted in 3ds Max, there were still 152 items remaining in my Import folder in Stingray, most of which were materials. At this point, the fastest way to keep my Stingray project clean was to delete the stadium assets in the Asset Browser and to re-send the stadium from 3ds Max. By re-sending my stadium into Stingray, I now only had 84 items in my Import folder, indicating I no longer had orphaned materials from the deleted VIP room. Perfect! I could now begin to edit my materials in Stingray and start adding more interactive content, which we’ll be covering in a later post.