When importing a large Solidworks STEP file into Unity, there’s a lot of things to consider to make sure your project runs smoothly. Unity has a specific way of calculating and rendering frames which depend on a project’s LOD’s, face count, materials, and many more. Making sure all these metrics are optimized before importing a project into Unity is important to help reduce strain on your CPU. In this post, we will go over some of the steps you can take to make sure your STEP file from SolidWorks is optimized for Unity.
1. Mesh clean up
Like most 3D visualization projects, cleaning up a complex model is the first step in the pipeline. If you’re importing a SolidWorks STEP file into Unity, it is likely that a lot of the parts or objects aren’t needed in your visualization. We suggest deleting as much as you can, including:
- Bolts and screws throughout the model: although they’re small, they quickly add to your mesh count and file size and increase your CPU processing and render times.
- Internal parts of your model: if it isn’t visible in the visualization, like the electric motor in an assembly line, simply delete it.
- Extra parents and empty nodes add an excess layer to the CPU load and should be deleted.
2. Naming LOD’s correctly
Using LOD’s is a common practice in real-time visualization. LOD’s offer great benefits for reducing processing times by reducing GPU operations and improving the overall rendering of your visualization., So making sure your LOD’s are properly imported into Unity is important.
Unity detects LOD’s by finding groups of meshes with matching names and LOD variations.
Let’s have a look at an example group of objects that were imported into Unity. In Group 1 shown below, the shared label “Object 1” and ascending LOD’s will prompt Unity to detect this group as an LOD group. Unity will automatically render Object 1 using LOD 0 to 2 based on how close it is from the camera. The closer Object 1 is to the camera the higher LOD with the higher number of triangles will be rendered by Unity.
- Object 1 LOD 0
- Object 1 LOD 1
- Object 1 LOD 2
In the next example below, Group 2 has different mesh names: “Window 2” and “Object 3”. Unity will not be able to correctly recognize this group of meshes as an LOD group.
- Window 2 LOD 0
- Object 3 LOD 0
- Window 2 LOD 1
- Window 2 LOD 2
When importing your SolidWorks model into Unity, make sure that all your LOD groups are properly named so that Unity can correctly detect them. If your LOD groups don’t have matching names Unity will not successfully identify them. If you import your project and forget to properly name your LOD’s don’t worry. You can manually create a “Game Object” in Unity and manually configure the LOD’s.
3. Finally, keep your total mesh count low
As a rule of thumb, when you’re importing SolidWorks STEP files into Unity, it’s best to keep the total number of meshes in your scene to 2000. This is because shaders, textures, material and lighting in your meshes all quickly add up in your project and make it difficult to render in Unity. Cleaning up your mesh, optimizing materials and properly assigning in LOD’s in Unity, will all help keep your mesh count in check.
Hopefully these tips come in handy the next time you’re visualizing a Solidworks project in Unity!
Meshmatic is a software that automates CAD conversion and optimization (including mesh clean up and generating LOD’s) for real-time visualizations. Download your Meshamtic 7-day free trial here.