You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/remote-rendering/tutorials/unity/custom-models/custom-models.md
+29-36Lines changed: 29 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Interfaces and custom models
3
-
description: Add view controllers and ingest custom models to be rendered by Azure Remote Rendering
3
+
description: Add view controllers and ingest custom models to render them with Azure Remote Rendering
4
4
author: florianborn71
5
5
ms.author: flborn
6
6
ms.date: 06/15/2020
@@ -25,71 +25,64 @@ In this tutorial, you learn how to:
25
25
26
26
## Get started with the Mixed Reality Toolkit (MRTK)
27
27
28
-
The Mixed Reality Toolkit (MRTK) is a cross-platform toolkit for building mixed reality experiences. We'll use MRTK 2.5.1 for its interaction and visualization features.
28
+
The Mixed Reality Toolkit (MRTK) is a cross-platform toolkit for building mixed reality experiences. We use MRTK 2.8.3 for its interaction and visualization features.
29
29
30
-
To add MRTK, follow the [Required steps](https://microsoft.github.io/MixedRealityToolkit-Unity/version/releases/2.5.1/Documentation/Installation.html#required) listed in the [MRTK Installation Guide](https://microsoft.github.io/MixedRealityToolkit-Unity/version/releases/2.5.1/Documentation/Installation.html).
31
-
32
-
Those steps are:
33
-
-[Get the latest MRTK Unity packages](https://microsoft.github.io/MixedRealityToolkit-Unity/version/releases/2.5.1/Documentation/Installation.html#1-get-the-latest-mrtk-unity-packages)
34
-
- Even though it says "latest", please use version 2.5.1 from the MRTK release page.
35
-
- We only use the *Foundation* package in this tutorial. The *Extensions*, *Tools*, and *Examples* packages are not required.
36
-
-[Import MRTK packages into your Unity project](https://microsoft.github.io/MixedRealityToolkit-Unity/version/releases/2.5.1/Documentation/Installation.html#2-import-mrtk-packages-into-your-unity-project)
37
-
-[Switch your Unity project to the target platform](https://microsoft.github.io/MixedRealityToolkit-Unity/version/releases/2.5.1/Documentation/Installation.html#3-switch-your-unity-project-to-the-target-platform)
38
-
- You should have done this step already in the first chapter, but now is a good time to double check!
39
-
-[Add MRTK to a new scene or new project](https://microsoft.github.io/MixedRealityToolkit-Unity/version/releases/2.5.1/Documentation/Installation.html#4-add-and-configure-mrtk-with-a-new-scene)
40
-
- You can add MRTK to a new scene and re-add your coordinator and model objects/scripts, or you can add MRTK to your existing scene using the *Mixed Reality Toolkit -> Add to Scene and Configure* menu command.
30
+
The [official guide](/training/modules/learn-mrtk-tutorials/1-5-exercise-configure-resources?tabs=openxr) to import MRTK contains some steps we don't need to do. Only these three steps are necessary:
31
+
- Importing the 'Mixed Reality Toolkit/Mixed Reality Toolkit Foundation' version 2.8.3 to your project through the Mixed Reality Feature Tool ([Import MRTK](/training/modules/learn-mrtk-tutorials/1-5-exercise-configure-resources?tabs=openxr#import-the-mrtk-unity-foundation-package)).
32
+
- Run the configuration wizard of MRTK ([Configure MRTK](/training/modules/learn-mrtk-tutorials/1-5-exercise-configure-resources?tabs=openxr#configure-the-unity-project)).
33
+
- Add MRTK to the current scene ([Add to scene](/training/modules/learn-mrtk-tutorials/1-5-exercise-configure-resources?tabs=openxr#create-the-scene-and-configure-mrtk)). Use the *ARRMixedRealityToolkitConfigurationProfile* here instead of the suggested profile in the tutorial.
41
34
42
35
## Import assets used by this tutorial
43
36
44
-
Starting in this chapter, we'll implement a simple[model-view-controller pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) for much of the material covered. The *model* part of the pattern is the Azure Remote Rendering specific code and the state management related to Azure Remote Rendering. The *view* and *controller* parts of the pattern are implemented using MRTK assets and some custom scripts. It is possible to use the *model* in this tutorial without the *view-controller* implemented here. This separation allows you to easily integrate the code found in this tutorial into your own application where it will take over the *view-controller* part of the design pattern.
37
+
Starting in this chapter, we'll implement a basic[model-view-controller pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) for much of the material covered. The *model* part of the pattern is the Azure Remote Rendering specific code and the state management related to Azure Remote Rendering. The *view* and *controller* parts of the pattern are implemented using MRTK assets and some custom scripts. It's possible to use the *model* in this tutorial without the *view-controller* implemented here. This separation allows you to easily integrate the code found in this tutorial into your own application where it takes over the *view-controller* part of the design pattern.
45
38
46
-
With the introduction of MRTK, there are a number of scripts, prefabs, and assets that can now be added to the project to support interactions and visual feedback. These assets, referred to as the **Tutorial Assets**, are bundled into a [Unity Asset Package](https://docs.unity3d.com/Manual/AssetPackages.html), which is included in the [Azure Remote Rendering GitHub](https://github.com/Azure/azure-remote-rendering) in '\Unity\TutorialAssets\TutorialAssets.unitypackage'.
39
+
With the introduction of MRTK, there are multiple scripts, prefabs, and assets that can now be added to the project to support interactions and visual feedback. These assets referred to as the **Tutorial Assets**, are bundled into a [Unity Asset Package](https://docs.unity3d.com/Manual/AssetPackages.html), which is included in the [Azure Remote Rendering GitHub](https://github.com/Azure/azure-remote-rendering) in '\Unity\TutorialAssets\TutorialAssets.unitypackage'.
47
40
48
41
1. Clone or download the git repository [Azure Remote Rendering](https://github.com/Azure/azure-remote-rendering), if downloading extract the zip to a known location.
49
42
1. In your Unity project, choose *Assets -> Import Package -> Custom Package*.
50
-
1. In the file explorer, navigate to the directory where you cloned or unzipped the Azure Remote Rendering repository, then select the .unitypackage found in **Unity -> TutorialAssets -> TutorialAssets.unitypackage**
43
+
1. In the file explorer, navigate to the directory where you cloned or unzipped the Azure Remote Rendering repository, then select the `.unitypackage` found in **Unity -> TutorialAssets -> TutorialAssets.unitypackage**
51
44
1. Select the **Import** button to import the contents of the package into your project.
52
45
1. In the Unity Editor, select *Mixed Reality Toolkit -> Utilities -> Upgrade MRTK Standard Shader for Lightweight Render Pipeline* from the top menu bar and follow the prompts to upgrade the shader.
53
46
54
-
Once MRTK and the Tutorial Assets are included in the project, we'll switch the MRTK profile to one more suitable for the tutorial.
47
+
Once MRTK and the Tutorial Assets are setup double check, that the correct profile is selected.
55
48
56
49
1. Select the **MixedRealityToolkit** GameObject in the scene hierarchy.
57
50
1. In the Inspector, under the **MixedRealityToolkit** component, switch the configuration profile to *ARRMixedRealityToolkitConfigurationProfile*.
58
51
1. Press *Ctrl+S* to save your changes.
59
52
60
-
This will configure MRTK, primarily, with the default HoloLens 2 profiles. The provided profiles are pre-configured in the following ways:
53
+
This step configures MRTK, primarily, with the default HoloLens 2 profiles. The provided profiles are preconfigured in the following ways:
61
54
- Turn off the profiler (Press 9 to toggle it on/off, or say "Show/Hide Profiler" on device).
62
55
- Turn off the eye gaze cursor.
63
56
- Enable Unity mouse clicks, so you can click MRTK UI elements with the mouse instead of the simulated hand.
64
57
65
58
## Add the App Menu
66
59
67
-
Most of the view controllers in this tutorial operate against abstract base classes instead of against concrete classes. This pattern provides more flexibility and allows us to provide the view controllers for you, while still helping you learn the Azure Remote Rendering code. For simplicity, the **RemoteRenderingCoordinator** class does not have an abstract class provided and its view controller operates directly against the concrete class.
60
+
Most of the view controllers in this tutorial operate against abstract base classes instead of against concrete classes. This pattern provides more flexibility and allows us to provide the view controllers for you, while still helping you learn the Azure Remote Rendering code. For simplicity, the **RemoteRenderingCoordinator** class doesn't have an abstract class provided and its view controller operates directly against the concrete class.
68
61
69
-
You can now add the prefab **AppMenu** to the scene, for visual feedback of the current session state. This view controller will "unlock" more sub menu view controllers as we implement and integrate more ARR features into the scene. For now, the **AppMenu**will have a visual indication of the ARR state and present the modal panel that the user uses to authorize the application to connect to ARR.
62
+
You can now add the prefab **AppMenu** to the scene, for visual feedback of the current session state. The **AppMenu**also present the modal panel that the user uses to authorize the application to connect to ARR.
70
63
71
64
1. Locate the **AppMenu** prefab in *Assets/RemoteRenderingTutorial/Prefabs/AppMenu*
72
65
1. Drag the **AppMenu** prefab into the scene.
73
-
1.You'll likely see a dialog for **TMP Importer**, since this is the first time we're including *Text Mesh Pro* assets in the scene. Follow the prompts to **Import TMP Essentials**. Then close the importer dialog, the examples and extras are not needed.
66
+
1.If you see a dialog for **TMP Importer**, follow the prompts to **Import TMP Essentials**. Then close the importer dialog, as the examples and extras aren't needed.
74
67
1. The **AppMenu** is configured to automatically hook up and provide the modal for consenting to connecting to a Session, so we can remove the bypass placed earlier. On the **RemoteRenderingCoordinator** GameObject, remove the bypass for authorization we implemented previously, by pressing the '-' button on the **On Requesting Authorization** event.
1. Test the view controller by pressing **Play** in the Unity Editor.
79
72
1. In the Editor, now that MRTK is configured, you can use the WASD keys to change the position your view and holding the right mouse button + moving the mouse to change your view direction. Try "driving" around the scene a bit to get a feel for the controls.
80
73
1. On device, you can raise your palm up to summon the **AppMenu**, in the Unity Editor, use the hotkey 'M'.
81
-
1. If you've lost sight of the menu, press the 'M' key to summon the menu. The menu will be placed near the camera for easy interaction.
82
-
1. The authorization will now show as a request to the right of the **AppMenu**, from now on, you'll use this to authorize the app to manage remote rendering sessions.
74
+
1. If you've lost sight of the menu, press the 'M' key to summon the menu. The menu is placed near the camera for easy interaction.
75
+
1. The **AppMenu** presents a UI element for authorization to the right of the **AppMenu**. From now on, you should use this UI element to authorize the app to manage remote rendering sessions.
83
76
84
77

85
78
86
79
1. Stop Unity from playing to continue with the tutorial.
87
80
88
81
## Manage model state
89
82
90
-
Now we'll implement a new script, **RemoteRenderedModel** that is for tracking state, responding to events, firing events, and configuration. Essentially, **RemoteRenderedModel** stores the remote path for the model data in `modelPath`. It will listen for state changes in the **RemoteRenderingCoordinator** to see if it should automatically load or unload the model it defines. The GameObject that has the **RemoteRenderedModel** attached to it will be the local parent for the remote content.
83
+
We need a new script called **RemoteRenderedModel** that is for tracking state, responding to events, firing events, and configuration. Essentially, **RemoteRenderedModel** stores the remote path for the model data in `modelPath`. It listens for state changes in the **RemoteRenderingCoordinator** to see if it should automatically load or unload the model it defines. The GameObject that has the **RemoteRenderedModel** attached to it's the local parent for the remote content.
91
84
92
-
Notice that the **RemoteRenderedModel** script implements **BaseRemoteRenderedModel**, included from **Tutorial Assets**. This will allow the remote model view controller to bind with your script.
85
+
Notice that the **RemoteRenderedModel** script implements **BaseRemoteRenderedModel**, included from **Tutorial Assets**. This connection allows the remote model view controller to bind with your script.
93
86
94
87
1. Create a new script named **RemoteRenderedModel** in the same folder as **RemoteRenderingCoordinator**. Replace the entire contents with the following code:
95
88
@@ -252,11 +245,11 @@ Notice that the **RemoteRenderedModel** script implements **BaseRemoteRenderedMo
252
245
}
253
246
```
254
247
255
-
Inthemostbasicterms, **RemoteRenderedModel**holdsthedataneededtoloadamodel (inthiscasetheSASor*builtin://* URI) and tracks the remote model state. When it's time to load, the `LoadModel` method is called on **RemoteRenderingCoordinator** and the Entity containing the model is returned for reference and unloading.
248
+
Inthemostbasicterms, **RemoteRenderedModel**holdsthedataneededtoloadamodel (inthiscasetheSASor*builtin://* URI) and tracks the remote model state. When it's time to load the model, the `LoadModel` method is called on **RemoteRenderingCoordinator**, and the Entity containing the model is returned for reference and unloading.
256
249
257
250
## Load the Test Model
258
251
259
-
Let's test the new script by loading the test model again. We'lladdaGameObjecttocontainthescriptandbeaparenttothetestmodel. We'll also create a virtual stage that contains the model. The stage will stay fixed relative to the real world using a [WorldAnchor](/windows/mixed-reality/develop/unity/spatial-anchors-in-unity?tabs=worldanchor). We use a fixed stage so that the model itself can still be moved around later on.
252
+
Let's test the new script by loading the test model again. For this test, we need a Game Object to contain the script and be a parent to the test model, and we also need a virtual stage that contains the model. The stage stays fixed relative to the real world using a [WorldAnchor](/windows/mixed-reality/develop/unity/spatial-anchors-in-unity?tabs=worldanchor). We use a fixed stage so that the model itself can still be moved around later on.
Trymovingandrotatingthe**TestModel**GameObjectviatheTransformintheInspector, orintheSceneview. You'll see the model move and rotate it in the Game view.
## Provision Blob Storage in Azure and custom model ingestion
290
283
291
-
Nowwecantryloadingyourownmodel. Todothat, you'll need to configure Blob Storage and on Azure, upload and convert a model, then we'llloadthemodelusingthe**RemoteRenderedModel**script. Thecustommodelloadingstepscanbesafelyskippedifyoudon't have your own model to load at this time.
284
+
Nowwecantryloadingyourownmodel. Todothat, youneedtoconfigureBlobStorageonAzure, uploadandconvertamodel, andthenloadthemodelusingthe**RemoteRenderedModel**script. Thecustommodelloadingstepscanbesafelyskippedifyoudon't have your own model to load at this time.
292
285
293
-
Followthestepsspecifiedinthe [Quickstart: Convertamodelforrendering](../../../quickstarts/convert-model.md). Skipthe**InsertnewmodelintoQuickstartSampleApp**sectionforthepurposeofthistutorial. Onceyouhaveyouringestedmodel's *Shared Access Signature (SAS)* URI, continue to the next step below.
1. Fillinthe `ModelPath` withthemodel's *Shared Access Signature (SAS)* URI you created in the ingestion steps above.
296
+
1. Fillinthe `ModelPath` withthemodel's *Shared Access Signature (SAS)* URI you created in the [Provision Blob Storage in Azure and custom model ingestion](#provision-blob-storage-in-azure-and-custom-model-ingestion) step.
0 commit comments