## 4 Implementation
### HoloLens Application
#### 4.3.2 Implementation  
As was previously mentioned in Section 4.1, the AR application was developed using Unity as the graphics engine. The 3D models were first created with Siemens NX 11 [59] and then were polished with Blender 2.83 [60] to make them lighter in terms of the number of polygons to be displayed and animated smoothly on AR devices.  
The first step for the implementation was to convert and adapt the 3D engineering models to models suitable for AR representation. This step consists of converting the CAD models to a format that supports real-time rasterization. This process necessarily involves a loss of resolution when switching from a mathematical model to a model with finite points, and it is not a trivial process. On many occasions, it will require manual intervention or the use of Artificial Intelligence (AI) techniques to perform a more efficient conversion. Moreover, due to the AR device performance, it is necessary to make use of further optimization techniques such as polygon reduction or decreasing the resolution of textures in order to ensure a smooth experience when the application is used by the end user. As an example, Figure 7 shows the result of an automatic optimization procedure that reduces the number of vertices of a bolt of the clutch from 3267 to only 165. Microsoft provides a number of recommendations when it comes to implementing an AR application and indicates several problems that can arise when using CAD models for this purpose, such as flickering or Z-fighting [61].  
Figure 6: Simplified class diagram of the main components of the system.  
Once the 3D models were imported into the graphics engine (i.e., Unity), the clutch animations were created as specified by the documentation files provided by the shipyard workshop. An example of one of the animations is illustrated in Figure 8 (on the left), where all the clutch parts are visible after performing the disassembly animation. Then, the necessary scripts were implemented. Such scripts control the movement and the message reception of the rest of the components of the scene.  
The next step consists of building the user interface that includes a floating panel that follows the user and enables actions such as activating animations or visualizing information about the model. Figure 8, on the right, shows a close-up screenshot of the final version of the control panel. In addition, the documentation panels were added. Such panels show PDF documents associated with the manufacturing order and the assembly. In addition, as can be observed on the left of Figure 9, screenshots of the CAD drawings of the parts were also integrated into the panel, so when certain parts are selected, a panel with the associated documentation is shown.  
The last step in the development consists of adding the functionality related to the collaborative framework, which was previously detailed in Section 4.2. Thanks to the protocol, the implemented system allows the different devices to share their location information on the different 3D elements in the environment, as well as the interactions that each user performs with the goal of enhancing the feeling of being immersed in the same virtual environment. As an example, Figure 9 illustrates two time instants when the operators made use of the shared experience and thus interacted simultaneously with the virtual hydraulic clutch.  
Figure 8: 3D model of the clutch after the disassembly animation (**left**) and a screenshot of the control panel (**right**).  
Figure 7: Bolt of the clutch before (**left**) and after (**right**) its geometry optimization (the red rectangle frames the number of vertices of the 3D model).