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/concepts/graphics-bindings.md
+73-13Lines changed: 73 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Once set up, the graphics binding gives access to various functions that affect
21
21
22
22
In Unity, the entire binding is handled by the `RemoteUnityClientInit` struct passed into `RemoteManagerUnity.InitializeManager`. To set the graphics mode, the `GraphicsApiType` field has to be set to the chosen binding. The field will be automatically populated depending on whether an XRDevice is present. The behavior can be manually overridden with the following behaviors:
23
23
24
-
***HoloLens 2**: the [Windows Mixed Reality](#windows-mixed-reality) graphics binding is always used.
24
+
***HoloLens 2**: the [OpenXR](#openxr) or the [Windows Mixed Reality](#windows-mixed-reality) graphics binding is used depending on the active Unity XR plugin.
25
25
***Flat UWP desktop app**: [Simulation](#simulation) is always used.
26
26
***Unity editor**: [Simulation](#simulation) is always used unless a WMR VR headset is connected in which case ARR will be disabled to allow to debug the non-ARR related parts of the application. See also [holographic remoting](../how-tos/unity/holographic-remoting.md).
27
27
@@ -33,22 +33,23 @@ To select a graphics binding, take the following two steps: First, the graphics
StartupRemoteRendering(managerInit); // static function in namespace Microsoft::Azure::RemoteRendering
48
48
49
49
```
50
-
51
-
The call above is necessary to initialize Azure Remote Rendering into the holographic APIs. This function must be called before any holographic API is called and before any other Remote Rendering APIs are accessed. Similarly, the corresponding de-init function `RemoteManagerStatic.ShutdownRemoteRendering();` should be called after no holographic APIs are being called anymore.
50
+
The call above must be called before any other Remote Rendering APIs are accessed.
51
+
Similarly, the corresponding de-init function `RemoteManagerStatic.ShutdownRemoteRendering();` should be called after all other Remote Rendering objects are already destoyed.
52
+
For WMR `StartupRemoteRendering` also needs to be called before any holographic API is called. For OpenXR the same applies for any OpenXR related APIs.
52
53
53
54
## <span id="access">Accessing graphics binding
54
55
@@ -80,17 +81,79 @@ if (ApiHandle<GraphicsBinding> binding = currentSession->GetGraphicsBinding())
80
81
81
82
## Graphic APIs
82
83
83
-
There are currently two graphics APIs that can be selected, `WmrD3D11` and `SimD3D11`. A third one `Headless` exists but is not yet supported on the client side.
84
+
There are currently three graphics APIs that can be selected, `OpenXrD3D11`, `WmrD3D11` and `SimD3D11`. A fourth one `Headless` exists but is not yet supported on the client side.
85
+
86
+
### OpenXR
87
+
88
+
`GraphicsApiType.OpenXrD3D11` is the default binding to run on HoloLens 2. It will create the `GraphicsBindingOpenXrD3d11` binding. In this mode Azure Remote Rendering creates a OpenXR API layer to integrate itself into the OpenXR runtime.
89
+
90
+
To access the derived graphics bindings, the base `GraphicsBinding` has to be cast.
91
+
There are three things that need to be done to use the OpenXR binding:
92
+
93
+
#### Package custom OpenXR layer json
94
+
95
+
To use Remote Rendering with OpenXR the custom OpenXR API layer needs to be activated. This is done by calling `StartupRemoteRendering` mentioned in the previous section. However, as a prerequisite the `XrApiLayer_msft_holographic_remoting.json` needs to be packaged with the application so it can be loaded. This is done automatically if the **"Microsoft.Azure.RemoteRendering.Cpp"** NuGet package is added to a project.
96
+
97
+
#### Inform Remote Rendering of the used XR Space
98
+
99
+
This is needed to align remote and locally rendered content.
if (openXrBinding->UpdateAppSpace(reinterpret_cast<uint64_t>(space)) == Result::Success)
117
+
#else
118
+
if (openXrBinding->UpdateAppSpace(space) == Result::Success)
119
+
#endif
120
+
{
121
+
...
122
+
}
123
+
```
124
+
125
+
Where the above `XrSpace` is the one used by the application that defines the world space coordinate system in which coordinates in the API are expressed in.
126
+
127
+
#### Render remote image (OpenXR)
128
+
129
+
At the start of each frame, the remote frame needs to be rendered into the back buffer. This is done by calling `BlitRemoteFrame`, which will fill both color and depth information for both eyes into the currently bound render target. Thus it is important to do so after binding the full back buffer as a render target.
130
+
131
+
> [!WARNING]
132
+
> After the remote image was blit into the backbuffer, the local content should be rendered using a single-pass stereo rendering technique, e.g. using **SV_RenderTargetArrayIndex**. Using other stereo rendering techniques, such as rendering each eye in a separate pass, can result in major performance degradation or graphical artifacts and should be avoided.
`GraphicsApiType.WmrD3D11` is the default binding to run on HoloLens 2. It will create the `GraphicsBindingWmrD3d11` binding. In this mode Azure Remote Rendering hooks directly into the holographic APIs.
148
+
`GraphicsApiType.WmrD3D11` is the previously used graphics binding to run on HoloLens 2. It will create the `GraphicsBindingWmrD3d11` binding. In this mode Azure Remote Rendering hooks directly into the holographic APIs.
88
149
89
150
To access the derived graphics bindings, the base `GraphicsBinding` has to be cast.
90
151
There are two things that need to be done to use the WMR binding:
91
152
92
153
#### Inform Remote Rendering of the used coordinate system
93
154
155
+
This is needed to align remote and locally rendered content.
156
+
94
157
```cs
95
158
RenderingSessioncurrentSession=...;
96
159
IntPtrptr=...; // native pointer to ISpatialCoordinateSystem
if (wmrBinding->UpdateUserCoordinateSystem(ptr) == Result::Success)
109
172
{
110
-
//...
173
+
...
111
174
}
112
175
```
113
176
114
177
Where the above `ptr` must be a pointer to a native `ABI::Windows::Perception::Spatial::ISpatialCoordinateSystem` object that defines the world space coordinate system in which coordinates in the API are expressed in.
115
178
116
-
#### Render remote image
117
-
118
-
At the start of each frame, the remote frame needs to be rendered into the back buffer. This is done by calling `BlitRemoteFrame`, which will fill both color and depth information for both eyes into the currently bound render target. Thus it is important to do so after binding the full back buffer as a render target.
179
+
#### Render remote image (WMR)
119
180
120
-
> [!WARNING]
121
-
> After the remote image was blit into the backbuffer, the local content should be rendered using a single-pass stereo rendering technique, e.g. using **SV_RenderTargetArrayIndex**. Using other stereo rendering techniques, such as rendering each eye in a separate pass, can result in major performance degradation or graphical artifacts and should be avoided.
181
+
The same considerations as in the OpenXR case above apply here. The API calls look like this:
Copy file name to clipboardExpand all lines: articles/remote-rendering/tutorials/native-cpp/hololens/integrate-remote-rendering-into-holographic-app.md
0 commit comments