When you wear the HoloLens, you will be at the center of the holographic world of application. When your project opens the "Virtual Reality support" option and "Windows holographic" is selected, Unity's camera components are automatically rendered in stereo, will automatically follow you and move or rotate.
However, to ensure the holographic experience, the following options require you to manually set all the cameras:
- Mixed reality rendering Mixed Reality Rendering
- Camera positioning positioning the camera
- Frustum Range Adjustment Clip Planes
Note: These settings need to be applied to each camera in each scene.
By default, when you create a new scene in unity, a master camera is automatically generated, and you need to apply the above settings to it.
Mixed reality rendering Mixed Reality Rendering
As described in the previous sections, HoloLens does not obscure any real content, but it renders everything black as transparent content. So we need to apply the same settings to our main camera and set the background of the main camera to pure black to ensure that the real world content is displayed.
- Open Camera Viewer and enter camera component settings
- Set clear flags to solid color (solid color)
- Set the Backgroud color value to Rgba (0,0,0,0)
Camera positioning positioning the camera
If you use the World Origin (x:0,y:0,z:0) to decorate your scene, this is a simple matter. So we're going to reset the camera's initial position to the world origin, from the default value (0,0,-10) to (0,0,0). This position represents the initial position of the HoloLens in the world and the initial position of the user's head in the world.
Frustum Range Adjustment Clip planes
Considering the natural vision of the human race, we should change the near value of the frustum from the default of 0.3 to 0.85. Note: In HoloLens, one unit of unity represents one meter.
Multi-camera multiple cameras
When there are multiple cameras in the scene, Unity uses the Maincamera tag to determine which camera to use for stereoscopic world rendering.
HoloLens Development Notes-Unity's camera chapter