10
0

readme.txt 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. SteamVR plugin for Unity - v1.2.3
  2. Copyright (c) Valve Corporation, All rights reserved.
  3. Requirements:
  4. The SteamVR runtime must be installed. This can be found in Steam under Tools.
  5. Changes for v1.2.3:
  6. * Updated to SteamVR runtime v1515522829 and SDK version 1.0.12.
  7. * Updated quickstart guide.
  8. * [General] Fixed deprecation warnings for GUILayer in Unity version 2017.2 and newer (removed associated functionality).
  9. * [LoadLevel] Fixed a crash when using SteamVR_LoadLevel to load a scene which has no cameras in it.
  10. * [RenderModels] Switched from using TextureFormat.ARGB32 to RGBA32 to fix pink texture issue on Vulkan.
  11. * [RenderModels] Fix for not initializing propery if game is paused on startup.
  12. https://github.com/ValveSoftware/steamvr_unity_plugin/issues/62
  13. * [InteractionSystem] Added implemention for ItemPackageSpawner requireTriggerPressToReturn.
  14. https://github.com/ValveSoftware/steamvr_unity_plugin/pull/17/files
  15. Changes for v1.2.2:
  16. * Updated to SteamVR runtime v1497390325 and SDK version 1.0.8.
  17. * [General] Switched caching SteamVR_Events.Actions from Awake to constructors to fix hot-loading of scripts in the Editor.
  18. * [General] Switched remaining coroutines away from using strings (to avoid issues with obfuscators).
  19. * [General] Switched from using deprecated Transform.FindChild to Transform.Find.
  20. * [General] Added #if !UNITY_METRO where required to allow compiling for UWP.
  21. * [UpdatePoses] Switched to using static delegates (Camera.onPreCull or Application.onBeforeRender depending on version) for updating poses.
  22. * [UpdatePoses] Deprecated SteamVR_UpdatePoses component.
  23. * [MixedReality] Added rgba settings to externalcamera.cfg for overriding foreground chroma key (default 0,0,0,0).
  24. * [MixedReality] Exposed SteamVR_ExternalCamera.Config settings in Unity Editor inspector for easy tweaking.
  25. * [MixedReality] Added file watcher to externalcamera.cfg to allow real-time editing.
  26. * [MixedReality] Fixed antialiasing complaint in Unity 5.6+.
  27. * [MixedReality] Added second pass to foreground camera when using PostProcessingBehaviour since those fx screw up the alpha channel.
  28. * [ControllerManager] Added code to protect against double-hiding of controllers.
  29. * [InteractionSystem] Sub-objects now inherit layer and tag of spawning object (ControllerButtonHints, ControllerHoverHighlight, Hand, SpawnRenderModel).
  30. Changes for v1.2.1:
  31. * Updated to SteamVR runtime v1485823399 and SDK version 1.0.6.
  32. * Switched SteamVR_Events.SystemAction from using strings to specify event type over to their associated enum values.
  33. * Fixed an issue with using WWW in static constructors.
  34. * Added Unity Preferences for SteamVR to allow disabling automatic enabling of native OpenVR support in Unity 5.4 or newer.
  35. https://github.com/ValveSoftware/steamvr_unity_plugin/issues/8
  36. https://github.com/ValveSoftware/steamvr_unity_plugin/pull/9
  37. * Added UNITY_SHADER_NO_UPGRADE to all shaders to avoid log spam in later versions of Unity for issues that have already been fixed but the compiler isn't able to detect.
  38. * Specified Vulkan support for Interaction System shaders.
  39. * Fix for crash in Interaction_Example selecting BowPickup:
  40. https://github.com/ValveSoftware/steamvr_unity_plugin/issues/4
  41. * Cleaned up unused fields:
  42. https://github.com/ValveSoftware/steamvr_unity_plugin/issues/2
  43. * Updated Interaction System's LinearDrive to initialize using linearMapping.value.
  44. https://github.com/ValveSoftware/steamvr_unity_plugin/pull/5
  45. * Updated Interaction System documetation to fix a few errors.
  46. * Added an icon for all Interaction System scripts.
  47. * Fixes for SteamVR on Linux.
  48. Changes for v1.2.0:
  49. * Updated to SteamVR runtime v1481926580 and SDK version 1.0.5.
  50. * Replaced SteamVR_Utils.Event with SteamVR_Events.<EventName> to avoid runtime memory allocation associated with use of params object[] args.
  51. * Added SteamVR_Events.<EventName>Action to make it easy to wrap callbacks to avoid memory allocation when components are frequently enabled/disabled at runtime.
  52. * Fixed other miscellaneous runtime memory allocation in SteamVR_Render and SteamVR_RenderModels. (Suggestions by unity3d user @8bitgoose.)
  53. * Integrated fix for SteamVR_LaserPointer direction (from github user @fredsa).
  54. * Integrated fixes and comments for SteamVR_Teleporter (from github user @natewinck).
  55. * Removed SteamVR_Status and SteamVR_StatusText as they were using SteamVR_Utils.Event with generic strings which is no longer allowed.
  56. * Added SteamVR_Controller.assignAllBeforeIdentified (to allow controller to be assigned before identified as left vs right). Suggested by github user @chrwoizi.
  57. * Added SteamVR_Controller.UpdateTargets public interface. This allows spawning the component at runtime. Suggested by github user @demonixis.
  58. * Fixed bug with SteamVR_TrackedObject when specifying origin. Suggested by github user @fredsa.
  59. * Fixed issue with head camera reference in SteamVR_Camera. Suggested by github user @pedrofe.
  60. Known issues:
  61. * The current beta version of Unity 5.6 breaks the normal operation of the SteamVR_UpdatePoses component (required for tracked controllers).
  62. To work around this in the meantime, you will need to manually add the SteamVR_UpdatePoses component to your main camera.
  63. Changes for v1.1.1:
  64. * Updated to SteamVR runtime v1467410709 and SDK version 1.0.2.
  65. * Updated Copyright notice.
  66. * Added SteamVR_TrackedCamera for accessing tracked camera video stream and poses.
  67. * Added SteamVR_TestTrackedCamera scene and associated script to demonstrate how to use SteamVR_TrackedCamera.
  68. * Fix for SteamVR_Fade shader to account for changes in Unity 5.4.
  69. * SteamVR_GameView will now use the compositor's mirror texture to render the companion window (pre-Unity 5.4 only).
  70. * Renamed SteamVR_LoadLevel 'externalApp' to 'internalProcess' to reflect actual functionality.
  71. * Fixed issue with SteamVR_PlayArea material loading due to changes in Unity 5.4.
  72. * Added Screenshot support handling for stereo panoramas generation.
  73. * Removed code that was setting Time.maximumDeltaTime as this was causing issues.
  74. Changes for v1.1.0:
  75. * Fix for error building standalone in SteamVR_LoadLevel.
  76. * Set SteamVR_TrackedObject.isValid to false when disabled.
  77. Changes for v1.0.9:
  78. * Updated to SteamVR runtime v1461626459 and SDK version 0.9.20.
  79. * Updated workshop texture used in sea of cubes example level to use web page from SteamVR (was previously from Portal).
  80. * Updated various SDK changes to Unity in 5.4 betas.
  81. * Added controllerModeState to RenderModel component to control additional features like scrollwheel visibility.
  82. * RenderModels now respond to model skin changes.
  83. * Removed OnGUI and associated help text (i.e. "You may now put on your headset." notification) as this was causing unnecessary overhead.
  84. * Fix to SteamVR_Render not turning back on if all cameras were disabled and then re-enabled.
  85. * Hooked up SteamVR_Render.pauseRendering in Unity 5.4 native OpenVR integration.
  86. * Fix for input_focus event sometimes getting sent inappropriately.
  87. * Fix for timeScale handling.
  88. * Fix for SteamVR_PlayArea not finding its material in editor in Unity 5.4 due to changes in how Unity handles asset loading.
  89. * Miscellaneous fixes to reduce hitching when using SteamVR_LoadLevel to handle scene transitions.
  90. * Hooked up SteamVR_Camera.sceneResolutionScale to Unity 5.4's native vr integration render target scaling.
  91. * Forced SteamVR initialization check in SteamVR_Camera.enable (and bail upon failure) in Unity 5.4 (was already doing this in older builds).
  92. * Better handling of SteamVR_Ears component with old content.
  93. * Keep legacy head object around in case external components were referencing it (was previously getting deleted in Unity 5.4 as the head motion is now applied to the "eyes" object).
  94. * Miscellaneous fixes for SteamVR_TrackedController and SteamVR_Teleporter.
  95. * Fixed up Extra scenes SteamVR_TestThrow and SteamVR_TestIK.
  96. * Added stereo panorama screenshot support to SteamVR_Skybox.
  97. * Removed use of deprecated UnityEditorInternal.VR.VREditor.InitializeVRPlayerSettingsForBuildTarget(BuildTargetGroup.Standalone);
  98. Changes for v1.0.8:
  99. * Updated to SteamVR runtime v1457155403.
  100. * Updated to work with native OpenVR integration introduced in Unity 5.4. In this and newer versions, openvr_api.dll will be automatically deleted when launching since it ships as part of Unity now.
  101. * C# interop now exports arrays as individual elements to avoid the associated memory allocation overhead passing data back and forth between native and managed code.
  102. * Applications should no longer call GetGenericInterface directly, but instead use the accessors provided by Valve.VR.OpenVR (e.g. OpenVR.System for the IVRSystem interface).
  103. * Added SteamVR_ExternalCamera for filming mixed reality videos. Automatically enabled when externalcamera.cfg is added to the root of your projects (next to Assets or executable), and toggled by the presence of a third controller.
  104. * Render models updated to load asynchronously. Sends "render_model_loaded" event when finished.
  105. * Added 'shader' property to render models to allow using alternate shaders. This also creates a dependency within the scene to ensure the shader is loaded in baked builds.
  106. * Fix for render model components not respecting render model scale.
  107. * SteamVR_Render.lockPhysicsUpdateRateToRenderFrequency now respects Time.timeScale.
  108. * SteamVR_LoadLevel now hides overlays when finished to avoid persisting performance degredation.
  109. * Added ability to launch external applications via SteamVR_LoadLevel.
  110. * Added option to load levels non-asynchronously in SteamVR_LoadLevel since Unity crashes on some content when using asyn loading.
  111. * SteamVR auto-disabled if initialization fails, to avoid continual retries.
  112. * Updated SteamVR_ControllerManager to get controller indices from the runtime (via IVRSystem.GetTrackedDeviceIndexForControllerRole).
  113. * SteamVR_ControllerManager now allows you to assign additional controllers to game objects.
  114. * [CameraRig] prefab now listens for a third controller connection which will enable mixed reality recording mode in the game view.
  115. * AudioListener is now transferred to a child of the eye camera called "ears" to allow controlling rotation independently when using speakers instead of headphones.
  116. * Flare Layer is no longer transferred from eye camera to game view camera.
  117. Changes for v1.0.7:
  118. * Updated to SteamVR runtime v1448479831.
  119. * Many enums updated to reflect latest SDK cleanup (v0.9.12).
  120. * Various fixes to support color space changes in the SDK.
  121. * Render models set the layer on their child components now to match their own.
  122. * Added a bool 'Load Additive' to SteamVR_LoadLevel script to optionally load the level additively, as well as an optional 'Post Load Settle Time'.
  123. * Fixed some issues with SteamVR_LoadLevel fading to a color with 'Show Grid' set to false.
  124. * Fixed an issue with orienting the loading screen in the SteamVR_LoadLevel script when using 'Loading Screen Distance'.
  125. Changes for v1.0.6:
  126. * Updated to SteamVR runtime v1446847085.
  127. * Added SteamVR_LevelLoad script to help smooth level transitions.
  128. * Added 'Take Snapshot' button to SteamVR_Skybox to automate creation of cubemap assets.
  129. * SteamVR_RenderModel now optionally creates subcomponents for buttons, etc. and optionally updates them dynamically to reflect pulling trigger, etc.
  130. * Added SteamVR_TestIK scene to Extras.
  131. * Added SteamVR.enabled which can be set to false to keep SteamVR.instance from initializing SteamVR.
  132. Changes for v1.0.5:
  133. * Updated to SteamVR runtime build #826021 (v.1445485596).
  134. * Removed TrackedDevices from [CameraRig] prefab (these were only ever meant to be in the example scene.
  135. * Added support for new native plugin interface.
  136. * Enabled MSAA in OpenGL as that appears to be fixed in the latest version of Unity.
  137. * Fix for upside-down rendering in OpenGL.
  138. * Moved calls to IVRCompositor::WaitGetPoses and Submit to Unity's render thread.
  139. * Couple fixes to prevent SteamVR from getting re-initialized when stopping the Editor preview.
  140. * Fix for hitches caused by SteamVR_PlayArea when not running SteamVR.
  141. Changes for v1.0.4:
  142. * Updated to SteamVR runtime build #768489 (v.1441831863).
  143. * Added SteamVR_Skybox for setting a cubemap in the compositor (useful for scene transitions).
  144. * Fix for RenderModels disappearing across scene transitions, and disabling use of modelOverride at runtime.
  145. * Added lockPhysicsUpdateRateToRenderFrequency to SteamVR_Render ([SteamVR] prefab) for apps that want to run their physics sim at a lower frequency. Locked (true) by default.
  146. * Made per-eye culling masks easier to use. (See http://steamcommunity.com/app/250820/discussions/0/535152276589455019/)
  147. * Exposed min/max curve distance settings for high quality overlay. Note: High quality overlay not currently supported in Rift Direct Mode and falls back to normal (flat-only) overlay render path.
  148. * Added 'valid' property to SteamVR_Controller. This is useful for detecting the controller is plugged in before tracking comes online.
  149. Changes for v1.0.3:
  150. * Updated to SteamVR runtime build #710329 (v.1438035413).
  151. * Added SteamVR_Controller.DeviceRelation.FarthestLeft/Right for GetDeviceIndex helper function.
  152. Note: You can also use SteamVR.instance.hmd.GetSortedTrackedDeviceIndicesOfClass.
  153. * Updated and fixed SteamVR_Controller.GetDeviceIndex to act more like people expect.
  154. * Fix for SteamVR_Controller.angularVelocity (velocity reporting has also been fixed in the runtime).
  155. * Renamed SteamVR_Controller.valid to hasTracking
  156. * Removed SteamVR_Overlay visibility, systemOverlayVisible and activeSystemOverlay properties.
  157. * Added collection of handy scripts to Assets/SteamVR/Extras: GazeTracker, IK (simple two-bone),
  158. LaserPointer, Teleporter, TestThrow (with example scene) and TrackedController.
  159. * Fix for hidden area mesh render order.
  160. * Fix for render models not showing up after playing scene once in editor.
  161. * Added controller manager left and right nodes to camera rig. These are automatically disabled while the
  162. dashboard is visible to avoid conflict with the dashboard rendering controllers. If you are handling tracked
  163. controllers using another method, you are encouraged to implement something similar using the input_focus event.
  164. * OpenVR runtime events are now broadcast via the SteamVR_Utils.Event system. The events can be found here:
  165. https://github.com/ValveSoftware/openvr/blob/master/headers/openvr.h and are broadcast in Unity with their
  166. prefix "VREvent_" stripped off.
  167. * Added handling of dashboard visibility and quit events.
  168. * Added SteamVR_Render.pauseGameWhenDashboardIsVisible (defaults to true).
  169. * Allow Unity to buffer up frames for its companion window to avoid any latency introduction
  170. * Lock physics update rate (Time.fixedDeltaTime) to match render frequency.
  171. * SteamVR_Camera (i.e. 'eye' objects) are moved back to the 'head' location when not rendering.
  172. * Simplified SteamVR_Camera Expand/Collapse functionality (now uses existing parent as origin if available).
  173. * Added SteamVR_PlayArea component to visualize different size spaces to target.
  174. * Exposed SteamVR_Overlay.curvedRange for the high-quality curved overlay render path.
  175. Changes for v1.0.2:
  176. * Updated to SteamVR runtime build #655277.
  177. * Added check for new version and prompt to download.
  178. * Moved remaining in-code shaders to separate shader assets.
  179. * Switched RenderModels back to using Standard shader (to avoid having to manually add Unlit to the always load
  180. assets list).
  181. * RenderModels now provides a drop down list populated with available render models to preview. This is useful
  182. for displaying various controller models in Editor to line up attachments appropriately.
  183. * Fix for [SteamVR] instance sometimes showing up twice in a scene between level loads and stomping existing
  184. settings.
  185. * Switched Overlay over to using new interface. Please report any functional differences to the SteamVR forums.
  186. * Added button in example escape menu [Status] to easily switch between Standing and Seated tracking space.
  187. * Miscellaneous color space fixes due to changes in Unity 5.1 rendering.
  188. * Added drawOverlay bool to GameView component to disable rendering the overlay texture automatically on top.
  189. * Eye offsets now get updated at runtime to react to any dynanamic IPD changes.
  190. * Added "hair-trigger" support to SteamVR_Controller.
  191. Changes for v1.0.1:
  192. * Updated to SteamVR runtime build #629708.
  193. * Added accessors to SteamVR_Controller for working with input.
  194. * Added TestController script for verifying controller functionality.
  195. * Added CameraFlip to compensate for Unity's quirk of rendering upsidedown on Windows (was previously
  196. corrected for in the compositor).
  197. * Removed use of UNITY_5_0 defines as this was causing problems with newer versions of Unity 5.
  198. * Shared render target size is now slightly larger to account for overlapping fovs.
  199. * Fix for gamma issues with deferred rendering and hdr.
  200. Note: MSAA is really important for rendering in VR, however, Unity does not support MSAA in deferred rendering.
  201. It is therefore recommended that you use Unity's Forward rendering path. Unity's Forward rendering path also
  202. does not support MSAA when using HDR render buffers. If you need to disable MSAA, you should at least attempt
  203. to compensate with an AA post fx. The MSAA settings for SteamVR's render buffers are controlled via Unity's
  204. Quality settings (Edit > Project Settings > Quality > Anti Aliasing).
  205. Upgrading from previous versions:
  206. The easiest and safest thing to do is to delete your SteamVR folder, and any files and folders in your
  207. Plugins directory called 'openvr_api', 'steam_api' or 'steam_unity' (and variants). Additionally, verify there
  208. are no SteamVR files found in Assets/Editor. Then import the new unitypackage into your project.
  209. This latest version has been greatly simplified. SteamVR_CameraEye has been removed as well as the menu
  210. option from SteamVR_Setup to 'Setup Selected Camera(s)'. The SteamVR_Camera object is instead rendered twice
  211. (once per eye) and the game view rendering handled in SteamVR_GameView. SteamVR_Camera now has 'head' and
  212. 'origin' properties for accessing the associated Transforms, and 'offset' has been deprecated in favor of using
  213. 'head'. By pressing the 'Expand' button below the SteamVR logo in SteamVR_Camera's Inspector, these objects are
  214. automatically created. This is useful for attaching objects appropriately, and removes the need for managing
  215. separate FollowHead and FollowEyes arrays. Similarly, the RenderComponents list is no longer needed as the
  216. SteamVR_Camera is itself used to render each eye. And finally, the button below the SteamVR logo will change to
  217. 'Collapse' to restore the camera to its previous setup.
  218. SteamVR_Camera's Overlay support has been broken out into a separate SteamVR_Overlay component. This can be
  219. added to any object in your scene. If you wish to use it in some scenes, but not others, it is good practice
  220. to add the component to each of your scenes and ensure its Texture is set to None in those that you do not wish
  221. it rendered in.
  222. The experimental binaural audio support has been removed as there are better plugins on the Unity Asset Store now,
  223. and this was an incomplete and unsupported solution.
  224. Files:
  225. Assets/Plugins/openvr_api.cs - This direct wrapper for the native SteamVR SDK support mirrors SteamVR.h and
  226. is the only script required. It exposes all functionality provided by SteamVR. It is not recommended you make
  227. changes to this file. It should be kept in sync with the associated openvr_api dll.
  228. The remaining files found in Assets/SteamVR/Scripts are provided as a reference implementation, and to get you
  229. up and running quickly and easily. You are encouraged to modify these to suit your project's unique needs,
  230. and provide feedback at http://steamcommunity.com/app/250820 or http://steamcommunity.com/app/358720/discussions
  231. Assets/SteamVR/Scenes/example.unity - A sample scene demonstrating the functionality provided by this plugin.
  232. This also shows you how to set up a separate camera for rendering gui elements.
  233. Details:
  234. Note that these scripts are a work in progress. Many of these will change in future releases and we will not
  235. necessarily be able to maintain compatibility with this version.
  236. Assets/SteamVR/Scripts/SteamVR.cs - Handles initialization and shutdown of subsystems. Use SteamVR.instance
  237. to access. This may return null if initialization fails for any reason. Use SteamVR.active to determine if
  238. VR has been initialized without attempting to initialized it in the process.
  239. Assets/SteamVR/Scripts/SteamVR_Camera.cs - Adds VR support to your existing camera object.
  240. To combat stretching incurred by distortion correction, we render scenes at a higher resolution off-screen.
  241. Since all camera's in Unity are rendered sequentially, we share a single static render texture across each
  242. eye camera. SteamVR provides a recommended render target size as a minimum to account for distortion,
  243. however, rendering to a higher resolution provides additional multisampling benefits at the associated
  244. expense. This can be controlled via SteamVR_Camera.sceneResolutionScale.
  245. Note: Both GUILayer and FlareLayer are not compatible with SteamVR_Camera since they render in screen space
  246. rather than world space. These are automatically moved the SteamVR_GameView object which itself is automatically
  247. added to the SteamVR_Camera's parent 'head' object. The AudioListener also gets transferred to the head in order
  248. for audio to be properly spacialized.
  249. Assets/SteamVR/Scripts/SteamVR_Overlay.cs - This component is provided to assist in rendering 2D content in VR.
  250. The specified texture is composited into the scene on a virtual curved surface using a special render path for
  251. increased fidelity. See the [Status] prefab in the example scene for how to set this up. Since it uses GUIText,
  252. it should be dragged into the Hierarchy window rather than into the Scene window so it retains its default position
  253. at the origin.
  254. Assets/SteamVR/Scripts/SteamVR_TrackedObject.cs - Add this to any object that you want to use tracking. The
  255. hmd has one set up for it automatically. For controllers, select the index of the object to map to. In general
  256. you should parent these objects to the camera's 'origin' object so they track in the same space. However, if
  257. that is inconvenient, you can specify the 'origin' in the TrackedObject itself.
  258. Assets/SteamVR/Scripts/SteamVR_RenderModel.cs - Dynamically creates associated SteamVR provided models for tracked
  259. objects. See <SteamVR Runtime Path>/resources/rendermodels for the full list of overrides.
  260. Assets/SteamVR/Scripts/SteamVR_Utils.cs - Various bits for working with the SteamVR API in Unity including a
  261. simple event system, a RigidTransform class for working with vector/quaternion pairs, matrix conversions, and
  262. other useful functions.
  263. Prefabs:
  264. [CameraRig] - This is the camera setup used by the example scene. It is simply a default camera with the
  265. SteamVR_Camera component added to it, and the Expand button clicked. It also includes a full set of Tracked Devices
  266. which will display and follow any connected tracked devices (e.g. controllers, base stations and cameras).
  267. [Status] - The prefab is for demonstration purposes only. It adds an escape menu to your scene.
  268. Note: It uses the SteamVR_Overlay component, which is rather expensive rendering-wise.
  269. [SteamVR] - This object controls some global settings for SteamVR, most notably Tracking Space. Legacy projects
  270. that want their viewed automatically centered on startup if not configured or to use the seated calibrated position
  271. should switch Tracking Space to Seated. This object is created automatically on startup if not added and defaults
  272. to Standing Tracking Space. It also provides the ability to set special masks for rendering each eye (in case you
  273. want to do something differently per-eye) and some simple help text that demonstrates rendering only to the
  274. companion window (which can be cleared or customized here).
  275. GUILayer, GUIText, and GUITexture:
  276. The recommended way for drawing 2D content is through SteamVR_Overlay. There is an example of how to set this up
  277. in the example scene. GUIText and GUITexture use their Transform to determine where they are drawn, so these
  278. objects will need to live near the origin. You will need to set up a separate camera using a Target Texture. To
  279. keep it from rendering other elements of your scene, you should create a unique layer used by all of your gui
  280. elements, and set the camera's Culling Mask to only draw those items. Set its depth to -1 to ensure it gets
  281. updated before composited into the final view.
  282. OnGUI:
  283. Assets/SteamVR/Scripts/SteamVR_Menu.cs demonstrates use of OnGUI with SteamVR_Camera's overlay texture. The
  284. key is to set RenderTexture.active and restore it afterward. Beware when also using a camera to render to the
  285. same texture as it may clear your content.
  286. Camera layering:
  287. One powerful feature of Unity is its ability to layer cameras to render scenes (e.g. drawing a skybox scene
  288. with one camera, the rest of the environment with a second, and maybe a third for a 3D hud). This is performed
  289. by setting the latter cameras to only clear the depth buffer, and leveraging the cameras' cullingMask to control
  290. which items get rendered per-camera, and depth to control order.
  291. Camera scale:
  292. Setting SteamVR_Camera's gameObject scale will result in the world appearing (inversely) larger or smaller.
  293. This can be used to powerful effect, and is useful for allowing you to build skybox geometry at a sane scale
  294. while still making it feel far away. Similarly, it allows you to build geometry at scales the physics engine
  295. and nav mesh generation prefers, while visually feeling much smaller or larger. Of course, if you are building
  296. geometry to real-world scale you should leave this at its default of 1,1,1. Once a SteamVR_Camera has been
  297. expanded, its 'origin' Transform should be scaled instead.
  298. Camera masking:
  299. By manually adding a GameObject with the SteamVR_Render component on it to your scene, you can specify a left
  300. and right culling mask to use to control rendering per eye if necessary.
  301. Events:
  302. SteamVR fires off several events. These can be handled by registering for them through
  303. SteamVR_Events.<EventType>.Listen. Be sure to remove your handler when no longer needed.
  304. The best pattern is to Listen and Remove in OnEnable and OnDisable respectively.
  305. Initializing - This event is sent when the hmd's tracking status changes to or from Unitialized.
  306. Calibrating - This event is sent when starting or stopping calibration with the new state.
  307. OutOfRange - This event is sent when losing or reacquiring absolute positional tracking. This will
  308. never fire for the Rift DK1 since it does not have positional tracking. For camera based trackers, this
  309. happens when the hmd exits and enters the camera's view.
  310. DeviceConnected - This event is sent when devices are connected or disconnected. The device index is passed
  311. as the first argument, and the connected status (true / false) as the second argument.
  312. Keybindings (if using the [Status] prefab):
  313. Escape/Start - toggle menu
  314. PageUp/PageDown - adjust scale
  315. Home - reset scale
  316. I - toggle frame stats on/off
  317. Deploying on Steam:
  318. If you are releasing your game on Steam (i.e. have a Steam ID and are calling Steam_Init through the
  319. Steamworks SDK), then you may want to check ISteamUtils::IsSteamRunningInVRMode() in order to determine if you
  320. should automatically launch into VR mode or not.
  321. Known Issues:
  322. * If Unity finds an Assets\Plugins\x86 folder, it will ignore all files in Assets\Plugins. You will need to
  323. either move openv_api.dll into the x86 subfolder, or move the dlls in the x86 folder up a level and delete
  324. the x86 folder.
  325. Troubleshooting:
  326. * "Failed to connect to vrserver" - This often happens the first time you launch. Often simply trying a second time
  327. will clear this up.
  328. * HmdError_Init_VRClientDLLNotFound - Make sure the SteamVR runtime is installed. This can be found in Steam
  329. under Tools. Try uninstalling and reinstalling SteamVR. Try deleting <user>/AppData/Local/OpenVR/openvrpaths.vrpath
  330. and relaunching Steam to regenerate this file.
  331. * HmdError_Init_HmdNotFound - SteamVR cannot detect your VR headset, ensure the USB cable is plugged in.
  332. If that doesn't work, try deleting your Steam/config/steamvr.cfg.
  333. * HmdError_Init_InterfaceNotFound - Make sure your SteamVR runtime is up to date.
  334. * HmdError_IPC_ConnectFailed - SteamVR launches a separate process called vrserver.exe which directly talks
  335. to the hardware. Games communicate to vrserver through vrclient.dll over IPC. This error is usually due
  336. to the communication pipe between the two having closed. Use task manager to verify there are no rogue apps
  337. that got stuck trying to shut down. Often it's just a matter of the connection timing out the first time
  338. due to long load times. Launching a second time usually resolves this.
  339. * "Not using DXGI 1.1" - Older versions of Unity used DXGI 1.0 which doesn't support functionality the compositor
  340. requires to operate properly. To fix this, we've added a hook to Steam to force DXGI 1.1. To enable this hook
  341. set the environement variable ForceDXGICreateFactory1 = 1 and launch the Unity Editor or your standalone builds
  342. via Steam by manually adding them using the "Add Game..." button found in the lower left of the Library tab.
  343. * Core Parking often causes hitching. The easiest way to disable core parking is to download the tool called
  344. Core Parking Manager, slide the slider to 100% and click Apply.