├── HoloLensCameraStream ├── .editorconfig ├── .gitignore ├── Dummy Project │ ├── CameraIntrinsics.cs │ ├── CameraParameters.cs │ ├── CapturePixelFormat.cs │ ├── Dummy.csproj │ ├── HololensDeviceType.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resolution.cs │ ├── ResultType.cs │ ├── VideoCapture.cs │ ├── VideoCaptureResult.cs │ └── VideoCaptureSample.cs ├── HoloLensCameraStream.sln └── Plugin Project │ ├── CameraIntrinsics.cs │ ├── CameraParameters.cs │ ├── CapturePixelFormat.cs │ ├── HololensDeviceType.cs │ ├── Plugin.csproj │ ├── Properties │ ├── AssemblyInfo.cs │ └── HLVideoFramesPlugin.rd.xml │ ├── Resolution.cs │ ├── ResultType.cs │ ├── VideoCapture.cs │ ├── VideoCaptureResult.cs │ └── VideoCaptureSample.cs ├── HoloLensVideoCaptureExample ├── .editorconfig ├── .gitignore ├── .vsconfig ├── Assets │ ├── CamStream.meta │ ├── CamStream │ │ ├── Examples.meta │ │ ├── Examples │ │ │ ├── Matrix Usage Example.meta │ │ │ ├── Matrix Usage Example │ │ │ │ ├── Matrix Usage Example.unity │ │ │ │ ├── Matrix Usage Example.unity.meta │ │ │ │ ├── Prefabs.meta │ │ │ │ ├── Prefabs │ │ │ │ │ ├── Indicator.prefab │ │ │ │ │ └── Indicator.prefab.meta │ │ │ │ ├── Scripts.meta │ │ │ │ └── Scripts │ │ │ │ │ ├── IndicatorDisplay.cs │ │ │ │ │ ├── IndicatorDisplay.cs.meta │ │ │ │ │ ├── MatrixUsageApp.cs │ │ │ │ │ └── MatrixUsageApp.cs.meta │ │ │ ├── Projection Example.meta │ │ │ ├── Projection Example │ │ │ │ ├── Projection Example.unity │ │ │ │ ├── Projection Example.unity.meta │ │ │ │ ├── Scripts.meta │ │ │ │ └── Scripts │ │ │ │ │ ├── ProjectionExample.cs │ │ │ │ │ ├── ProjectionExample.cs.meta │ │ │ │ │ ├── RaycastLaser.cs │ │ │ │ │ └── RaycastLaser.cs.meta │ │ │ ├── Video Panel Example.meta │ │ │ └── Video Panel Example │ │ │ │ ├── Prefabs.meta │ │ │ │ ├── Prefabs │ │ │ │ ├── Video Panel.prefab │ │ │ │ └── Video Panel.prefab.meta │ │ │ │ ├── Scripts.meta │ │ │ │ ├── Scripts │ │ │ │ ├── VideoPanel.cs │ │ │ │ ├── VideoPanel.cs.meta │ │ │ │ ├── VideoPanelApp.cs │ │ │ │ └── VideoPanelApp.cs.meta │ │ │ │ ├── Video Panel Example.unity │ │ │ │ └── Video Panel Example.unity.meta │ │ ├── Plugins.meta │ │ ├── Plugins │ │ │ ├── HoloLensCameraStream.dll │ │ │ ├── HoloLensCameraStream.dll.meta │ │ │ ├── WSA.meta │ │ │ └── WSA │ │ │ │ ├── HoloLensCameraStream.dll │ │ │ │ └── HoloLensCameraStream.dll.meta │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ │ ├── Camera Stream.prefab │ │ │ └── Camera Stream.prefab.meta │ │ ├── README.txt │ │ ├── README.txt.meta │ │ ├── Resources.meta │ │ ├── Resources │ │ │ ├── Materials.meta │ │ │ ├── Materials │ │ │ │ ├── Blue.mat │ │ │ │ ├── Blue.mat.meta │ │ │ │ ├── Green.mat │ │ │ │ ├── Green.mat.meta │ │ │ │ ├── Orange.mat │ │ │ │ ├── Orange.mat.meta │ │ │ │ ├── Pink.mat │ │ │ │ ├── Pink.mat.meta │ │ │ │ ├── Red.mat │ │ │ │ ├── Red.mat.meta │ │ │ │ ├── VideoPanel.mat │ │ │ │ └── VideoPanel.mat.meta │ │ │ ├── Shaders.meta │ │ │ └── Shaders │ │ │ │ ├── HolographicImageBlend.shader │ │ │ │ ├── HolographicImageBlend.shader.meta │ │ │ │ ├── HolographicImageBlendGrayscale.shader │ │ │ │ ├── HolographicImageBlendGrayscale.shader.meta │ │ │ │ ├── TextureSinglePass.shader │ │ │ │ ├── TextureSinglePass.shader.meta │ │ │ │ ├── TextureSinglePassGreyscale.shader │ │ │ │ └── TextureSinglePassGreyscale.shader.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── CameraStreamHelper.cs │ │ │ ├── CameraStreamHelper.cs.meta │ │ │ ├── LocatableCameraUtils.cs │ │ │ └── LocatableCameraUtils.cs.meta │ ├── WSATestCertificate.pfx │ └── WSATestCertificate.pfx.meta ├── Logs │ └── Packages-Update.log ├── Packages │ ├── manifest.json │ └── packages-lock.json └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── PackageManagerSettings.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityConnectSettings.asset │ ├── VFXManager.asset │ └── XRSettings.asset ├── LICENSE └── README.md /HoloLensCameraStream/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.cs] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 -------------------------------------------------------------------------------- /HoloLensCameraStream/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | 254 | # ========================= 255 | # Operating System Files 256 | # ========================= 257 | 258 | # OSX 259 | # ========================= 260 | 261 | .DS_Store 262 | .AppleDouble 263 | .LSOverride 264 | 265 | # Thumbnails 266 | ._* 267 | 268 | # Files that might appear in the root of a volume 269 | .DocumentRevisions-V100 270 | .fseventsd 271 | .Spotlight-V100 272 | .TemporaryItems 273 | .Trashes 274 | .VolumeIcon.icns 275 | 276 | # Directories potentially created on remote AFP share 277 | .AppleDB 278 | .AppleDesktop 279 | Network Trash Folder 280 | Temporary Items 281 | .apdisk 282 | 283 | # Windows 284 | # ========================= 285 | 286 | # Windows image file caches 287 | Thumbs.db 288 | ehthumbs.db 289 | 290 | # Folder config file 291 | Desktop.ini 292 | 293 | # Recycle Bin used on file shares 294 | $RECYCLE.BIN/ 295 | 296 | # Windows Installer files 297 | *.cab 298 | *.msi 299 | *.msm 300 | *.msp 301 | 302 | # Windows shortcuts 303 | *.lnk 304 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/CameraIntrinsics.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public class CameraIntrinsics 9 | { 10 | public uint ImageWidth; // image width of the camera, in pixels. 11 | public uint ImageHeight; // image height of the camera, in pixels. 12 | public float FocalLengthX; // focal length x. 13 | public float FocalLengthY; // focal length y. 14 | public float PrincipalPointX; // principal point x. 15 | public float PrincipalPointY; // principal point y. 16 | public float RadialDistK1; // radial distortion coefficient k1. 17 | public float RadialDistK2; // radial distortion coefficient k2. 18 | public float RadialDistK3; // radial distortion coefficient k3. 19 | public float TangentialDistP1; // tangential distortion coefficient p1. 20 | public float TangentialDistP2; // tangential distortion coefficient p2. 21 | //public Matrix4x4 UndistortedProjectionTransform; 22 | } 23 | } -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/CameraParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using System; 7 | 8 | namespace HoloLensCameraStream 9 | { 10 | public struct CameraParameters 11 | { 12 | public CapturePixelFormat pixelFormat; 13 | 14 | public int cameraResolutionHeight; 15 | 16 | public int cameraResolutionWidth; 17 | 18 | public int frameRate; 19 | 20 | public bool rotateImage180Degrees; 21 | 22 | public float hologramOpacity; 23 | public bool enableHolograms 24 | { 25 | get { throw new NotImplementedException(); } 26 | set { throw new NotImplementedException(); } 27 | } 28 | 29 | public int videoStabilizationBufferSize; 30 | public bool enableVideoStabilization 31 | { 32 | get { throw new NotImplementedException(); } 33 | set { throw new NotImplementedException(); } 34 | } 35 | 36 | public bool recordingIndicatorVisible; 37 | 38 | public CameraParameters( 39 | CapturePixelFormat pixelFormat = CapturePixelFormat.BGRA32, 40 | int cameraResolutionHeight = 720, 41 | int cameraResolutionWidth = 1280, 42 | int frameRate = 30, 43 | bool rotateImage180Degrees = true, 44 | bool recordingIndicatorVisible=true) 45 | { throw new NotImplementedException(); } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/CapturePixelFormat.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public enum CapturePixelFormat 9 | { 10 | BGRA32, 11 | NV12, 12 | JPEG, 13 | PNG, 14 | Unknown 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/Dummy.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9} 8 | Library 9 | Properties 10 | HoloLensCameraStream 11 | HoloLensCameraStream 12 | v3.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | copy "$(TargetDir)$(TargetFileName)" "$(SolutionDir)..\HoloLensVideoCaptureExample\Assets\CamStream\Plugins\$(TargetFileName)" 55 | 56 | 63 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/HololensDeviceType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public enum HololensDeviceType 9 | { 10 | Unknown, 11 | Hololens1, 12 | Hololens2 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HoloLens Camera Stream for Unity (Placeholder Assembly)")] 9 | [assembly: AssemblyDescription("A placeholder assembly to keep the Unity compiler quiet when using the real plugin.")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Vulcan, Inc")] 12 | [assembly: AssemblyProduct("HoloLens Camera Stream for Unity (Placeholder Assembly)")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("397322ef-b88f-47d6-b5fa-ebab474fe3a9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.3.0.0")] 36 | [assembly: AssemblyFileVersion("0.3.0.0")] 37 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/Resolution.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public struct Resolution 9 | { 10 | public readonly int width; 11 | public readonly int height; 12 | 13 | public Resolution(int width, int height) 14 | { 15 | this.width = width; 16 | this.height = height; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/ResultType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public enum ResultType 9 | { 10 | Success, 11 | InappropriateState, 12 | UnknownError 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/VideoCapture.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | 9 | namespace HoloLensCameraStream 10 | { 11 | public delegate void OnVideoCaptureResourceCreatedCallback(VideoCapture captureObject); 12 | 13 | public delegate void OnVideoModeStartedCallback(VideoCaptureResult result); 14 | 15 | public delegate void FrameSampleAcquiredCallback(VideoCaptureSample videoCaptureSample); 16 | 17 | public delegate void OnVideoModeStoppedCallback(VideoCaptureResult result); 18 | 19 | public sealed class VideoCapture 20 | { 21 | public static IEnumerable SupportedResolutions 22 | { 23 | get 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | 29 | public static IEnumerable SupportedFrameRatesForResolution(Resolution resolution) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | 34 | #pragma warning disable 067 35 | public event FrameSampleAcquiredCallback FrameSampleAcquired; 36 | #pragma warning restore 067 37 | 38 | public bool IsStreaming 39 | { 40 | get 41 | { 42 | throw new NotImplementedException(); 43 | } 44 | } 45 | 46 | public IntPtr WorldOriginPtr 47 | { 48 | get; set; 49 | } 50 | 51 | public object WorldOrigin 52 | { 53 | get; set; 54 | } 55 | 56 | public static void CreateAync(OnVideoCaptureResourceCreatedCallback onCreatedCallback, bool sharedStream=false) 57 | { 58 | throw new NotImplementedException(); 59 | } 60 | 61 | public IEnumerable GetSupportedResolutions() 62 | { 63 | throw new NotImplementedException(); 64 | } 65 | 66 | public IEnumerable GetSupportedFrameRatesForResolution(Resolution resolution) 67 | { 68 | throw new NotImplementedException(); 69 | } 70 | 71 | public void StartVideoModeAsync(CameraParameters setupParams, OnVideoModeStartedCallback onVideoModeStartedCallback) 72 | { 73 | throw new NotImplementedException(); 74 | } 75 | 76 | public void RequestNextFrameSample(FrameSampleAcquiredCallback onFrameSampleAcquired) 77 | { 78 | throw new NotImplementedException(); 79 | } 80 | 81 | public void StopVideoModeAsync(OnVideoModeStoppedCallback onVideoModeStoppedCallback) 82 | { 83 | throw new NotImplementedException(); 84 | } 85 | 86 | public void Dispose() 87 | { 88 | throw new NotImplementedException(); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/VideoCaptureResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public struct VideoCaptureResult 9 | { 10 | public readonly long hResult; 11 | 12 | public readonly ResultType resultType; 13 | 14 | public readonly bool success; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Dummy Project/VideoCaptureSample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | 9 | namespace HoloLensCameraStream 10 | { 11 | public class VideoCaptureSample 12 | { 13 | public int dataLength { get; private set; } 14 | 15 | public bool hasLocationData { get; private set; } 16 | 17 | public CapturePixelFormat pixelFormat { get; private set; } 18 | 19 | public CameraIntrinsics cameraIntrinsics { get; } 20 | 21 | public int FrameWidth { get; private set; } 22 | 23 | public int FrameHeight { get; private set; } 24 | 25 | public void CopyRawImageDataIntoBuffer(byte[] byteBuffer) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | 30 | public void CopyRawImageDataIntoBuffer(List byteBuffer) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | 35 | public bool TryGetCameraToWorldMatrix(out float[] outMatrix) 36 | { 37 | throw new NotImplementedException(); 38 | } 39 | 40 | public bool TryGetProjectionMatrix(out float[] outMatrix) 41 | { 42 | throw new NotImplementedException(); 43 | } 44 | 45 | public void UploadImageDataToTexture(object targetTexture) 46 | { 47 | throw new NotImplementedException(); 48 | } 49 | 50 | public void Dispose() 51 | { 52 | throw new NotImplementedException(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /HoloLensCameraStream/HoloLensCameraStream.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.32126.315 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin", "Plugin Project\Plugin.csproj", "{EE916C57-B4F5-42A6-912A-132BCC4AC8F4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dummy", "Dummy Project\Dummy.csproj", "{397322EF-B88F-47D6-B5FA-EBAB474FE3A9}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6ADB8443-13D4-47AE-8A4F-52BCE54A6154}" 11 | ProjectSection(SolutionItems) = preProject 12 | .editorconfig = .editorconfig 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|ARM = Debug|ARM 19 | Debug|x64 = Debug|x64 20 | Debug|x86 = Debug|x86 21 | Release|Any CPU = Release|Any CPU 22 | Release|ARM = Release|ARM 23 | Release|x64 = Release|x64 24 | Release|x86 = Release|x86 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|ARM.ActiveCfg = Debug|ARM 30 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|ARM.Build.0 = Debug|ARM 31 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|x64.ActiveCfg = Debug|x64 32 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|x64.Build.0 = Debug|x64 33 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|x86.ActiveCfg = Debug|x86 34 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Debug|x86.Build.0 = Debug|x86 35 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|ARM.ActiveCfg = Release|ARM 38 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|ARM.Build.0 = Release|ARM 39 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|x64.ActiveCfg = Release|x64 40 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|x64.Build.0 = Release|x64 41 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|x86.ActiveCfg = Release|x86 42 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4}.Release|x86.Build.0 = Release|x86 43 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|ARM.ActiveCfg = Debug|Any CPU 46 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|ARM.Build.0 = Debug|Any CPU 47 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|x64.ActiveCfg = Debug|Any CPU 48 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|x64.Build.0 = Debug|Any CPU 49 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|x86.ActiveCfg = Debug|Any CPU 50 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Debug|x86.Build.0 = Debug|Any CPU 51 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|ARM.ActiveCfg = Release|Any CPU 54 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|ARM.Build.0 = Release|Any CPU 55 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|x64.ActiveCfg = Release|Any CPU 56 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|x64.Build.0 = Release|Any CPU 57 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|x86.ActiveCfg = Release|Any CPU 58 | {397322EF-B88F-47D6-B5FA-EBAB474FE3A9}.Release|x86.Build.0 = Release|Any CPU 59 | EndGlobalSection 60 | GlobalSection(SolutionProperties) = preSolution 61 | HideSolutionNode = FALSE 62 | EndGlobalSection 63 | GlobalSection(ExtensibilityGlobals) = postSolution 64 | SolutionGuid = {6B07562A-FF02-4864-A0C1-A6C01E0E57CB} 65 | EndGlobalSection 66 | EndGlobal 67 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/CameraIntrinsics.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | /// 9 | /// Contains information on camera intrinsic parameters. 10 | /// Note: This class wraps logic in Windows.Media.Devices.Core.CameraIntrinsics for use in Unity. 11 | /// 12 | public class CameraIntrinsics 13 | { 14 | public uint ImageWidth; // image width of the camera, in pixels. 15 | public uint ImageHeight; // image height of the camera, in pixels. 16 | public float FocalLengthX; // focal length x. 17 | public float FocalLengthY; // focal length y. 18 | public float PrincipalPointX; // principal point x. 19 | public float PrincipalPointY; // principal point y. 20 | public float RadialDistK1; // radial distortion coefficient k1. 21 | public float RadialDistK2; // radial distortion coefficient k2. 22 | public float RadialDistK3; // radial distortion coefficient k3. 23 | public float TangentialDistP1; // tangential distortion coefficient p1. 24 | public float TangentialDistP2; // tangential distortion coefficient p2. 25 | //public Matrix4x4 UndistortedProjectionTransform; 26 | 27 | /// 28 | /// CameraIntrinsics constructor 29 | /// 30 | /// image width in pixels 31 | /// image height in pixels 32 | /// focal length x for the camera 33 | /// focal length y for the camera 34 | /// principal point x for the camera 35 | /// principal point y for the camera 36 | /// radial distortion k1 for the camera 37 | /// radial distortion k2 for the camera 38 | /// radial distortion k3 for the camera 39 | /// tangential distortion p1 for the camera 40 | /// tangential distortion p2 for the camera 41 | public CameraIntrinsics( 42 | uint imageWidth, 43 | uint imageHeight, 44 | float focalLengthX, 45 | float focalLengthY, 46 | float principalPointX, 47 | float principalPointY, 48 | float radialDistK1, 49 | float radialDistK2, 50 | float radialDistK3, 51 | float tangentialDistP1, 52 | float tangentialDistP2) 53 | { 54 | ImageWidth = imageWidth; 55 | ImageHeight = imageHeight; 56 | FocalLengthX = focalLengthX; 57 | FocalLengthY = focalLengthY; 58 | PrincipalPointX = principalPointX; 59 | PrincipalPointY = principalPointY; 60 | RadialDistK1 = radialDistK1; 61 | RadialDistK2 = radialDistK2; 62 | RadialDistK3 = radialDistK3; 63 | TangentialDistP1 = tangentialDistP1; 64 | TangentialDistP2 = tangentialDistP2; 65 | } 66 | 67 | /// 68 | /// CameraIntrinsics constructor 69 | /// 70 | /// Windows.Media.Devices.Core.CameraIntrinsics 71 | public CameraIntrinsics(Windows.Media.Devices.Core.CameraIntrinsics intrinsics) 72 | { 73 | ImageWidth = intrinsics.ImageWidth; 74 | ImageHeight = intrinsics.ImageHeight; 75 | FocalLengthX = intrinsics.FocalLength.X; 76 | FocalLengthY = intrinsics.FocalLength.Y; 77 | PrincipalPointX = intrinsics.PrincipalPoint.X; 78 | PrincipalPointY = intrinsics.PrincipalPoint.Y; 79 | RadialDistK1 = intrinsics.RadialDistortion.X; 80 | RadialDistK2 = intrinsics.RadialDistortion.Y; 81 | RadialDistK3 = intrinsics.RadialDistortion.Z; 82 | TangentialDistP1 = intrinsics.TangentialDistortion.X; 83 | TangentialDistP2 = intrinsics.TangentialDistortion.Y; 84 | } 85 | 86 | public override string ToString() 87 | { 88 | return $"Image Width:{ImageWidth.ToString("G4")}, " + 89 | $"Image Height:{ImageHeight.ToString("G4")}," + 90 | $"Focal Length X:{FocalLengthX.ToString("G4")}, " + 91 | $"Focal Length Y:{FocalLengthY.ToString("G4")}, " + 92 | $"Principal Point X:{PrincipalPointX.ToString("G4")}, " + 93 | $"Principal Point Y:{PrincipalPointY.ToString("G4")}, " + 94 | $"Radial Distortion K1:{RadialDistK1.ToString("G4")}, " + 95 | $"Radial Distortion K2:{RadialDistK2.ToString("G4")}, " + 96 | $"Radial Distortion K3:{RadialDistK3.ToString("G4")}, " + 97 | $"Tangential Distortion P1:{TangentialDistP1.ToString("G4")} " + 98 | $"Tangential Distortion P2:{TangentialDistP2.ToString("G4")} "; 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/CameraParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | /// 9 | /// When calling VideoCapture.StartPhotoModeAsync, you must pass in a CameraParameters object 10 | /// that contains the various settings that the web camera will use. 11 | /// 12 | public struct CameraParameters 13 | { 14 | /// 15 | /// The pixel format used to capture and record your image data. 16 | /// 17 | public CapturePixelFormat pixelFormat; 18 | 19 | /// 20 | /// The height of the image frame. Must be a valid option. 21 | /// Valid options can be obtained from VideoCapture.SupportedResolutions. 22 | /// 23 | public int cameraResolutionHeight; 24 | 25 | /// 26 | /// The width of the image frame. Must be a valid option. 27 | /// Valid options can be obtained from VideoCapture.SupportedResolutions. 28 | /// 29 | public int cameraResolutionWidth; 30 | 31 | /// 32 | /// The frames per second that the video will stream at. Must be supported based on the selected resolution. 33 | /// 34 | public int frameRate; 35 | 36 | /// 37 | /// Rotate image by 180 degrees if you find it to be upside down in your application. 38 | /// Depending on your usage, some image readers will require this to be toggled. 39 | /// 40 | public bool rotateImage180Degrees; 41 | 42 | /// 43 | /// EXPERIMENTAL: Enable holograms if opacity > 0. (internally these are two options, but rolled into one) 44 | /// https://developer.microsoft.com/en-us/windows/mixed-reality/mixed_reality_capture_for_developers 45 | /// 46 | public float hologramOpacity; 47 | 48 | /// 49 | /// EXPERIMENTAL: Sets the hologram opacity to opaque if true, or to invisible if false. 50 | /// 51 | public bool enableHolograms 52 | { 53 | get { return hologramOpacity > 0.0f; } 54 | set { hologramOpacity = value ? 0.9f : 0.0f; } 55 | } 56 | 57 | /// 58 | /// EXPERIMENTAL: Enable Video stabilisation and set the buffer amount. Docs recommend 15. 59 | /// https://developer.microsoft.com/en-us/windows/mixed-reality/mixed_reality_capture_for_developers 60 | /// 61 | public int videoStabilizationBufferSize; 62 | 63 | /// 64 | /// EXPERIMENTAL: Flag to enable or disable video stabilization powered by the HoloLens tracker. 65 | /// 66 | public bool enableVideoStabilization 67 | { 68 | get { return videoStabilizationBufferSize > 0; } 69 | set { videoStabilizationBufferSize = value ? 15 : 0; } 70 | } 71 | 72 | public bool recordingIndicatorVisible; 73 | 74 | public CameraParameters( 75 | CapturePixelFormat pixelFormat = CapturePixelFormat.BGRA32, 76 | int cameraResolutionHeight = 720, 77 | int cameraResolutionWidth = 1280, 78 | int frameRate = 30, 79 | bool rotateImage180Degrees = true, 80 | bool recordingIndicatorVisible = true 81 | ) 82 | { 83 | this.pixelFormat = pixelFormat; 84 | this.cameraResolutionHeight = cameraResolutionHeight; 85 | this.cameraResolutionWidth = cameraResolutionWidth; 86 | this.frameRate = frameRate; 87 | this.rotateImage180Degrees = rotateImage180Degrees; 88 | this.recordingIndicatorVisible = recordingIndicatorVisible; 89 | videoStabilizationBufferSize = 0; 90 | hologramOpacity = 0.0f; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/CapturePixelFormat.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | /// 9 | /// The pixel format used to capture and record your image data. 10 | /// 11 | public enum CapturePixelFormat 12 | { 13 | BGRA32, 14 | NV12, 15 | JPEG, 16 | PNG, 17 | Unknown 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/HololensDeviceType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | /// 9 | /// Represents the type of Hololens device. 10 | /// 11 | public enum HololensDeviceType 12 | { 13 | Unknown, 14 | Hololens1, 15 | Hololens2 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/Plugin.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {EE916C57-B4F5-42A6-912A-132BCC4AC8F4} 8 | Library 9 | Properties 10 | HoloLensCameraStream 11 | HoloLensCameraStream 12 | en-US 13 | UAP 14 | 10.0.19041.0 15 | 10.0.10586.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot 20 | 21 | 22 | AnyCPU 23 | true 24 | full 25 | false 26 | bin\Debug\ 27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 28 | prompt 29 | 4 30 | 31 | 32 | AnyCPU 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE;NETFX_CORE;WINDOWS_UWP 37 | prompt 38 | 4 39 | 40 | 41 | x86 42 | true 43 | bin\x86\Debug\ 44 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 45 | ;2008 46 | full 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | x86 53 | bin\x86\Release\ 54 | TRACE;NETFX_CORE;WINDOWS_UWP 55 | true 56 | ;2008 57 | pdbonly 58 | x86 59 | false 60 | prompt 61 | 62 | 63 | ARM 64 | true 65 | bin\ARM\Debug\ 66 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 67 | ;2008 68 | full 69 | ARM 70 | false 71 | prompt 72 | 73 | 74 | ARM 75 | bin\ARM\Release\ 76 | TRACE;NETFX_CORE;WINDOWS_UWP 77 | true 78 | ;2008 79 | pdbonly 80 | ARM 81 | false 82 | prompt 83 | 84 | 85 | x64 86 | true 87 | bin\x64\Debug\ 88 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 89 | ;2008 90 | full 91 | x64 92 | false 93 | prompt 94 | 95 | 96 | x64 97 | bin\x64\Release\ 98 | TRACE;NETFX_CORE;WINDOWS_UWP 99 | true 100 | ;2008 101 | pdbonly 102 | x64 103 | false 104 | prompt 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 5.0.0 122 | 123 | 124 | 125 | 14.0 126 | 127 | 128 | 129 | 130 | 131 | 132 | copy "$(TargetDir)$(TargetFileName)" "$(SolutionDir)..\HoloLensVideoCaptureExample\Assets\CamStream\Plugins\WSA\$(TargetFileName)" 133 | 134 | 141 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("HoloLens Camera Stream for Unity")] 10 | [assembly: AssemblyDescription("Makes the HoloLens' camera's video buffer available to Unity in memory with locatable attributes.")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("Vulcan Inc.")] 13 | [assembly: AssemblyProduct("HoloLens Camera Stream for Unity")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Version information for an assembly consists of the following four values: 19 | // 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // You can specify all the values or you can default the Build and Revision Numbers 26 | // by using the '*' as shown below: 27 | // [assembly: AssemblyVersion("1.0.*")] 28 | [assembly: AssemblyVersion("0.3.0.0")] 29 | [assembly: AssemblyFileVersion("0.3.0.0")] 30 | [assembly: ComVisible(false)] 31 | [assembly: NeutralResourcesLanguage("")] 32 | 33 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/Properties/HLVideoFramesPlugin.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/Resolution.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | /// 9 | /// A structure for holding a resolution. 10 | /// 11 | public struct Resolution 12 | { 13 | /// 14 | /// The width property. 15 | /// 16 | public readonly int width; 17 | 18 | /// 19 | /// The height property. 20 | /// 21 | public readonly int height; 22 | 23 | public Resolution(int width, int height) 24 | { 25 | this.width = width; 26 | this.height = height; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/ResultType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | /// 9 | /// Represents the reason why the callback fired. 10 | /// 11 | public enum ResultType 12 | { 13 | /// 14 | /// Everything went okay, continue down the happy path. 15 | /// 16 | Success, 17 | /// 18 | /// A function was called when the VideoCapture object when in the wrong state. 19 | /// For instance, alling StopVideoModeAsync() when video mode is already stopped 20 | /// will result in an early calling of the callback as the video mode does not need 21 | /// time to be stopped. 22 | /// 23 | InappropriateState, 24 | 25 | /// 26 | /// Something went wrong when performing the async operation. 27 | /// VideoCapture should not be considered a stable, usable object. 28 | /// 29 | UnknownError 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /HoloLensCameraStream/Plugin Project/VideoCaptureResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | namespace HoloLensCameraStream 7 | { 8 | public struct VideoCaptureResult 9 | { 10 | /// 11 | /// Not really used. Set to 1 when success=false, and is 0 when success=true 12 | /// 13 | public readonly long hResult; 14 | 15 | /// 16 | /// Represents the reason why the callback fired. 17 | /// 18 | public readonly ResultType resultType; 19 | 20 | /// 21 | /// A simple answer of whether or not everything worked out with the async process. 22 | /// 23 | public readonly bool success; 24 | 25 | internal VideoCaptureResult(long hResult, ResultType resultType, bool success) 26 | { 27 | this.hResult = hResult; 28 | this.resultType = resultType; 29 | this.success = success; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.cs] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | /App 8 | 9 | # Autogenerated VS/MD/Consulo solution and project files 10 | ExportedObj/ 11 | .consulo/ 12 | *.csproj 13 | *.unityproj 14 | *.sln 15 | *.suo 16 | *.tmp 17 | *.user 18 | *.userprefs 19 | *.pidb 20 | *.booproj 21 | *.svd 22 | *.pdb 23 | *.weights 24 | 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | *.weights.meta 29 | 30 | # Unity3D Generated File On Crash Reports 31 | sysinfo.txt 32 | 33 | # Builds 34 | *.apk 35 | *.unitypackage 36 | UWP/ 37 | 38 | /.vs/ 39 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4e8e4bcb06967849b0a31f41b561f55 3 | folderAsset: yes 4 | timeCreated: 1491327763 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2515b3e74aa3fba4c9138bfd4226ce59 3 | folderAsset: yes 4 | timeCreated: 1491329850 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6979babb9f854b3488f81188a625f2ec 3 | folderAsset: yes 4 | timeCreated: 1494527014 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Matrix Usage Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 412fd74fbf15aa44d9057de5b59b3275 3 | timeCreated: 1494527063 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b2d6cf1805f06749addaf51a5b3e3c2 3 | folderAsset: yes 4 | timeCreated: 1494532874 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Prefabs/Indicator.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1692085953900470} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1352151076467692 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4041534236518402} 22 | - component: {fileID: 23688555144494898} 23 | - component: {fileID: 102013180453106392} 24 | m_Layer: 0 25 | m_Name: Text 26 | m_TagString: Untagged 27 | m_Icon: {fileID: 0} 28 | m_NavMeshLayer: 0 29 | m_StaticEditorFlags: 0 30 | m_IsActive: 1 31 | --- !u!1 &1692085953900470 32 | GameObject: 33 | m_ObjectHideFlags: 0 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | serializedVersion: 5 37 | m_Component: 38 | - component: {fileID: 4811640837108244} 39 | - component: {fileID: 33774438635224668} 40 | - component: {fileID: 65945494482427468} 41 | - component: {fileID: 23249987965690936} 42 | - component: {fileID: 114301613550708860} 43 | m_Layer: 0 44 | m_Name: Indicator 45 | m_TagString: Untagged 46 | m_Icon: {fileID: 0} 47 | m_NavMeshLayer: 0 48 | m_StaticEditorFlags: 0 49 | m_IsActive: 1 50 | --- !u!4 &4041534236518402 51 | Transform: 52 | m_ObjectHideFlags: 1 53 | m_PrefabParentObject: {fileID: 0} 54 | m_PrefabInternal: {fileID: 100100000} 55 | m_GameObject: {fileID: 1352151076467692} 56 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 57 | m_LocalPosition: {x: 0, y: 1, z: 0} 58 | m_LocalScale: {x: 1, y: 1, z: 1} 59 | m_Children: [] 60 | m_Father: {fileID: 4811640837108244} 61 | m_RootOrder: 0 62 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 63 | --- !u!4 &4811640837108244 64 | Transform: 65 | m_ObjectHideFlags: 1 66 | m_PrefabParentObject: {fileID: 0} 67 | m_PrefabInternal: {fileID: 100100000} 68 | m_GameObject: {fileID: 1692085953900470} 69 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 70 | m_LocalPosition: {x: 0, y: 0, z: 0} 71 | m_LocalScale: {x: 0.3, y: 0.3, z: 0.3} 72 | m_Children: 73 | - {fileID: 4041534236518402} 74 | m_Father: {fileID: 0} 75 | m_RootOrder: 0 76 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 77 | --- !u!23 &23249987965690936 78 | MeshRenderer: 79 | m_ObjectHideFlags: 1 80 | m_PrefabParentObject: {fileID: 0} 81 | m_PrefabInternal: {fileID: 100100000} 82 | m_GameObject: {fileID: 1692085953900470} 83 | m_Enabled: 1 84 | m_CastShadows: 1 85 | m_ReceiveShadows: 1 86 | m_MotionVectors: 1 87 | m_LightProbeUsage: 1 88 | m_ReflectionProbeUsage: 1 89 | m_Materials: 90 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 91 | m_StaticBatchInfo: 92 | firstSubMesh: 0 93 | subMeshCount: 0 94 | m_StaticBatchRoot: {fileID: 0} 95 | m_ProbeAnchor: {fileID: 0} 96 | m_LightProbeVolumeOverride: {fileID: 0} 97 | m_ScaleInLightmap: 1 98 | m_PreserveUVs: 1 99 | m_IgnoreNormalsForChartDetection: 0 100 | m_ImportantGI: 0 101 | m_SelectedEditorRenderState: 3 102 | m_MinimumChartSize: 4 103 | m_AutoUVMaxDistance: 0.5 104 | m_AutoUVMaxAngle: 89 105 | m_LightmapParameters: {fileID: 0} 106 | m_SortingLayerID: 0 107 | m_SortingLayer: 0 108 | m_SortingOrder: 0 109 | --- !u!23 &23688555144494898 110 | MeshRenderer: 111 | m_ObjectHideFlags: 1 112 | m_PrefabParentObject: {fileID: 0} 113 | m_PrefabInternal: {fileID: 100100000} 114 | m_GameObject: {fileID: 1352151076467692} 115 | m_Enabled: 1 116 | m_CastShadows: 1 117 | m_ReceiveShadows: 1 118 | m_MotionVectors: 1 119 | m_LightProbeUsage: 1 120 | m_ReflectionProbeUsage: 1 121 | m_Materials: 122 | - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} 123 | m_StaticBatchInfo: 124 | firstSubMesh: 0 125 | subMeshCount: 0 126 | m_StaticBatchRoot: {fileID: 0} 127 | m_ProbeAnchor: {fileID: 0} 128 | m_LightProbeVolumeOverride: {fileID: 0} 129 | m_ScaleInLightmap: 1 130 | m_PreserveUVs: 0 131 | m_IgnoreNormalsForChartDetection: 0 132 | m_ImportantGI: 0 133 | m_SelectedEditorRenderState: 3 134 | m_MinimumChartSize: 4 135 | m_AutoUVMaxDistance: 0.5 136 | m_AutoUVMaxAngle: 89 137 | m_LightmapParameters: {fileID: 0} 138 | m_SortingLayerID: 0 139 | m_SortingLayer: 0 140 | m_SortingOrder: 0 141 | --- !u!33 &33774438635224668 142 | MeshFilter: 143 | m_ObjectHideFlags: 1 144 | m_PrefabParentObject: {fileID: 0} 145 | m_PrefabInternal: {fileID: 100100000} 146 | m_GameObject: {fileID: 1692085953900470} 147 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 148 | --- !u!65 &65945494482427468 149 | BoxCollider: 150 | m_ObjectHideFlags: 1 151 | m_PrefabParentObject: {fileID: 0} 152 | m_PrefabInternal: {fileID: 100100000} 153 | m_GameObject: {fileID: 1692085953900470} 154 | m_Material: {fileID: 0} 155 | m_IsTrigger: 0 156 | m_Enabled: 1 157 | serializedVersion: 2 158 | m_Size: {x: 1, y: 1, z: 1} 159 | m_Center: {x: 0, y: 0, z: 0} 160 | --- !u!102 &102013180453106392 161 | TextMesh: 162 | serializedVersion: 3 163 | m_ObjectHideFlags: 1 164 | m_PrefabParentObject: {fileID: 0} 165 | m_PrefabInternal: {fileID: 100100000} 166 | m_GameObject: {fileID: 1352151076467692} 167 | m_Text: Indicator 168 | m_OffsetZ: 0 169 | m_CharacterSize: 0.5 170 | m_LineSpacing: 1 171 | m_Anchor: 4 172 | m_Alignment: 0 173 | m_TabSize: 4 174 | m_FontSize: 0 175 | m_FontStyle: 0 176 | m_RichText: 1 177 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 178 | m_Color: 179 | serializedVersion: 2 180 | rgba: 4278190080 181 | --- !u!114 &114301613550708860 182 | MonoBehaviour: 183 | m_ObjectHideFlags: 1 184 | m_PrefabParentObject: {fileID: 0} 185 | m_PrefabInternal: {fileID: 100100000} 186 | m_GameObject: {fileID: 1692085953900470} 187 | m_Enabled: 1 188 | m_EditorHideFlags: 0 189 | m_Script: {fileID: 11500000, guid: ef714e2779fc28d429abcc629b057d7f, type: 3} 190 | m_Name: 191 | m_EditorClassIdentifier: 192 | DisplayText: {fileID: 102013180453106392} 193 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Prefabs/Indicator.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca3c74ad9913f894f825cede756e78b2 3 | timeCreated: 1494536281 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc336c161218db94f93395b6491e7217 3 | folderAsset: yes 4 | timeCreated: 1494532870 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Scripts/IndicatorDisplay.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using UnityEngine; 7 | 8 | public class IndicatorDisplay : MonoBehaviour 9 | { 10 | public TextMesh DisplayText; 11 | 12 | public void SetText(string label) 13 | { 14 | DisplayText.text = label; 15 | } 16 | 17 | public void SetPosition(Vector3 pos) 18 | { 19 | gameObject.transform.position = pos; 20 | } 21 | } -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Scripts/IndicatorDisplay.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef714e2779fc28d429abcc629b057d7f 3 | timeCreated: 1494535786 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Scripts/MatrixUsageApp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using UnityEngine; 7 | using System; 8 | using HoloLensCameraStream; 9 | 10 | #if WINDOWS_UWP && XR_PLUGIN_OPENXR 11 | using Windows.Perception.Spatial; 12 | #endif 13 | 14 | /// 15 | /// This example uses the locatable camera attributes to project the camera image over the real world. 16 | /// 17 | /// **Add Define Symbols:** 18 | /// Open **File > Build Settings > Player Settings > Other Settings** and add the following to `Scripting Define Symbols` depending on the XR system used in your project; 19 | /// - Legacy built-in XR: `BUILTIN_XR`'; 20 | /// - XR Plugin Management (Windows Mixed Reality): `XR_PLUGIN_WINDOWSMR`; 21 | /// - XR Plugin Management (OpenXR):`XR_PLUGIN_OPENXR`. 22 | /// 23 | public class MatrixUsageApp : MonoBehaviour 24 | { 25 | byte[] _latestImageBytes; 26 | HoloLensCameraStream.Resolution _resolution; 27 | 28 | //"Injected" objects. 29 | GameObject _videoPanelUI; 30 | Renderer _videoPanelUIRenderer; 31 | Texture2D _videoTexture; 32 | VideoCapture _videoCapture; 33 | IndicatorDisplay _targetIndicator; 34 | 35 | IntPtr _spatialCoordinateSystemPtr; 36 | 37 | #if WINDOWS_UWP && XR_PLUGIN_OPENXR 38 | SpatialCoordinateSystem _spatialCoordinateSystem; 39 | #endif 40 | 41 | void Start() 42 | { 43 | 44 | //Fetch a pointer to Unity's spatial coordinate system if you need pixel mapping 45 | #if WINDOWS_UWP 46 | 47 | #if XR_PLUGIN_WINDOWSMR 48 | 49 | _spatialCoordinateSystemPtr = UnityEngine.XR.WindowsMR.WindowsMREnvironment.OriginSpatialCoordinateSystem; 50 | 51 | #elif XR_PLUGIN_OPENXR 52 | 53 | _spatialCoordinateSystem = Microsoft.MixedReality.OpenXR.PerceptionInterop.GetSceneCoordinateSystem(UnityEngine.Pose.identity) as SpatialCoordinateSystem; 54 | 55 | #elif BUILTIN_XR 56 | 57 | #if UNITY_2017_2_OR_NEWER 58 | _spatialCoordinateSystemPtr = UnityEngine.XR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr(); 59 | #else 60 | _spatialCoordinateSystemPtr = UnityEngine.VR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr(); 61 | #endif 62 | 63 | #endif 64 | 65 | #endif 66 | 67 | //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". 68 | CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); 69 | //You could also do this "shortcut": 70 | //CameraStreamManager.Instance.GetVideoCaptureAsync(v => videoCapture = v); 71 | 72 | _videoPanelUI = GameObject.CreatePrimitive(PrimitiveType.Quad); 73 | _videoPanelUI.transform.localScale = new Vector3(1.5f, 1.5f, 1); 74 | _videoPanelUI.name = "VideoPanelUI"; 75 | _videoPanelUIRenderer = _videoPanelUI.GetComponent() as Renderer; 76 | _videoPanelUIRenderer.material = new Material(Shader.Find("AR/HolographicImageBlend")); 77 | 78 | _targetIndicator = GameObject.FindObjectOfType(); 79 | } 80 | 81 | private void OnDestroy() 82 | { 83 | if (_videoCapture != null) 84 | { 85 | _videoCapture.FrameSampleAcquired -= OnFrameSampleAcquired; 86 | _videoCapture.Dispose(); 87 | } 88 | } 89 | 90 | void OnVideoCaptureCreated(VideoCapture videoCapture) 91 | { 92 | if (videoCapture == null) 93 | { 94 | Debug.LogError("Did not find a video capture object. You may not be using the HoloLens."); 95 | return; 96 | } 97 | 98 | this._videoCapture = videoCapture; 99 | 100 | //Request the spatial coordinate ptr if you want fetch the camera and set it if you need to 101 | #if WINDOWS_UWP 102 | 103 | #if XR_PLUGIN_OPENXR 104 | CameraStreamHelper.Instance.SetNativeISpatialCoordinateSystem(_spatialCoordinateSystem); 105 | #elif XR_PLUGIN_WINDOWSMR || BUILTIN_XR 106 | CameraStreamHelper.Instance.SetNativeISpatialCoordinateSystemPtr(_spatialCoordinateSystemPtr); 107 | #endif 108 | 109 | #endif 110 | 111 | _resolution = CameraStreamHelper.Instance.GetLowestResolution(); 112 | float frameRate = CameraStreamHelper.Instance.GetHighestFrameRate(_resolution); 113 | videoCapture.FrameSampleAcquired += OnFrameSampleAcquired; 114 | 115 | //You don't need to set all of these params. 116 | //I'm just adding them to show you that they exist. 117 | CameraParameters cameraParams = new CameraParameters(); 118 | cameraParams.cameraResolutionHeight = _resolution.height; 119 | cameraParams.cameraResolutionWidth = _resolution.width; 120 | cameraParams.frameRate = Mathf.RoundToInt(frameRate); 121 | cameraParams.pixelFormat = CapturePixelFormat.BGRA32; 122 | cameraParams.rotateImage180Degrees = false; 123 | cameraParams.enableHolograms = false; 124 | 125 | UnityEngine.WSA.Application.InvokeOnAppThread(() => { _videoTexture = new Texture2D(_resolution.width, _resolution.height, TextureFormat.BGRA32, false); }, false); 126 | 127 | videoCapture.StartVideoModeAsync(cameraParams, OnVideoModeStarted); 128 | } 129 | 130 | void OnVideoModeStarted(VideoCaptureResult result) 131 | { 132 | if (result.success == false) 133 | { 134 | Debug.LogWarning("Could not start video mode."); 135 | return; 136 | } 137 | 138 | Debug.Log("Video capture started."); 139 | } 140 | 141 | void OnFrameSampleAcquired(VideoCaptureSample sample) 142 | { 143 | //When copying the bytes out of the buffer, you must supply a byte[] that is appropriately sized. 144 | //You can reuse this byte[] until you need to resize it (for whatever reason). 145 | if (_latestImageBytes == null || _latestImageBytes.Length < sample.dataLength) 146 | { 147 | _latestImageBytes = new byte[sample.dataLength]; 148 | } 149 | sample.CopyRawImageDataIntoBuffer(_latestImageBytes); 150 | 151 | //If you need to get the cameraToWorld matrix for purposes of compositing you can do it like this 152 | float[] cameraToWorldMatrixAsFloat; 153 | if (sample.TryGetCameraToWorldMatrix(out cameraToWorldMatrixAsFloat) == false) 154 | { 155 | //return; 156 | } 157 | 158 | //If you need to get the projection matrix for purposes of compositing you can do it like this 159 | float[] projectionMatrixAsFloat; 160 | if (sample.TryGetProjectionMatrix(out projectionMatrixAsFloat) == false) 161 | { 162 | //return; 163 | } 164 | 165 | sample.Dispose(); 166 | 167 | // Right now we pass things across the pipe as a float array then convert them back into UnityEngine.Matrix using a utility method 168 | Matrix4x4 cameraToWorldMatrix = LocatableCameraUtils.ConvertFloatArrayToMatrix4x4(cameraToWorldMatrixAsFloat); 169 | Matrix4x4 projectionMatrix = LocatableCameraUtils.ConvertFloatArrayToMatrix4x4(projectionMatrixAsFloat); 170 | 171 | //This is where we actually use the image data 172 | //TODO: Create a class like VideoPanel for the next code 173 | UnityEngine.WSA.Application.InvokeOnAppThread(() => 174 | { 175 | _videoTexture.LoadRawTextureData(_latestImageBytes); 176 | _videoTexture.wrapMode = TextureWrapMode.Clamp; 177 | _videoTexture.Apply(); 178 | 179 | 180 | _videoPanelUIRenderer.sharedMaterial.SetTexture("_MainTex", _videoTexture); 181 | _videoPanelUIRenderer.sharedMaterial.SetMatrix("_WorldToCameraMatrix", cameraToWorldMatrix.inverse); 182 | _videoPanelUIRenderer.sharedMaterial.SetMatrix("_CameraProjectionMatrix", projectionMatrix); 183 | _videoPanelUIRenderer.sharedMaterial.SetInt("_FlipY", 1); 184 | _videoPanelUIRenderer.sharedMaterial.SetFloat("_VignetteScale", 0.0f); 185 | 186 | 187 | Vector3 inverseNormal = -cameraToWorldMatrix.GetColumn(2); 188 | // Position the canvas object slightly in front of the real world web camera. 189 | Vector3 imagePosition = cameraToWorldMatrix.GetColumn(3) - cameraToWorldMatrix.GetColumn(2); 190 | 191 | _videoPanelUI.gameObject.transform.position = imagePosition; 192 | _videoPanelUI.gameObject.transform.rotation = Quaternion.LookRotation(inverseNormal, cameraToWorldMatrix.GetColumn(1)); 193 | 194 | 195 | #if XR_PLUGIN_WINDOWSMR || XR_PLUGIN_OPENXR 196 | // It appears that the Legacy built-in XR environment automatically applies the Holelens Head Pose to Unity camera transforms, 197 | // but not to the new XR system (XR plugin management) environment. 198 | // Here the cameraToWorldMatrix is applied to the camera transform as an alternative to Head Pose, 199 | // so the position of the displayed video panel is significantly misaligned. If you want to apply a more accurate Head Pose, use MRTK. 200 | 201 | Camera unityCamera = Camera.main; 202 | Matrix4x4 invertZScaleMatrix = Matrix4x4.Scale(new Vector3(1, 1, -1)); 203 | Matrix4x4 localToWorldMatrix = cameraToWorldMatrix * invertZScaleMatrix; 204 | unityCamera.transform.localPosition = localToWorldMatrix.GetColumn(3); 205 | unityCamera.transform.localRotation = Quaternion.LookRotation(localToWorldMatrix.GetColumn(2), localToWorldMatrix.GetColumn(1)); 206 | #endif 207 | 208 | if (_targetIndicator != null) 209 | { 210 | _targetIndicator.SetText("cameraToWorldMatrix: \n" + cameraToWorldMatrix + "\n" + "projectionMatrix: \n" + projectionMatrix); 211 | } 212 | 213 | }, false); 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Matrix Usage Example/Scripts/MatrixUsageApp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c54b30a18143aa4e8dd9df37bd5f2cf 3 | timeCreated: 1494532890 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bbbe1996efefc740b577568c0bb039b 3 | folderAsset: yes 4 | timeCreated: 1511508796 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example/Projection Example.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &1242196584 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 1242196589} 133 | - component: {fileID: 1242196588} 134 | - component: {fileID: 1242196586} 135 | - component: {fileID: 1242196585} 136 | - component: {fileID: 1242196591} 137 | - component: {fileID: 1242196590} 138 | - component: {fileID: 1242196592} 139 | m_Layer: 0 140 | m_Name: Main Camera 141 | m_TagString: MainCamera 142 | m_Icon: {fileID: 0} 143 | m_NavMeshLayer: 0 144 | m_StaticEditorFlags: 0 145 | m_IsActive: 1 146 | --- !u!81 &1242196585 147 | AudioListener: 148 | m_ObjectHideFlags: 0 149 | m_CorrespondingSourceObject: {fileID: 0} 150 | m_PrefabInstance: {fileID: 0} 151 | m_PrefabAsset: {fileID: 0} 152 | m_GameObject: {fileID: 1242196584} 153 | m_Enabled: 1 154 | --- !u!124 &1242196586 155 | Behaviour: 156 | m_ObjectHideFlags: 0 157 | m_CorrespondingSourceObject: {fileID: 0} 158 | m_PrefabInstance: {fileID: 0} 159 | m_PrefabAsset: {fileID: 0} 160 | m_GameObject: {fileID: 1242196584} 161 | m_Enabled: 1 162 | --- !u!20 &1242196588 163 | Camera: 164 | m_ObjectHideFlags: 0 165 | m_CorrespondingSourceObject: {fileID: 0} 166 | m_PrefabInstance: {fileID: 0} 167 | m_PrefabAsset: {fileID: 0} 168 | m_GameObject: {fileID: 1242196584} 169 | m_Enabled: 1 170 | serializedVersion: 2 171 | m_ClearFlags: 2 172 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 173 | m_projectionMatrixMode: 1 174 | m_GateFitMode: 2 175 | m_FOVAxisMode: 0 176 | m_SensorSize: {x: 36, y: 24} 177 | m_LensShift: {x: 0, y: 0} 178 | m_FocalLength: 50 179 | m_NormalizedViewPortRect: 180 | serializedVersion: 2 181 | x: 0 182 | y: 0 183 | width: 1 184 | height: 1 185 | near clip plane: 0.3 186 | far clip plane: 1000 187 | field of view: 60 188 | orthographic: 0 189 | orthographic size: 5 190 | m_Depth: -1 191 | m_CullingMask: 192 | serializedVersion: 2 193 | m_Bits: 4294967295 194 | m_RenderingPath: -1 195 | m_TargetTexture: {fileID: 0} 196 | m_TargetDisplay: 0 197 | m_TargetEye: 3 198 | m_HDR: 1 199 | m_AllowMSAA: 1 200 | m_AllowDynamicResolution: 0 201 | m_ForceIntoRT: 0 202 | m_OcclusionCulling: 1 203 | m_StereoConvergence: 10 204 | m_StereoSeparation: 0.022 205 | --- !u!4 &1242196589 206 | Transform: 207 | m_ObjectHideFlags: 0 208 | m_CorrespondingSourceObject: {fileID: 0} 209 | m_PrefabInstance: {fileID: 0} 210 | m_PrefabAsset: {fileID: 0} 211 | m_GameObject: {fileID: 1242196584} 212 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 213 | m_LocalPosition: {x: 0, y: 1, z: -10} 214 | m_LocalScale: {x: 1, y: 1, z: 1} 215 | m_Children: [] 216 | m_Father: {fileID: 0} 217 | m_RootOrder: 0 218 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 219 | --- !u!114 &1242196590 220 | MonoBehaviour: 221 | m_ObjectHideFlags: 0 222 | m_CorrespondingSourceObject: {fileID: 0} 223 | m_PrefabInstance: {fileID: 0} 224 | m_PrefabAsset: {fileID: 0} 225 | m_GameObject: {fileID: 1242196584} 226 | m_Enabled: 1 227 | m_EditorHideFlags: 0 228 | m_Script: {fileID: 11500000, guid: 6341b41f972a46a428024e7bb7f598c4, type: 3} 229 | m_Name: 230 | m_EditorClassIdentifier: 231 | _topLeftMaterial: {fileID: 2100000, guid: 293884128e9832944acdb79c3b98afb7, type: 2} 232 | _topRightMaterial: {fileID: 2100000, guid: d8b25fde0c5a90e4c9a2c372f5c9b702, type: 2} 233 | _botLeftMaterial: {fileID: 2100000, guid: bd0d353f01ed2dd45b9035669f47eb9a, type: 2} 234 | _botRightMaterial: {fileID: 2100000, guid: 84d929c2f6a145a469668ace5eb159b0, type: 2} 235 | _centerMaterial: {fileID: 2100000, guid: aabac64d0de2f2148bc6ad2c45607e80, type: 2} 236 | --- !u!114 &1242196591 237 | MonoBehaviour: 238 | m_ObjectHideFlags: 0 239 | m_CorrespondingSourceObject: {fileID: 0} 240 | m_PrefabInstance: {fileID: 0} 241 | m_PrefabAsset: {fileID: 0} 242 | m_GameObject: {fileID: 1242196584} 243 | m_Enabled: 1 244 | m_EditorHideFlags: 0 245 | m_Script: {fileID: 11500000, guid: 8d7a303625e450b499551864fb15277d, type: 3} 246 | m_Name: 247 | m_EditorClassIdentifier: 248 | --- !u!114 &1242196592 249 | MonoBehaviour: 250 | m_ObjectHideFlags: 0 251 | m_CorrespondingSourceObject: {fileID: 0} 252 | m_PrefabInstance: {fileID: 0} 253 | m_PrefabAsset: {fileID: 0} 254 | m_GameObject: {fileID: 1242196584} 255 | m_Enabled: 1 256 | m_EditorHideFlags: 0 257 | m_Script: {fileID: 11500000, guid: 566f7e991ea7dcc4b93f35e12ab2c228, type: 3} 258 | m_Name: 259 | m_EditorClassIdentifier: 260 | _lineWidthMultiplier: 0.01 261 | _laserMaterial: {fileID: 2100000, guid: 84d929c2f6a145a469668ace5eb159b0, type: 2} 262 | --- !u!1 &1882314575 263 | GameObject: 264 | m_ObjectHideFlags: 0 265 | m_CorrespondingSourceObject: {fileID: 0} 266 | m_PrefabInstance: {fileID: 0} 267 | m_PrefabAsset: {fileID: 0} 268 | serializedVersion: 6 269 | m_Component: 270 | - component: {fileID: 1882314577} 271 | - component: {fileID: 1882314576} 272 | m_Layer: 0 273 | m_Name: Directional Light 274 | m_TagString: Untagged 275 | m_Icon: {fileID: 0} 276 | m_NavMeshLayer: 0 277 | m_StaticEditorFlags: 0 278 | m_IsActive: 1 279 | --- !u!108 &1882314576 280 | Light: 281 | m_ObjectHideFlags: 0 282 | m_CorrespondingSourceObject: {fileID: 0} 283 | m_PrefabInstance: {fileID: 0} 284 | m_PrefabAsset: {fileID: 0} 285 | m_GameObject: {fileID: 1882314575} 286 | m_Enabled: 1 287 | serializedVersion: 10 288 | m_Type: 1 289 | m_Shape: 0 290 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 291 | m_Intensity: 1 292 | m_Range: 10 293 | m_SpotAngle: 30 294 | m_InnerSpotAngle: 21.80208 295 | m_CookieSize: 10 296 | m_Shadows: 297 | m_Type: 2 298 | m_Resolution: -1 299 | m_CustomResolution: -1 300 | m_Strength: 1 301 | m_Bias: 0.05 302 | m_NormalBias: 0.4 303 | m_NearPlane: 0.2 304 | m_CullingMatrixOverride: 305 | e00: 1 306 | e01: 0 307 | e02: 0 308 | e03: 0 309 | e10: 0 310 | e11: 1 311 | e12: 0 312 | e13: 0 313 | e20: 0 314 | e21: 0 315 | e22: 1 316 | e23: 0 317 | e30: 0 318 | e31: 0 319 | e32: 0 320 | e33: 1 321 | m_UseCullingMatrixOverride: 0 322 | m_Cookie: {fileID: 0} 323 | m_DrawHalo: 0 324 | m_Flare: {fileID: 0} 325 | m_RenderMode: 0 326 | m_CullingMask: 327 | serializedVersion: 2 328 | m_Bits: 4294967295 329 | m_RenderingLayerMask: 1 330 | m_Lightmapping: 4 331 | m_LightShadowCasterMode: 0 332 | m_AreaSize: {x: 1, y: 1} 333 | m_BounceIntensity: 1 334 | m_ColorTemperature: 6570 335 | m_UseColorTemperature: 0 336 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 337 | m_UseBoundingSphereOverride: 0 338 | m_ShadowRadius: 0 339 | m_ShadowAngle: 0 340 | --- !u!4 &1882314577 341 | Transform: 342 | m_ObjectHideFlags: 0 343 | m_CorrespondingSourceObject: {fileID: 0} 344 | m_PrefabInstance: {fileID: 0} 345 | m_PrefabAsset: {fileID: 0} 346 | m_GameObject: {fileID: 1882314575} 347 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 348 | m_LocalPosition: {x: 0, y: 3, z: 0} 349 | m_LocalScale: {x: 1, y: 1, z: 1} 350 | m_Children: [] 351 | m_Father: {fileID: 0} 352 | m_RootOrder: 1 353 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 354 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example/Projection Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c26c9a511df0b8f4890621a3e15abdeb 3 | timeCreated: 1511509045 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7094c91dec43a434c89430b77ce9fc72 3 | folderAsset: yes 4 | timeCreated: 1511508816 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example/Scripts/ProjectionExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6341b41f972a46a428024e7bb7f598c4 3 | timeCreated: 1511508943 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example/Scripts/RaycastLaser.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using System.Collections; 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | 10 | public class RaycastLaser : MonoBehaviour 11 | { 12 | public float _lineWidthMultiplier = 0.05f; 13 | public Material _laserMaterial; 14 | 15 | /* 16 | private void Start() 17 | { 18 | shootLaserFrom(new Vector3(0, 0, 0), new Vector3(0, 0, 2), 2); 19 | } 20 | */ 21 | 22 | public void shootLaserFrom(Vector3 from, Vector3 direction, float length, Material mat = null) 23 | { 24 | LineRenderer lr = new GameObject().AddComponent(); 25 | lr.transform.parent = transform; 26 | lr.widthMultiplier = _lineWidthMultiplier; 27 | 28 | // Set Material 29 | lr.material = mat == null ? _laserMaterial : mat; 30 | 31 | Ray ray = new Ray(from, direction); 32 | Vector3 to = from + length * direction; 33 | 34 | // Use this code when hit on mesh surface 35 | //RaycastHit hit; 36 | //if(Physics.Raycast(ray, out hit, length)) 37 | // to = hit.point; 38 | 39 | lr.SetPosition(0, from); 40 | lr.SetPosition(1, to); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Projection Example/Scripts/RaycastLaser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 566f7e991ea7dcc4b93f35e12ab2c228 3 | timeCreated: 1511508946 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1e5c02fd82503a44a51156f994af743 3 | folderAsset: yes 4 | timeCreated: 1491337411 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8104a5dfe2c1bb542b6747530a16fc9e 3 | folderAsset: yes 4 | timeCreated: 1491584424 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Prefabs/Video Panel.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1071280470648684} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1012740771778586 15 | GameObject: 16 | m_ObjectHideFlags: 1 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 224967301848825758} 22 | - component: {fileID: 222757077917629236} 23 | - component: {fileID: 114483578053352408} 24 | m_Layer: 5 25 | m_Name: Image 26 | m_TagString: Untagged 27 | m_Icon: {fileID: 0} 28 | m_NavMeshLayer: 0 29 | m_StaticEditorFlags: 0 30 | m_IsActive: 1 31 | --- !u!1 &1071280470648684 32 | GameObject: 33 | m_ObjectHideFlags: 0 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | serializedVersion: 5 37 | m_Component: 38 | - component: {fileID: 4374530975894902} 39 | - component: {fileID: 114124568637479292} 40 | m_Layer: 0 41 | m_Name: Video Panel 42 | m_TagString: Untagged 43 | m_Icon: {fileID: 0} 44 | m_NavMeshLayer: 0 45 | m_StaticEditorFlags: 0 46 | m_IsActive: 1 47 | --- !u!1 &1485585293348088 48 | GameObject: 49 | m_ObjectHideFlags: 0 50 | m_PrefabParentObject: {fileID: 0} 51 | m_PrefabInternal: {fileID: 100100000} 52 | serializedVersion: 5 53 | m_Component: 54 | - component: {fileID: 224677849511713488} 55 | - component: {fileID: 223736272023099526} 56 | - component: {fileID: 114554831713185536} 57 | - component: {fileID: 114008892814245256} 58 | m_Layer: 5 59 | m_Name: Canvas 60 | m_TagString: Untagged 61 | m_Icon: {fileID: 0} 62 | m_NavMeshLayer: 0 63 | m_StaticEditorFlags: 0 64 | m_IsActive: 1 65 | --- !u!1 &1882130197037088 66 | GameObject: 67 | m_ObjectHideFlags: 0 68 | m_PrefabParentObject: {fileID: 0} 69 | m_PrefabInternal: {fileID: 100100000} 70 | serializedVersion: 5 71 | m_Component: 72 | - component: {fileID: 4727921040554332} 73 | - component: {fileID: 33499679174742730} 74 | - component: {fileID: 23698392284545974} 75 | m_Layer: 0 76 | m_Name: Quad 77 | m_TagString: Untagged 78 | m_Icon: {fileID: 0} 79 | m_NavMeshLayer: 0 80 | m_StaticEditorFlags: 0 81 | m_IsActive: 0 82 | --- !u!4 &4374530975894902 83 | Transform: 84 | m_ObjectHideFlags: 1 85 | m_PrefabParentObject: {fileID: 0} 86 | m_PrefabInternal: {fileID: 100100000} 87 | m_GameObject: {fileID: 1071280470648684} 88 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 89 | m_LocalPosition: {x: 0, y: 0, z: 1} 90 | m_LocalScale: {x: 1, y: 1, z: 1} 91 | m_Children: 92 | - {fileID: 4727921040554332} 93 | - {fileID: 224677849511713488} 94 | m_Father: {fileID: 0} 95 | m_RootOrder: 0 96 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 97 | --- !u!4 &4727921040554332 98 | Transform: 99 | m_ObjectHideFlags: 1 100 | m_PrefabParentObject: {fileID: 0} 101 | m_PrefabInternal: {fileID: 100100000} 102 | m_GameObject: {fileID: 1882130197037088} 103 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 104 | m_LocalPosition: {x: 0, y: 0, z: 0} 105 | m_LocalScale: {x: 0.44, y: 0.25, z: 1} 106 | m_Children: [] 107 | m_Father: {fileID: 4374530975894902} 108 | m_RootOrder: 0 109 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 110 | --- !u!23 &23698392284545974 111 | MeshRenderer: 112 | m_ObjectHideFlags: 1 113 | m_PrefabParentObject: {fileID: 0} 114 | m_PrefabInternal: {fileID: 100100000} 115 | m_GameObject: {fileID: 1882130197037088} 116 | m_Enabled: 1 117 | m_CastShadows: 1 118 | m_ReceiveShadows: 1 119 | m_MotionVectors: 1 120 | m_LightProbeUsage: 1 121 | m_ReflectionProbeUsage: 1 122 | m_Materials: 123 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 124 | m_StaticBatchInfo: 125 | firstSubMesh: 0 126 | subMeshCount: 0 127 | m_StaticBatchRoot: {fileID: 0} 128 | m_ProbeAnchor: {fileID: 0} 129 | m_LightProbeVolumeOverride: {fileID: 0} 130 | m_ScaleInLightmap: 1 131 | m_PreserveUVs: 1 132 | m_IgnoreNormalsForChartDetection: 0 133 | m_ImportantGI: 0 134 | m_SelectedEditorRenderState: 3 135 | m_MinimumChartSize: 4 136 | m_AutoUVMaxDistance: 0.5 137 | m_AutoUVMaxAngle: 89 138 | m_LightmapParameters: {fileID: 0} 139 | m_SortingLayerID: 0 140 | m_SortingOrder: 0 141 | --- !u!33 &33499679174742730 142 | MeshFilter: 143 | m_ObjectHideFlags: 1 144 | m_PrefabParentObject: {fileID: 0} 145 | m_PrefabInternal: {fileID: 100100000} 146 | m_GameObject: {fileID: 1882130197037088} 147 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} 148 | --- !u!114 &114008892814245256 149 | MonoBehaviour: 150 | m_ObjectHideFlags: 1 151 | m_PrefabParentObject: {fileID: 0} 152 | m_PrefabInternal: {fileID: 100100000} 153 | m_GameObject: {fileID: 1485585293348088} 154 | m_Enabled: 1 155 | m_EditorHideFlags: 0 156 | m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} 157 | m_Name: 158 | m_EditorClassIdentifier: 159 | m_IgnoreReversedGraphics: 1 160 | m_BlockingObjects: 0 161 | m_BlockingMask: 162 | serializedVersion: 2 163 | m_Bits: 4294967295 164 | --- !u!114 &114124568637479292 165 | MonoBehaviour: 166 | m_ObjectHideFlags: 1 167 | m_PrefabParentObject: {fileID: 0} 168 | m_PrefabInternal: {fileID: 100100000} 169 | m_GameObject: {fileID: 1071280470648684} 170 | m_Enabled: 1 171 | m_EditorHideFlags: 0 172 | m_Script: {fileID: 11500000, guid: 4f968af7087a0a442a35e4946520f342, type: 3} 173 | m_Name: 174 | m_EditorClassIdentifier: 175 | rawImage: {fileID: 114483578053352408} 176 | --- !u!114 &114483578053352408 177 | MonoBehaviour: 178 | m_ObjectHideFlags: 1 179 | m_PrefabParentObject: {fileID: 0} 180 | m_PrefabInternal: {fileID: 100100000} 181 | m_GameObject: {fileID: 1012740771778586} 182 | m_Enabled: 1 183 | m_EditorHideFlags: 0 184 | m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3} 185 | m_Name: 186 | m_EditorClassIdentifier: 187 | m_Material: {fileID: 0} 188 | m_Color: {r: 1, g: 1, b: 1, a: 1} 189 | m_RaycastTarget: 1 190 | m_OnCullStateChanged: 191 | m_PersistentCalls: 192 | m_Calls: [] 193 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 194 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 195 | m_Texture: {fileID: 2800000, guid: dd53a5f991d207247a86453d01d94f1a, type: 3} 196 | m_UVRect: 197 | serializedVersion: 2 198 | x: 0 199 | y: 0 200 | width: 1 201 | height: 1 202 | --- !u!114 &114554831713185536 203 | MonoBehaviour: 204 | m_ObjectHideFlags: 1 205 | m_PrefabParentObject: {fileID: 0} 206 | m_PrefabInternal: {fileID: 100100000} 207 | m_GameObject: {fileID: 1485585293348088} 208 | m_Enabled: 1 209 | m_EditorHideFlags: 0 210 | m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} 211 | m_Name: 212 | m_EditorClassIdentifier: 213 | m_UiScaleMode: 0 214 | m_ReferencePixelsPerUnit: 100 215 | m_ScaleFactor: 1 216 | m_ReferenceResolution: {x: 800, y: 600} 217 | m_ScreenMatchMode: 0 218 | m_MatchWidthOrHeight: 0 219 | m_PhysicalUnit: 3 220 | m_FallbackScreenDPI: 96 221 | m_DefaultSpriteDPI: 96 222 | m_DynamicPixelsPerUnit: 4 223 | --- !u!222 &222757077917629236 224 | CanvasRenderer: 225 | m_ObjectHideFlags: 1 226 | m_PrefabParentObject: {fileID: 0} 227 | m_PrefabInternal: {fileID: 100100000} 228 | m_GameObject: {fileID: 1012740771778586} 229 | --- !u!223 &223736272023099526 230 | Canvas: 231 | m_ObjectHideFlags: 1 232 | m_PrefabParentObject: {fileID: 0} 233 | m_PrefabInternal: {fileID: 100100000} 234 | m_GameObject: {fileID: 1485585293348088} 235 | m_Enabled: 1 236 | serializedVersion: 2 237 | m_RenderMode: 2 238 | m_Camera: {fileID: 0} 239 | m_PlaneDistance: 100 240 | m_PixelPerfect: 0 241 | m_ReceivesEvents: 1 242 | m_OverrideSorting: 0 243 | m_OverridePixelPerfect: 0 244 | m_SortingBucketNormalizedSize: 0 245 | m_SortingLayerID: 0 246 | m_SortingOrder: 0 247 | m_TargetDisplay: 0 248 | --- !u!224 &224677849511713488 249 | RectTransform: 250 | m_ObjectHideFlags: 1 251 | m_PrefabParentObject: {fileID: 0} 252 | m_PrefabInternal: {fileID: 100100000} 253 | m_GameObject: {fileID: 1485585293348088} 254 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 255 | m_LocalPosition: {x: 0, y: 0, z: 0} 256 | m_LocalScale: {x: 0.44, y: 0.25, z: 1} 257 | m_Children: 258 | - {fileID: 224967301848825758} 259 | m_Father: {fileID: 4374530975894902} 260 | m_RootOrder: 1 261 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 262 | m_AnchorMin: {x: 0, y: 0} 263 | m_AnchorMax: {x: 0, y: 0} 264 | m_AnchoredPosition: {x: 0, y: 0} 265 | m_SizeDelta: {x: 1, y: 1} 266 | m_Pivot: {x: 0.5, y: 0.5} 267 | --- !u!224 &224967301848825758 268 | RectTransform: 269 | m_ObjectHideFlags: 1 270 | m_PrefabParentObject: {fileID: 0} 271 | m_PrefabInternal: {fileID: 100100000} 272 | m_GameObject: {fileID: 1012740771778586} 273 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 274 | m_LocalPosition: {x: 0, y: 0, z: 0} 275 | m_LocalScale: {x: 1, y: 1, z: 1} 276 | m_Children: [] 277 | m_Father: {fileID: 224677849511713488} 278 | m_RootOrder: 0 279 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 280 | m_AnchorMin: {x: 0.5, y: 0.5} 281 | m_AnchorMax: {x: 0.5, y: 0.5} 282 | m_AnchoredPosition: {x: 0, y: 0} 283 | m_SizeDelta: {x: 1, y: 1} 284 | m_Pivot: {x: 0.5, y: 0.5} 285 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Prefabs/Video Panel.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16ad2d038c8801b48bf26b80d6b2abb3 3 | timeCreated: 1491584428 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5887e4762c153624585cf6f2616965a9 3 | folderAsset: yes 4 | timeCreated: 1491337452 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Scripts/VideoPanel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | 9 | public class VideoPanel : MonoBehaviour 10 | { 11 | public MeshRenderer meshRenderer; 12 | 13 | public void SetResolution(int width, int height) 14 | { 15 | transform.localScale = new Vector3(0.4f, 0.4f * height / width); 16 | 17 | var texture = new Texture2D(width, height, TextureFormat.BGRA32, false); 18 | meshRenderer.sharedMaterial.mainTexture = texture; 19 | } 20 | 21 | public void SetBytes(byte[] image) 22 | { 23 | var texture = meshRenderer.sharedMaterial.mainTexture as Texture2D; 24 | texture.LoadRawTextureData(image); //TODO: Should be able to do this: texture.LoadRawTextureData(pointerToImage, 1280 * 720 * 4); 25 | texture.Apply(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Scripts/VideoPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f968af7087a0a442a35e4946520f342 3 | timeCreated: 1491524755 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Scripts/VideoPanelApp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using UnityEngine; 7 | using System; 8 | using HoloLensCameraStream; 9 | using System.Collections.Generic; 10 | 11 | #if WINDOWS_UWP && XR_PLUGIN_OPENXR 12 | using Windows.Perception.Spatial; 13 | #endif 14 | 15 | /// 16 | /// This example gets the video frames at 30 fps and displays them on a Unity texture, 17 | /// and displayed the debug information in front. 18 | /// 19 | /// **Add Define Symbols:** 20 | /// Open **File > Build Settings > Player Settings > Other Settings** and add the following to `Scripting Define Symbols` depending on the XR system used in your project; 21 | /// - Legacy built-in XR: `BUILTIN_XR`'; 22 | /// - XR Plugin Management (Windows Mixed Reality): `XR_PLUGIN_WINDOWSMR`; 23 | /// - XR Plugin Management (OpenXR):`XR_PLUGIN_OPENXR`. 24 | /// 25 | public class VideoPanelApp : MonoBehaviour 26 | { 27 | byte[] _latestImageBytes; 28 | HoloLensCameraStream.Resolution _resolution; 29 | 30 | //"Injected" objects. 31 | VideoPanel _videoPanelUI; 32 | VideoCapture _videoCapture; 33 | public TextMesh _displayText; 34 | 35 | IntPtr _spatialCoordinateSystemPtr; 36 | 37 | #if WINDOWS_UWP && XR_PLUGIN_OPENXR 38 | SpatialCoordinateSystem _spatialCoordinateSystem; 39 | #endif 40 | 41 | Queue _mainThreadActions; 42 | 43 | void Start() 44 | { 45 | _mainThreadActions = new Queue(); 46 | 47 | //Fetch a pointer to Unity's spatial coordinate system if you need pixel mapping 48 | #if WINDOWS_UWP 49 | 50 | #if XR_PLUGIN_WINDOWSMR 51 | 52 | _spatialCoordinateSystemPtr = UnityEngine.XR.WindowsMR.WindowsMREnvironment.OriginSpatialCoordinateSystem; 53 | 54 | #elif XR_PLUGIN_OPENXR 55 | 56 | _spatialCoordinateSystem = Microsoft.MixedReality.OpenXR.PerceptionInterop.GetSceneCoordinateSystem(UnityEngine.Pose.identity) as SpatialCoordinateSystem; 57 | 58 | #elif BUILTIN_XR 59 | 60 | #if UNITY_2017_2_OR_NEWER 61 | _spatialCoordinateSystemPtr = UnityEngine.XR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr(); 62 | #else 63 | _spatialCoordinateSystemPtr = UnityEngine.VR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr(); 64 | #endif 65 | 66 | #endif 67 | 68 | #endif 69 | 70 | //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". 71 | CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); 72 | //You could also do this "shortcut": 73 | //CameraStreamManager.Instance.GetVideoCaptureAsync(v => videoCapture = v); 74 | 75 | _videoPanelUI = GameObject.FindObjectOfType(); 76 | _videoPanelUI.meshRenderer.transform.localScale = new Vector3(1, -1, 1); 77 | } 78 | 79 | private void Update() 80 | { 81 | lock (_mainThreadActions) 82 | { 83 | while (_mainThreadActions.Count > 0) 84 | { 85 | _mainThreadActions.Dequeue().Invoke(); 86 | } 87 | } 88 | } 89 | 90 | private void Enqueue(Action action) 91 | { 92 | lock (_mainThreadActions) 93 | { 94 | _mainThreadActions.Enqueue(action); 95 | } 96 | } 97 | 98 | private void OnDestroy() 99 | { 100 | if (_videoCapture != null) 101 | { 102 | _videoCapture.FrameSampleAcquired -= OnFrameSampleAcquired; 103 | _videoCapture.Dispose(); 104 | } 105 | } 106 | 107 | void OnVideoCaptureCreated(VideoCapture videoCapture) 108 | { 109 | if (videoCapture == null) 110 | { 111 | Debug.LogError("Did not find a video capture object. You may not be using the HoloLens."); 112 | Enqueue(() => SetText("Did not find a video capture object. You may not be using the HoloLens.")); 113 | return; 114 | } 115 | 116 | this._videoCapture = videoCapture; 117 | 118 | //Request the spatial coordinate ptr if you want fetch the camera and set it if you need to 119 | #if WINDOWS_UWP 120 | 121 | #if XR_PLUGIN_OPENXR 122 | CameraStreamHelper.Instance.SetNativeISpatialCoordinateSystem(_spatialCoordinateSystem); 123 | #elif XR_PLUGIN_WINDOWSMR || BUILTIN_XR 124 | CameraStreamHelper.Instance.SetNativeISpatialCoordinateSystemPtr(_spatialCoordinateSystemPtr); 125 | #endif 126 | 127 | #endif 128 | 129 | _resolution = CameraStreamHelper.Instance.GetLowestResolution(); 130 | float frameRate = CameraStreamHelper.Instance.GetHighestFrameRate(_resolution); 131 | videoCapture.FrameSampleAcquired += OnFrameSampleAcquired; 132 | 133 | //You don't need to set all of these params. 134 | //I'm just adding them to show you that they exist. 135 | CameraParameters cameraParams = new CameraParameters(); 136 | cameraParams.cameraResolutionHeight = _resolution.height; 137 | cameraParams.cameraResolutionWidth = _resolution.width; 138 | cameraParams.frameRate = Mathf.RoundToInt(frameRate); 139 | cameraParams.pixelFormat = CapturePixelFormat.BGRA32; 140 | cameraParams.rotateImage180Degrees = false; 141 | cameraParams.enableHolograms = false; 142 | 143 | Debug.Log("Configuring camera: " + _resolution.width + "x" + _resolution.height + "x" + cameraParams.frameRate + " | " + cameraParams.pixelFormat); 144 | Enqueue(() => SetText("Configuring camera: " + _resolution.width + "x" + _resolution.height + "x" + cameraParams.frameRate + " | " + cameraParams.pixelFormat)); 145 | 146 | Enqueue(() => _videoPanelUI.SetResolution(_resolution.width, _resolution.height)); 147 | videoCapture.StartVideoModeAsync(cameraParams, OnVideoModeStarted); 148 | } 149 | 150 | void OnVideoModeStarted(VideoCaptureResult result) 151 | { 152 | if (result.success == false) 153 | { 154 | Debug.LogWarning("Could not start video mode."); 155 | Enqueue(() => SetText("Could not start video mode.")); 156 | return; 157 | } 158 | 159 | Debug.Log("Video capture started."); 160 | Enqueue(() => SetText("Video capture started.")); 161 | } 162 | 163 | void OnFrameSampleAcquired(VideoCaptureSample sample) 164 | { 165 | lock (_mainThreadActions) 166 | { 167 | if (_mainThreadActions.Count > 2) 168 | { 169 | sample.Dispose(); 170 | return; 171 | } 172 | } 173 | 174 | //When copying the bytes out of the buffer, you must supply a byte[] that is appropriately sized. 175 | //You can reuse this byte[] until you need to resize it (for whatever reason). 176 | if (_latestImageBytes == null || _latestImageBytes.Length < sample.dataLength) 177 | { 178 | _latestImageBytes = new byte[sample.dataLength]; 179 | } 180 | sample.CopyRawImageDataIntoBuffer(_latestImageBytes); 181 | 182 | 183 | //If you need to get the cameraToWorld matrix for purposes of compositing you can do it like this 184 | float[] cameraToWorldMatrixAsFloat; 185 | if (sample.TryGetCameraToWorldMatrix(out cameraToWorldMatrixAsFloat) == false) 186 | { 187 | //return; 188 | } 189 | 190 | //If you need to get the projection matrix for purposes of compositing you can do it like this 191 | float[] projectionMatrixAsFloat; 192 | if (sample.TryGetProjectionMatrix(out projectionMatrixAsFloat) == false) 193 | { 194 | //return; 195 | } 196 | 197 | // Right now we pass things across the pipe as a float array then convert them back into UnityEngine.Matrix using a utility method 198 | Matrix4x4 cameraToWorldMatrix = LocatableCameraUtils.ConvertFloatArrayToMatrix4x4(cameraToWorldMatrixAsFloat); 199 | Matrix4x4 projectionMatrix = LocatableCameraUtils.ConvertFloatArrayToMatrix4x4(projectionMatrixAsFloat); 200 | 201 | Enqueue(() => 202 | { 203 | _videoPanelUI.SetBytes(_latestImageBytes); 204 | 205 | #if XR_PLUGIN_WINDOWSMR || XR_PLUGIN_OPENXR 206 | // It appears that the Legacy built-in XR environment automatically applies the Holelens Head Pose to Unity camera transforms, 207 | // but not to the new XR system (XR plugin management) environment. 208 | // Here the cameraToWorldMatrix is applied to the camera transform as an alternative to Head Pose, 209 | // so the position of the displayed video panel is significantly misaligned. If you want to apply a more accurate Head Pose, use MRTK. 210 | 211 | Camera unityCamera = Camera.main; 212 | Matrix4x4 invertZScaleMatrix = Matrix4x4.Scale(new Vector3(1, 1, -1)); 213 | Matrix4x4 localToWorldMatrix = cameraToWorldMatrix * invertZScaleMatrix; 214 | unityCamera.transform.localPosition = localToWorldMatrix.GetColumn(3); 215 | unityCamera.transform.localRotation = Quaternion.LookRotation(localToWorldMatrix.GetColumn(2), localToWorldMatrix.GetColumn(1)); 216 | #endif 217 | 218 | Debug.Log("Got frame: " + sample.FrameWidth + "x" + sample.FrameHeight + " | " + sample.pixelFormat + " | " + sample.dataLength); 219 | if (_displayText != null) 220 | { 221 | _displayText.text = "Got frame: " + sample.FrameWidth + "x" + sample.FrameHeight + " | " + sample.pixelFormat + " | " + sample.dataLength; 222 | } 223 | }); 224 | 225 | sample.Dispose(); 226 | } 227 | 228 | private void SetText(string text) 229 | { 230 | if (_displayText != null) 231 | { 232 | _displayText.text += text + "\n"; 233 | } 234 | } 235 | } -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Scripts/VideoPanelApp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9612561be963c9e41a8452cdb97dd03a 3 | timeCreated: 1490740471 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Examples/Video Panel Example/Video Panel Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e913caf645897db42bbdacb4893c11d6 3 | timeCreated: 1490739693 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3a70a4205ca28e4cbfade8d06688804 3 | folderAsset: yes 4 | timeCreated: 1490740220 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Plugins/HoloLensCameraStream.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/HoloLensCameraStream/1b7b357538644b5c7d38e55b61af8831fef7412e/HoloLensVideoCaptureExample/Assets/CamStream/Plugins/HoloLensCameraStream.dll -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Plugins/HoloLensCameraStream.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d2e4eb7345909349aac59f7914e3124 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Linux 16 | second: 17 | enabled: 0 18 | settings: 19 | CPU: x86 20 | - first: 21 | : LinuxUniversal 22 | second: 23 | enabled: 0 24 | settings: 25 | CPU: None 26 | - first: 27 | : OSXIntel 28 | second: 29 | enabled: 0 30 | settings: 31 | CPU: AnyCPU 32 | - first: 33 | : OSXIntel64 34 | second: 35 | enabled: 0 36 | settings: 37 | CPU: AnyCPU 38 | - first: 39 | Any: 40 | second: 41 | enabled: 0 42 | settings: 43 | Exclude Editor: 0 44 | Exclude Linux: 1 45 | Exclude Linux64: 1 46 | Exclude LinuxUniversal: 1 47 | Exclude OSXIntel: 1 48 | Exclude OSXIntel64: 1 49 | Exclude OSXUniversal: 1 50 | Exclude Win: 1 51 | Exclude Win64: 1 52 | Exclude WindowsStoreApps: 1 53 | - first: 54 | Editor: Editor 55 | second: 56 | enabled: 1 57 | settings: 58 | CPU: AnyCPU 59 | DefaultValueInitialized: true 60 | OS: AnyOS 61 | - first: 62 | Standalone: Linux64 63 | second: 64 | enabled: 0 65 | settings: 66 | CPU: AnyCPU 67 | - first: 68 | Standalone: OSXUniversal 69 | second: 70 | enabled: 0 71 | settings: 72 | CPU: None 73 | - first: 74 | Standalone: Win 75 | second: 76 | enabled: 0 77 | settings: 78 | CPU: AnyCPU 79 | - first: 80 | Standalone: Win64 81 | second: 82 | enabled: 0 83 | settings: 84 | CPU: AnyCPU 85 | - first: 86 | Windows Store Apps: WindowsStoreApps 87 | second: 88 | enabled: 0 89 | settings: 90 | CPU: AnyCPU 91 | DontProcess: False 92 | PlaceholderPath: 93 | SDK: AnySDK 94 | ScriptingBackend: AnyScriptingBackend 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Plugins/WSA.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74493d538956d694887278e7636910a1 3 | folderAsset: yes 4 | timeCreated: 1490740226 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Plugins/WSA/HoloLensCameraStream.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/HoloLensCameraStream/1b7b357538644b5c7d38e55b61af8831fef7412e/HoloLensVideoCaptureExample/Assets/CamStream/Plugins/WSA/HoloLensCameraStream.dll -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Plugins/WSA/HoloLensCameraStream.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b89ba6fc9bc2ee646b68305f8e19cc9f 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 1 20 | Exclude Editor: 1 21 | Exclude Linux: 1 22 | Exclude Linux64: 1 23 | Exclude LinuxUniversal: 1 24 | Exclude OSXIntel: 1 25 | Exclude OSXIntel64: 1 26 | Exclude OSXUniversal: 1 27 | Exclude Win: 1 28 | Exclude Win64: 1 29 | Exclude WindowsStoreApps: 0 30 | - first: 31 | : Editor 32 | second: 33 | enabled: 0 34 | settings: 35 | CPU: AnyCPU 36 | OS: AnyOS 37 | - first: 38 | Android: Android 39 | second: 40 | enabled: 0 41 | settings: 42 | CPU: ARMv7 43 | - first: 44 | Any: 45 | second: 46 | enabled: 0 47 | settings: 48 | Exclude Editor: 1 49 | Exclude Linux: 1 50 | Exclude Linux64: 1 51 | Exclude LinuxUniversal: 1 52 | Exclude OSXIntel: 1 53 | Exclude OSXIntel64: 1 54 | Exclude OSXUniversal: 1 55 | Exclude Win: 1 56 | Exclude Win64: 1 57 | Exclude WindowsStoreApps: 0 58 | - first: 59 | Editor: Editor 60 | second: 61 | enabled: 0 62 | settings: 63 | CPU: AnyCPU 64 | DefaultValueInitialized: true 65 | OS: AnyOS 66 | - first: 67 | Facebook: Win 68 | second: 69 | enabled: 0 70 | settings: 71 | CPU: AnyCPU 72 | - first: 73 | Facebook: Win64 74 | second: 75 | enabled: 0 76 | settings: 77 | CPU: AnyCPU 78 | - first: 79 | Standalone: Linux 80 | second: 81 | enabled: 0 82 | settings: 83 | CPU: x86 84 | - first: 85 | Standalone: Linux64 86 | second: 87 | enabled: 0 88 | settings: 89 | CPU: AnyCPU 90 | - first: 91 | Standalone: LinuxUniversal 92 | second: 93 | enabled: 0 94 | settings: 95 | CPU: None 96 | - first: 97 | Standalone: OSXIntel 98 | second: 99 | enabled: 0 100 | settings: 101 | CPU: AnyCPU 102 | - first: 103 | Standalone: OSXIntel64 104 | second: 105 | enabled: 0 106 | settings: 107 | CPU: AnyCPU 108 | - first: 109 | Standalone: OSXUniversal 110 | second: 111 | enabled: 0 112 | settings: 113 | CPU: None 114 | - first: 115 | Standalone: Win 116 | second: 117 | enabled: 0 118 | settings: 119 | CPU: AnyCPU 120 | - first: 121 | Standalone: Win64 122 | second: 123 | enabled: 0 124 | settings: 125 | CPU: AnyCPU 126 | - first: 127 | Windows Store Apps: WindowsStoreApps 128 | second: 129 | enabled: 1 130 | settings: 131 | CPU: AnyCPU 132 | DontProcess: true 133 | PlaceholderPath: Assets/CamStream/Plugins/HoloLensCameraStream.dll 134 | SDK: UWP 135 | ScriptingBackend: AnyScriptingBackend 136 | userData: 137 | assetBundleName: 138 | assetBundleVariant: 139 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70a9fe1ccdc03934db695023fc94574c 3 | folderAsset: yes 4 | timeCreated: 1491329881 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Prefabs/Camera Stream.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1039087494832438} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1039087494832438 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4360600529851436} 22 | - component: {fileID: 114958086835192222} 23 | m_Layer: 0 24 | m_Name: Camera Stream 25 | m_TagString: Untagged 26 | m_Icon: {fileID: 0} 27 | m_NavMeshLayer: 0 28 | m_StaticEditorFlags: 0 29 | m_IsActive: 1 30 | --- !u!4 &4360600529851436 31 | Transform: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 1039087494832438} 36 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 37 | m_LocalPosition: {x: 0, y: 0, z: 0} 38 | m_LocalScale: {x: 1, y: 1, z: 1} 39 | m_Children: [] 40 | m_Father: {fileID: 0} 41 | m_RootOrder: 0 42 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 43 | --- !u!114 &114958086835192222 44 | MonoBehaviour: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 1039087494832438} 49 | m_Enabled: 1 50 | m_EditorHideFlags: 0 51 | m_Script: {fileID: 11500000, guid: 8d7a303625e450b499551864fb15277d, type: 3} 52 | m_Name: 53 | m_EditorClassIdentifier: 54 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Prefabs/Camera Stream.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4759f82451deb2749873e98fdd9945c7 3 | timeCreated: 1491336715 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/README.txt: -------------------------------------------------------------------------------- 1 | The most up-to-date documentation is available on GitHub: https://github.com/VulcanTechnologies/HoloLensCameraStream 2 | 3 | # HoloLensCameraStream for Unity 4 | This Unity plugin makes the HoloLens video camera frames available to a Unity app in real time. This enables Unity devs to easily use the HoloLens camera for computer vision (or anything they want). 5 | 6 | Use this if you need access to the HoloLens camera's frame buffer in Unity, including the [locatable camera attributes](https://developer.microsoft.com/en-us/windows/mixed-reality/locatable_camera). 7 | 8 | ## With this plugin, you can 9 | * Do computer vision and machine learning on the frames in real time. (algorithms not included) 10 | * Show a preview of what the HoloLens camera sees. 11 | * Obtain a 3D coordinate given an image pixel coordinate from the HoloLens video camera. For instance, you could identify a book using computer vision, then render something on top of that book. 12 | 13 | ## Getting Started 14 | The tutorials below will show you how to **build the plugin (DLL)** or run the **Unity sample app**. 15 | 16 | ### What's in this repository 17 | There are two separate "solutions" (if you will) in this repository: 18 | * **The Plugin (HoloLensCameraStream/)** - This is a Video Studio solution that builds the Unity Plugin, which is just a DLL (library file). You can drop this DLL into a Unity project (in the appropriate directory) and then use its public methods, properties, and events from Unity. 19 | * **The Unity example project (HoloLensVideoCaptureExample)/** - This shows you how to use the HoloLensCameraStream plugin in a Unity project. You can build it and run it on the HoloLens, or copy it and use it as a starter template for your own project. 20 | 21 | ### Things you need 22 | * [The HoloLens development tools](https://developer.microsoft.com/en-us/windows/mixed-reality/install_the_tools), sans Vuforia and the Emulator. 23 | 24 | ### Building the Plugin 25 | The plugin solution has two projects. One is the actual library project, and the other is a "dummy" or "placeholder" project that is used to keep the Unity editor from complaining ([more info here](https://docs.unity3d.com/Manual/windowsstore-plugins.html)). The placeholder project doesn't do anything, it just mimics the plugin's public API. To build the solution (including both projects), follow the steps below: 26 | 1. **Clone this repository.** 27 | 2. **Open the HoloLensCameraStream solution in Visual Studio.** It lives in `HoloLensCameraStream/HoloLensCameraStream/HoloLensCameraStream.sln`. 28 | 3. **Build the solution** In the VS menu, select **Build > Build Solution**. *Note: Make sure Visual Studio is set up to download missing NuGet packages, or you will get a spew of errors about missing namespaces.* 29 | 4. That's all! This will produce two DLLs, one is the real DLL, and the other is the "placeholder" described above. 30 | 31 | ### Integrating the plugin into a Unity project 32 | If you made some changes to the plugin project, and you want to use your newly-built DLLs, follow these steps. If you haven't made changes to the plugin, but just want to learn how to *use the CameraStream plugin in Unity*, skip this part and read instead about running the example project. 33 | 1. **Find the DLLs you just build:** Look in the output window after you build the plugin solution. You will see two paths to the newly-build DLLs. Navigate to them. 34 | 2. **Paste the plugin DLL into Unity:** Copy the plugin DLL from the output directory and paste it into the your Unity app. It must be pasted into the `Assets/Plugins/WSA/` directory in your Unity project because it will only compile for WSA devices. 35 | 3. **Paste the placeholder DLL into Unity:** Copy the placeholder (dummy) DLL from its output directory and paste it into your Unity app. It must be in the `Assets/Plugins/` directory in your Unity project. This is the DLL that the Unity editor compiles against uses while you're coding in Unity. 36 | 4. **Edit the plugin's settings:** In the Unity editor, select the ``HoloLensCameraStream.dll plugin file that you pasted in step 2. In the inspector, uncheck all platforms except `WSAPlayer`. Set the SDK to `UWP`, and set the Scripting Backend to `Any Scripting Backend`. In the Placeholder dropdown, select the `HoloLensCameraStream.dll` option (it will likely be the only option). 37 | 5. **Click Apply.** 38 | 6. **Edit the placeholder plugin's settings:** Select the placeholder (dummy) plugin in `Assets/Plugins/HoloLensCameraStream.dll`. Uncheck all platforms except `Editor`. 39 | 7. **Click Apply.** 40 | 41 | You should now be able to code against the HoloLensCameraStream plugin after importing said namespace in your Unity scripts. *Note: Your Unity project needs to be [appropriately configured for HoloLens development](https://developer.microsoft.com/en-us/windows/mixed-reality/holograms_100).* 42 | 43 | ### Running the example Unity project 44 | The example Unity project can be found in the root `HoloLensVideoCaptureExample/` directory. This Unity project is a great way to learn how to use the CameraStream plugin in Unity, or to use as a template for your own Unity project. Read on to learn how to build and run the example project on your HoloLens. You should be familiar with creating and configuring a new Unity-HoloLens project [according to Microsoft's instructions](https://developer.microsoft.com/en-us/windows/mixed-reality/holograms_100). As Microsoft and Unity update their HoloLens documentation, I'm sure this tutorial will become out of date. 45 | 1. **Open the example project:** Navigate to and open the example project directory (`HoloLensVideoCaptureExample/`) in Unity. 46 | 2. **Configure build settings:** Once the project opens, select **File > Build Settings**. In the Platform list, select `Windows Store`. Set the SDK to `Universal 10`; set Target device to `HoloLens`; set UWP Build Type to `D3D`; check the Unity C# Projects checkbox; and finally, click **Switch Platform**. 47 | 3. **Add Define Symbols:** Open **File > Build Settings > Player Settings > Other Settings** and add the following to `Scripting Define Symbols` depending on the XR system used in your project; Legacy built-in XR: `BUILTIN_XR`'; XR Plugin Management (Windows Mixed Reality): `XR_PLUGIN_WINDOWSMR`; XR Plugin Management (OpenXR):`XR_PLUGIN_OPENXR`. 48 | 4. **Build the project:** You can now build the Unity project, which generates a Visual Studio Solution (which you will then have to also build). With the Build Settings window still open, click **Build**. In the explorer window that appears, make a new folder called `App`, which should live as a sibling next to the 'Assets` folder. Then click Select Folder to generate the VS solution in that folder. Then wait for Unity to build the solution. 49 | 5. **Open the VS Solution:** When the solution is built, a Windows explorer folder will open. Open the newly-built VS solution, which lives in `App/HoloLensVideoCaptureExample.sln`. This is the solution that ultimately gets deployed to your HoloLens. 50 | 6. **Configure the deploy settings:** In the Visual Studio toolbar, change the solution platform from `ARM` to `x86` if you are building for Hololens1 or to `ARM64` if you are building for Hololens2; Change the deploy target (the green play button) to `Device` (if your HoloLens is plugged into your computer), or `Remote Machine` (if your HoloLens is connected via WiFi). 51 | 7. **Run the app:** Go to **Debug > Start Debugging**. Once the app is deployed to the HoloLens, you should see some confirmation output in the Output window. 52 | 53 | If you have questions, [check out the FAQ](https://github.com/VulcanTechnologies/HoloLensCameraStream/wiki/FAQ). 54 | 55 | ## Contributing 56 | We would love for you to contribute to this project. Take a look at the TODO list in the Plugin's solution, or look at the Issues tab on GitHub to see how you can contribute. Thanks, enjoy! 57 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/README.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4efc784b1fb90864cbdc017dcf54440f 3 | timeCreated: 1493240588 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa29d88061adcf340b8f3379cad633cd 3 | folderAsset: yes 4 | timeCreated: 1497006571 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d67f0856d9267584b87891ca12a30aee 3 | folderAsset: yes 4 | timeCreated: 1511509117 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Blue.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Blue 10 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.011764706, g: 0.6627451, b: 0.95686275, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Blue.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 293884128e9832944acdb79c3b98afb7 3 | timeCreated: 1511447638 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Green.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Green 10 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.8039216, g: 0.8627451, b: 0.22352941, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Green.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8b25fde0c5a90e4c9a2c372f5c9b702 3 | timeCreated: 1511447638 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Orange.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Orange 10 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.59607846, b: 0, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Orange.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd0d353f01ed2dd45b9035669f47eb9a 3 | timeCreated: 1511447638 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Pink.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Pink 10 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.9137255, g: 0.11764706, b: 0.3882353, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Pink.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aabac64d0de2f2148bc6ad2c45607e80 3 | timeCreated: 1511447803 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Red.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Red 10 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.27931035, b: 0.27931035, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/Red.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84d929c2f6a145a469668ace5eb159b0 3 | timeCreated: 1511348764 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/VideoPanel.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: VideoPanel 11 | m_Shader: {fileID: 4800000, guid: 31835514b8863184783d3d14e978aa95, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Materials/VideoPanel.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d48e094a325008c4884c9be8cd01ec9d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fef9b0670823af409b41691caf82449 3 | folderAsset: yes 4 | timeCreated: 1497006577 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/HolographicImageBlend.shader: -------------------------------------------------------------------------------- 1 | Shader "AR/HolographicImageBlend" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | [Toggle] _FlipY("Flip Y", Int) = 0 7 | _VignetteScale ("Vignette Scale", RANGE(0,2)) = 0 8 | } 9 | SubShader 10 | { 11 | Tags { "RenderType"="Opaque" } 12 | LOD 100 13 | 14 | Pass 15 | { 16 | CGPROGRAM 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata 23 | { 24 | float4 vertex : POSITION; 25 | 26 | UNITY_VERTEX_INPUT_INSTANCE_ID 27 | }; 28 | 29 | struct v2f 30 | { 31 | float4 vertexPositionInProjectionSpace : SV_POSITION; 32 | float2 uv : TEXCOORD0; 33 | float4 vertexInProjectionSpace : TEXCOORD1; 34 | 35 | UNITY_VERTEX_OUTPUT_STEREO 36 | }; 37 | 38 | sampler2D _MainTex; 39 | float4x4 _WorldToCameraMatrix; 40 | float4x4 _CameraProjectionMatrix; 41 | int _FlipY; 42 | float _VignetteScale; 43 | 44 | v2f vert (appdata v) 45 | { 46 | v2f o; 47 | 48 | UNITY_SETUP_INSTANCE_ID(v); 49 | UNITY_INITIALIZE_OUTPUT(v2f, o); 50 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 51 | 52 | o.vertexPositionInProjectionSpace = UnityObjectToClipPos(v.vertex); 53 | 54 | // Calculate the vertex position in world space. 55 | float4 vertexPositionInWorldSpace = mul(unity_ObjectToWorld, float4(v.vertex.xyz,1)); 56 | // Now take the world space vertex position and transform it so that 57 | // it is relative to the physical web camera on the HoloLens. 58 | float4 vertexPositionInCameraSpace = mul(_WorldToCameraMatrix, float4(vertexPositionInWorldSpace.xyz,1)); 59 | 60 | // Convert our camera relative vertex into clip space. 61 | o.vertexInProjectionSpace = mul(_CameraProjectionMatrix, float4(vertexPositionInCameraSpace.xyz, 1.0)); 62 | 63 | return o; 64 | } 65 | 66 | fixed4 frag (v2f i) : SV_Target 67 | { 68 | // Transform the vertex into normalized coordinate space. Basically 69 | // we want to map where our vertex should be on the screen into the -1 to 1 range 70 | // for both the x and y axes. 71 | float2 signedUV = i.vertexInProjectionSpace.xy / i.vertexInProjectionSpace.w; 72 | 73 | // The HoloLens uses an additive display so the color black will 74 | // be transparent. If the texture is smaller than the canvas, color the extra 75 | // area on the canvas black so it will be transparent on the HoloLens. 76 | if(abs(signedUV.x) > 1.0 || abs(signedUV.y) > 1.0) 77 | { 78 | return fixed4( 0.0, 0.0, 0.0, 0.0); 79 | } 80 | 81 | // Currently our signedUV's x and y coordinates will fall between -1 and 1. 82 | // We need to map this range from 0 to 1 so that we can sample our texture. 83 | float2 uv = signedUV * 0.5 + float2(0.5, 0.5); 84 | 85 | // Inverts the Y axis of the texture's UV. 86 | if (_FlipY > 0) uv.y = 1.0 - uv.y; 87 | 88 | fixed4 finalColor = tex2D(_MainTex, uv); 89 | 90 | // Finally add a circular vignette effect starting from the center 91 | // of the image. 92 | finalColor *= 1.0-(length(signedUV) * _VignetteScale); 93 | 94 | return finalColor; 95 | } 96 | ENDCG 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/HolographicImageBlend.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43f836abaddc1dd48b0418bf673d301f 3 | timeCreated: 1497006639 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/HolographicImageBlendGrayscale.shader: -------------------------------------------------------------------------------- 1 | Shader "AR/HolographicImageBlendGrayscale" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | [Toggle] _FlipY("Flip Y", Int) = 0 7 | _VignetteScale ("Vignette Scale", RANGE(0,2)) = 0 8 | } 9 | SubShader 10 | { 11 | Tags { "RenderType"="Opaque" } 12 | LOD 100 13 | 14 | Pass 15 | { 16 | CGPROGRAM 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata 23 | { 24 | float4 vertex : POSITION; 25 | 26 | UNITY_VERTEX_INPUT_INSTANCE_ID 27 | }; 28 | 29 | struct v2f 30 | { 31 | float4 vertexPositionInProjectionSpace : SV_POSITION; 32 | float2 uv : TEXCOORD0; 33 | float4 vertexInProjectionSpace : TEXCOORD1; 34 | 35 | UNITY_VERTEX_OUTPUT_STEREO 36 | }; 37 | 38 | sampler2D _MainTex; 39 | float4x4 _WorldToCameraMatrix; 40 | float4x4 _CameraProjectionMatrix; 41 | int _FlipY; 42 | float _VignetteScale; 43 | 44 | v2f vert (appdata v) 45 | { 46 | v2f o; 47 | 48 | UNITY_SETUP_INSTANCE_ID(v); 49 | UNITY_INITIALIZE_OUTPUT(v2f, o); 50 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 51 | 52 | o.vertexPositionInProjectionSpace = UnityObjectToClipPos(v.vertex); 53 | 54 | // Calculate the vertex position in world space. 55 | float4 vertexPositionInWorldSpace = mul(unity_ObjectToWorld, float4(v.vertex.xyz,1)); 56 | // Now take the world space vertex position and transform it so that 57 | // it is relative to the physical web camera on the HoloLens. 58 | float4 vertexPositionInCameraSpace = mul(_WorldToCameraMatrix, float4(vertexPositionInWorldSpace.xyz,1)); 59 | 60 | // Convert our camera relative vertex into clip space. 61 | o.vertexInProjectionSpace = mul(_CameraProjectionMatrix, float4(vertexPositionInCameraSpace.xyz, 1.0)); 62 | 63 | return o; 64 | } 65 | 66 | fixed4 frag (v2f i) : SV_Target 67 | { 68 | // Transform the vertex into normalized coordinate space. Basically 69 | // we want to map where our vertex should be on the screen into the -1 to 1 range 70 | // for both the x and y axes. 71 | float2 signedUV = i.vertexInProjectionSpace.xy / i.vertexInProjectionSpace.w; 72 | 73 | // The HoloLens uses an additive display so the color black will 74 | // be transparent. If the texture is smaller than the canvas, color the extra 75 | // area on the canvas black so it will be transparent on the HoloLens. 76 | if(abs(signedUV.x) > 1.0 || abs(signedUV.y) > 1.0) 77 | { 78 | return fixed4( 0.0, 0.0, 0.0, 0.0); 79 | } 80 | 81 | // Currently our signedUV's x and y coordinates will fall between -1 and 1. 82 | // We need to map this range from 0 to 1 so that we can sample our texture. 83 | float2 uv = signedUV * 0.5 + float2(0.5, 0.5); 84 | 85 | // Inverts the Y axis of the texture's UV. 86 | if (_FlipY > 0) uv.y = 1.0 - uv.y; 87 | 88 | float texcol = tex2D(_MainTex, uv).a; 89 | fixed4 finalColor = fixed4(texcol, texcol, texcol, 1.0f); 90 | 91 | // Finally add a circular vignette effect starting from the center 92 | // of the image. 93 | finalColor *= 1.0-(length(signedUV) * _VignetteScale); 94 | 95 | return finalColor; 96 | } 97 | ENDCG 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/HolographicImageBlendGrayscale.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 382bccdeb39c8b34abf8eb555b63dc2e 3 | timeCreated: 1497006639 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/TextureSinglePass.shader: -------------------------------------------------------------------------------- 1 | Shader "Unlit/TextureSinglePass" 2 | { 3 | Properties 4 | { 5 | _MainTex("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType" = "Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | 25 | UNITY_VERTEX_INPUT_INSTANCE_ID 26 | }; 27 | 28 | struct v2f 29 | { 30 | float2 uv : TEXCOORD0; 31 | float4 vertex : SV_POSITION; 32 | 33 | UNITY_VERTEX_OUTPUT_STEREO 34 | }; 35 | 36 | sampler2D _MainTex; 37 | float4 _MainTex_ST; 38 | 39 | v2f vert (appdata v) 40 | { 41 | v2f o; 42 | 43 | UNITY_SETUP_INSTANCE_ID(v); 44 | UNITY_INITIALIZE_OUTPUT(v2f, o); 45 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 46 | 47 | o.vertex = UnityObjectToClipPos(v.vertex); 48 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 49 | return o; 50 | } 51 | 52 | fixed4 frag (v2f i) : SV_Target 53 | { 54 | return tex2D(_MainTex, i.uv); 55 | } 56 | ENDCG 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/TextureSinglePass.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31835514b8863184783d3d14e978aa95 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/TextureSinglePassGreyscale.shader: -------------------------------------------------------------------------------- 1 | Shader "Unlit/TextureSinglePassGreyscale" 2 | { 3 | Properties 4 | { 5 | _MainTex("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType" = "Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | 25 | UNITY_VERTEX_INPUT_INSTANCE_ID 26 | }; 27 | 28 | struct v2f 29 | { 30 | float2 uv : TEXCOORD0; 31 | float4 vertex : SV_POSITION; 32 | 33 | UNITY_VERTEX_OUTPUT_STEREO 34 | }; 35 | 36 | sampler2D _MainTex; 37 | float4 _MainTex_ST; 38 | 39 | v2f vert (appdata v) 40 | { 41 | v2f o; 42 | 43 | UNITY_SETUP_INSTANCE_ID(v); 44 | UNITY_INITIALIZE_OUTPUT(v2f, o); 45 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 46 | 47 | o.vertex = UnityObjectToClipPos(v.vertex); 48 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 49 | return o; 50 | } 51 | 52 | fixed4 frag (v2f i) : SV_Target 53 | { 54 | float texcol = tex2D(_MainTex, i.uv).a; 55 | return fixed4(texcol, texcol, texcol, 1.0f); 56 | } 57 | ENDCG 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Resources/Shaders/TextureSinglePassGreyscale.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4b0fa5b2ab2dbb4c8fd6950056dd3a7 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 302bd4847e31e924789c3121aa0421e2 3 | folderAsset: yes 4 | timeCreated: 1491329845 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Scripts/CameraStreamHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using HoloLensCameraStream; 7 | using System; 8 | using System.Linq; 9 | using UnityEngine; 10 | 11 | public class CameraStreamHelper : MonoBehaviour 12 | { 13 | event OnVideoCaptureResourceCreatedCallback VideoCaptureCreated; 14 | 15 | static VideoCapture videoCapture; 16 | 17 | static CameraStreamHelper instance; 18 | public static CameraStreamHelper Instance 19 | { 20 | get 21 | { 22 | return instance; 23 | } 24 | } 25 | 26 | public void SetNativeISpatialCoordinateSystemPtr(IntPtr ptr) 27 | { 28 | videoCapture.WorldOriginPtr = ptr; 29 | } 30 | 31 | public void SetNativeISpatialCoordinateSystem(object worldOrigin) 32 | { 33 | videoCapture.WorldOrigin = worldOrigin; 34 | } 35 | 36 | public void GetVideoCaptureAsync(OnVideoCaptureResourceCreatedCallback onVideoCaptureAvailable) 37 | { 38 | if (onVideoCaptureAvailable == null) 39 | { 40 | Debug.LogError("You must supply the onVideoCaptureAvailable delegate."); 41 | } 42 | 43 | if (videoCapture == null) 44 | { 45 | VideoCaptureCreated += onVideoCaptureAvailable; 46 | } 47 | else 48 | { 49 | onVideoCaptureAvailable(videoCapture); 50 | } 51 | } 52 | 53 | public HoloLensCameraStream.Resolution GetHighestResolution() 54 | { 55 | if (videoCapture == null) 56 | { 57 | throw new Exception("Please call this method after a VideoCapture instance has been created."); 58 | } 59 | return videoCapture.GetSupportedResolutions().OrderByDescending((r) => r.width * r.height).FirstOrDefault(); 60 | } 61 | 62 | public HoloLensCameraStream.Resolution GetLowestResolution() 63 | { 64 | if (videoCapture == null) 65 | { 66 | throw new Exception("Please call this method after a VideoCapture instance has been created."); 67 | } 68 | return videoCapture.GetSupportedResolutions().OrderBy((r) => r.width * r.height).FirstOrDefault(); 69 | } 70 | 71 | public float GetHighestFrameRate(HoloLensCameraStream.Resolution forResolution) 72 | { 73 | if (videoCapture == null) 74 | { 75 | throw new Exception("Please call this method after a VideoCapture instance has been created."); 76 | } 77 | return videoCapture.GetSupportedFrameRatesForResolution(forResolution).OrderByDescending(r => r).FirstOrDefault(); 78 | } 79 | 80 | public float GetLowestFrameRate(HoloLensCameraStream.Resolution forResolution) 81 | { 82 | if (videoCapture == null) 83 | { 84 | throw new Exception("Please call this method after a VideoCapture instance has been created."); 85 | } 86 | return videoCapture.GetSupportedFrameRatesForResolution(forResolution).OrderBy(r => r).FirstOrDefault(); 87 | } 88 | 89 | private void Awake() 90 | { 91 | if (instance != null) 92 | { 93 | Debug.LogError("Cannot create two instances of CamStreamManager."); 94 | return; 95 | } 96 | 97 | instance = this; 98 | VideoCapture.CreateAync(OnVideoCaptureInstanceCreated); 99 | } 100 | 101 | private void OnDestroy() 102 | { 103 | if (instance == this) 104 | { 105 | instance = null; 106 | } 107 | } 108 | 109 | private void OnVideoCaptureInstanceCreated(VideoCapture videoCapture) 110 | { 111 | if (videoCapture == null) 112 | { 113 | Debug.LogError("Creating the VideoCapture object failed."); 114 | return; 115 | } 116 | 117 | CameraStreamHelper.videoCapture = videoCapture; 118 | if (VideoCaptureCreated != null) 119 | { 120 | VideoCaptureCreated(videoCapture); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Scripts/CameraStreamHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d7a303625e450b499551864fb15277d 3 | timeCreated: 1491329900 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Scripts/LocatableCameraUtils.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Vulcan, Inc. All rights reserved. 3 | // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. 4 | // 5 | 6 | using System.Collections; 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | 10 | public static class LocatableCameraUtils 11 | { 12 | /// 13 | /// Helper method for pixel projection into Unity3D world space. 14 | /// This method return a Vector3 with direction: optical center of the camera to the pixel coordinate 15 | /// The method is based on: https://developer.microsoft.com/en-us/windows/mixed-reality/locatable_camera#pixel_to_application-specified_coordinate_system 16 | /// 17 | /// The camera to Unity world matrix. 18 | /// Projection Matrix. 19 | /// The coordinate of the pixel that should be converted to world-space. 20 | /// The resolution of the image that the pixel came from. 21 | /// Vector3 with direction: optical center to camera world-space coordinates 22 | public static Vector3 PixelCoordToWorldCoord(Matrix4x4 cameraToWorldMatrix, Matrix4x4 projectionMatrix, HoloLensCameraStream.Resolution cameraResolution, Vector2 pixelCoordinates) 23 | { 24 | pixelCoordinates = ConvertPixelCoordsToScaledCoords(pixelCoordinates, cameraResolution); // -1 to 1 coords 25 | 26 | float focalLengthX = projectionMatrix.GetColumn(0).x; 27 | float focalLengthY = projectionMatrix.GetColumn(1).y; 28 | float centerX = projectionMatrix.GetColumn(2).x; 29 | float centerY = projectionMatrix.GetColumn(2).y; 30 | 31 | // On Microsoft Webpage the centers are normalized 32 | float normFactor = projectionMatrix.GetColumn(2).z; 33 | centerX = centerX / normFactor; 34 | centerY = centerY / normFactor; 35 | 36 | Vector3 dirRay = new Vector3((pixelCoordinates.x - centerX) / focalLengthX, (pixelCoordinates.y - centerY) / focalLengthY, 1.0f / normFactor); //Direction is in camera space 37 | Vector3 direction = new Vector3(Vector3.Dot(cameraToWorldMatrix.GetRow(0), dirRay), Vector3.Dot(cameraToWorldMatrix.GetRow(1), dirRay), Vector3.Dot(cameraToWorldMatrix.GetRow(2), dirRay)); 38 | 39 | return direction; 40 | } 41 | 42 | public static Vector3 GetNormalOfPose(Matrix4x4 pose) 43 | { 44 | return new Vector3(Vector3.Dot(Vector3.forward, pose.GetRow(0)), Vector3.Dot(Vector3.forward, pose.GetRow(1)), Vector3.Dot(Vector3.forward, pose.GetRow(2))); 45 | } 46 | 47 | public static Quaternion GetRotationFacingView(Matrix4x4 viewTransform) 48 | { 49 | return Quaternion.LookRotation(-viewTransform.GetColumn(2), viewTransform.GetColumn(1)); 50 | } 51 | 52 | public static Matrix4x4 BytesToMatrix(byte[] inMatrix) 53 | { 54 | //Then convert the floats to a matrix. 55 | Matrix4x4 outMatrix = new Matrix4x4 56 | { 57 | m00 = inMatrix[0], 58 | m01 = inMatrix[1], 59 | m02 = inMatrix[2], 60 | m03 = inMatrix[3], 61 | m10 = inMatrix[4], 62 | m11 = inMatrix[5], 63 | m12 = inMatrix[6], 64 | m13 = inMatrix[7], 65 | m20 = inMatrix[8], 66 | m21 = inMatrix[9], 67 | m22 = inMatrix[10], 68 | m23 = inMatrix[11], 69 | m30 = inMatrix[12], 70 | m31 = inMatrix[13], 71 | m32 = inMatrix[14], 72 | m33 = inMatrix[15] 73 | }; 74 | return outMatrix; 75 | } 76 | 77 | /// 78 | /// Helper method for converting into UnityEngine.Matrix4x4 79 | /// 80 | /// 81 | /// 82 | public static Matrix4x4 ConvertFloatArrayToMatrix4x4(float[] matrixAsArray) 83 | { 84 | //There is probably a better way to be doing this but System.Numerics.Matrix4x4 is not available 85 | //in Unity and we do not include UnityEngine in the plugin. 86 | Matrix4x4 m = new Matrix4x4(); 87 | m.m00 = matrixAsArray[0]; 88 | m.m01 = matrixAsArray[1]; 89 | m.m02 = matrixAsArray[2]; 90 | m.m03 = matrixAsArray[3]; 91 | m.m10 = matrixAsArray[4]; 92 | m.m11 = matrixAsArray[5]; 93 | m.m12 = matrixAsArray[6]; 94 | m.m13 = matrixAsArray[7]; 95 | m.m20 = matrixAsArray[8]; 96 | m.m21 = matrixAsArray[9]; 97 | m.m22 = matrixAsArray[10]; 98 | m.m23 = matrixAsArray[11]; 99 | m.m30 = matrixAsArray[12]; 100 | m.m31 = matrixAsArray[13]; 101 | m.m32 = matrixAsArray[14]; 102 | m.m33 = matrixAsArray[15]; 103 | 104 | return m; 105 | } 106 | 107 | /// 108 | /// Converts pixel coordinates to screen-space coordinates that span from -1 to 1 on both axes. 109 | /// This is the format that is required to determine the z-depth of a given pixel taken by the HoloLens camera. 110 | /// 111 | /// The coordinate of the pixel that should be converted to screen-space. 112 | /// The resolution of the image that the pixel came from. 113 | /// A 2D vector with values between -1 and 1, representing the left-to-right scale within the image dimensions. 114 | static Vector2 ConvertPixelCoordsToScaledCoords(Vector2 pixelCoords, HoloLensCameraStream.Resolution resolution) 115 | { 116 | float halfWidth = (float)resolution.width / 2f; 117 | float halfHeight = (float)resolution.height / 2f; 118 | 119 | //Translate registration to image center; 120 | pixelCoords.x -= halfWidth; 121 | pixelCoords.y -= halfHeight; 122 | 123 | //Scale pixel coords to percentage coords (-1 to 1) 124 | pixelCoords = new Vector2(pixelCoords.x / halfWidth, pixelCoords.y / halfHeight * -1f); 125 | 126 | return pixelCoords; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/CamStream/Scripts/LocatableCameraUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bc90774d10259d4890e948ab1d04eb6 3 | timeCreated: 1511511420 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/WSATestCertificate.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/HoloLensCameraStream/1b7b357538644b5c7d38e55b61af8831fef7412e/HoloLensVideoCaptureExample/Assets/WSATestCertificate.pfx -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Assets/WSATestCertificate.pfx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df7a668e4b6ffcf43bbad772e1b5b2cb 3 | timeCreated: 1491503736 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Logs/Packages-Update.log: -------------------------------------------------------------------------------- 1 | 2 | === Wed Oct 12 16:22:30 2022 3 | 4 | Packages were changed. 5 | Update Mode: resetToDefaultDependencies 6 | 7 | The following packages were added: 8 | com.unity.collab-proxy@1.10.2 9 | com.unity.ide.rider@1.2.1 10 | com.unity.ide.visualstudio@2.0.11 11 | com.unity.ide.vscode@1.2.4 12 | com.unity.modules.ai@1.0.0 13 | com.unity.modules.androidjni@1.0.0 14 | com.unity.modules.animation@1.0.0 15 | com.unity.modules.assetbundle@1.0.0 16 | com.unity.modules.audio@1.0.0 17 | com.unity.modules.cloth@1.0.0 18 | com.unity.modules.director@1.0.0 19 | com.unity.modules.imageconversion@1.0.0 20 | com.unity.modules.imgui@1.0.0 21 | com.unity.modules.jsonserialize@1.0.0 22 | com.unity.modules.particlesystem@1.0.0 23 | com.unity.modules.physics@1.0.0 24 | com.unity.modules.physics2d@1.0.0 25 | com.unity.modules.screencapture@1.0.0 26 | com.unity.modules.terrain@1.0.0 27 | com.unity.modules.terrainphysics@1.0.0 28 | com.unity.modules.tilemap@1.0.0 29 | com.unity.modules.ui@1.0.0 30 | com.unity.modules.uielements@1.0.0 31 | com.unity.modules.umbra@1.0.0 32 | com.unity.modules.unityanalytics@1.0.0 33 | com.unity.modules.unitywebrequest@1.0.0 34 | com.unity.modules.unitywebrequestassetbundle@1.0.0 35 | com.unity.modules.unitywebrequestaudio@1.0.0 36 | com.unity.modules.unitywebrequesttexture@1.0.0 37 | com.unity.modules.unitywebrequestwww@1.0.0 38 | com.unity.modules.vehicles@1.0.0 39 | com.unity.modules.video@1.0.0 40 | com.unity.modules.vr@1.0.0 41 | com.unity.modules.wind@1.0.0 42 | com.unity.modules.xr@1.0.0 43 | com.unity.test-framework@1.1.29 44 | com.unity.textmeshpro@2.1.6 45 | com.unity.timeline@1.2.18 46 | com.unity.ugui@1.0.0 47 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.10.2", 4 | "com.unity.ide.rider": "1.2.1", 5 | "com.unity.ide.visualstudio": "2.0.16", 6 | "com.unity.ide.vscode": "1.2.4", 7 | "com.unity.test-framework": "1.1.29", 8 | "com.unity.textmeshpro": "2.1.6", 9 | "com.unity.timeline": "1.2.18", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": { 4 | "version": "1.10.2", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": {}, 8 | "url": "https://packages.unity.com" 9 | }, 10 | "com.unity.ext.nunit": { 11 | "version": "1.0.6", 12 | "depth": 1, 13 | "source": "registry", 14 | "dependencies": {}, 15 | "url": "https://packages.unity.com" 16 | }, 17 | "com.unity.ide.rider": { 18 | "version": "1.2.1", 19 | "depth": 0, 20 | "source": "registry", 21 | "dependencies": { 22 | "com.unity.test-framework": "1.1.1" 23 | }, 24 | "url": "https://packages.unity.com" 25 | }, 26 | "com.unity.ide.visualstudio": { 27 | "version": "2.0.16", 28 | "depth": 0, 29 | "source": "registry", 30 | "dependencies": { 31 | "com.unity.test-framework": "1.1.9" 32 | }, 33 | "url": "https://packages.unity.com" 34 | }, 35 | "com.unity.ide.vscode": { 36 | "version": "1.2.4", 37 | "depth": 0, 38 | "source": "registry", 39 | "dependencies": {}, 40 | "url": "https://packages.unity.com" 41 | }, 42 | "com.unity.test-framework": { 43 | "version": "1.1.29", 44 | "depth": 0, 45 | "source": "registry", 46 | "dependencies": { 47 | "com.unity.ext.nunit": "1.0.6", 48 | "com.unity.modules.imgui": "1.0.0", 49 | "com.unity.modules.jsonserialize": "1.0.0" 50 | }, 51 | "url": "https://packages.unity.com" 52 | }, 53 | "com.unity.textmeshpro": { 54 | "version": "2.1.6", 55 | "depth": 0, 56 | "source": "registry", 57 | "dependencies": { 58 | "com.unity.ugui": "1.0.0" 59 | }, 60 | "url": "https://packages.unity.com" 61 | }, 62 | "com.unity.timeline": { 63 | "version": "1.2.18", 64 | "depth": 0, 65 | "source": "registry", 66 | "dependencies": { 67 | "com.unity.modules.director": "1.0.0", 68 | "com.unity.modules.animation": "1.0.0", 69 | "com.unity.modules.audio": "1.0.0", 70 | "com.unity.modules.particlesystem": "1.0.0" 71 | }, 72 | "url": "https://packages.unity.com" 73 | }, 74 | "com.unity.ugui": { 75 | "version": "1.0.0", 76 | "depth": 0, 77 | "source": "builtin", 78 | "dependencies": { 79 | "com.unity.modules.ui": "1.0.0", 80 | "com.unity.modules.imgui": "1.0.0" 81 | } 82 | }, 83 | "com.unity.modules.ai": { 84 | "version": "1.0.0", 85 | "depth": 0, 86 | "source": "builtin", 87 | "dependencies": {} 88 | }, 89 | "com.unity.modules.androidjni": { 90 | "version": "1.0.0", 91 | "depth": 0, 92 | "source": "builtin", 93 | "dependencies": {} 94 | }, 95 | "com.unity.modules.animation": { 96 | "version": "1.0.0", 97 | "depth": 0, 98 | "source": "builtin", 99 | "dependencies": {} 100 | }, 101 | "com.unity.modules.assetbundle": { 102 | "version": "1.0.0", 103 | "depth": 0, 104 | "source": "builtin", 105 | "dependencies": {} 106 | }, 107 | "com.unity.modules.audio": { 108 | "version": "1.0.0", 109 | "depth": 0, 110 | "source": "builtin", 111 | "dependencies": {} 112 | }, 113 | "com.unity.modules.cloth": { 114 | "version": "1.0.0", 115 | "depth": 0, 116 | "source": "builtin", 117 | "dependencies": { 118 | "com.unity.modules.physics": "1.0.0" 119 | } 120 | }, 121 | "com.unity.modules.director": { 122 | "version": "1.0.0", 123 | "depth": 0, 124 | "source": "builtin", 125 | "dependencies": { 126 | "com.unity.modules.audio": "1.0.0", 127 | "com.unity.modules.animation": "1.0.0" 128 | } 129 | }, 130 | "com.unity.modules.imageconversion": { 131 | "version": "1.0.0", 132 | "depth": 0, 133 | "source": "builtin", 134 | "dependencies": {} 135 | }, 136 | "com.unity.modules.imgui": { 137 | "version": "1.0.0", 138 | "depth": 0, 139 | "source": "builtin", 140 | "dependencies": {} 141 | }, 142 | "com.unity.modules.jsonserialize": { 143 | "version": "1.0.0", 144 | "depth": 0, 145 | "source": "builtin", 146 | "dependencies": {} 147 | }, 148 | "com.unity.modules.particlesystem": { 149 | "version": "1.0.0", 150 | "depth": 0, 151 | "source": "builtin", 152 | "dependencies": {} 153 | }, 154 | "com.unity.modules.physics": { 155 | "version": "1.0.0", 156 | "depth": 0, 157 | "source": "builtin", 158 | "dependencies": {} 159 | }, 160 | "com.unity.modules.physics2d": { 161 | "version": "1.0.0", 162 | "depth": 0, 163 | "source": "builtin", 164 | "dependencies": {} 165 | }, 166 | "com.unity.modules.screencapture": { 167 | "version": "1.0.0", 168 | "depth": 0, 169 | "source": "builtin", 170 | "dependencies": { 171 | "com.unity.modules.imageconversion": "1.0.0" 172 | } 173 | }, 174 | "com.unity.modules.subsystems": { 175 | "version": "1.0.0", 176 | "depth": 1, 177 | "source": "builtin", 178 | "dependencies": { 179 | "com.unity.modules.jsonserialize": "1.0.0" 180 | } 181 | }, 182 | "com.unity.modules.terrain": { 183 | "version": "1.0.0", 184 | "depth": 0, 185 | "source": "builtin", 186 | "dependencies": {} 187 | }, 188 | "com.unity.modules.terrainphysics": { 189 | "version": "1.0.0", 190 | "depth": 0, 191 | "source": "builtin", 192 | "dependencies": { 193 | "com.unity.modules.physics": "1.0.0", 194 | "com.unity.modules.terrain": "1.0.0" 195 | } 196 | }, 197 | "com.unity.modules.tilemap": { 198 | "version": "1.0.0", 199 | "depth": 0, 200 | "source": "builtin", 201 | "dependencies": { 202 | "com.unity.modules.physics2d": "1.0.0" 203 | } 204 | }, 205 | "com.unity.modules.ui": { 206 | "version": "1.0.0", 207 | "depth": 0, 208 | "source": "builtin", 209 | "dependencies": {} 210 | }, 211 | "com.unity.modules.uielements": { 212 | "version": "1.0.0", 213 | "depth": 0, 214 | "source": "builtin", 215 | "dependencies": { 216 | "com.unity.modules.imgui": "1.0.0", 217 | "com.unity.modules.jsonserialize": "1.0.0" 218 | } 219 | }, 220 | "com.unity.modules.umbra": { 221 | "version": "1.0.0", 222 | "depth": 0, 223 | "source": "builtin", 224 | "dependencies": {} 225 | }, 226 | "com.unity.modules.unityanalytics": { 227 | "version": "1.0.0", 228 | "depth": 0, 229 | "source": "builtin", 230 | "dependencies": { 231 | "com.unity.modules.unitywebrequest": "1.0.0", 232 | "com.unity.modules.jsonserialize": "1.0.0" 233 | } 234 | }, 235 | "com.unity.modules.unitywebrequest": { 236 | "version": "1.0.0", 237 | "depth": 0, 238 | "source": "builtin", 239 | "dependencies": {} 240 | }, 241 | "com.unity.modules.unitywebrequestassetbundle": { 242 | "version": "1.0.0", 243 | "depth": 0, 244 | "source": "builtin", 245 | "dependencies": { 246 | "com.unity.modules.assetbundle": "1.0.0", 247 | "com.unity.modules.unitywebrequest": "1.0.0" 248 | } 249 | }, 250 | "com.unity.modules.unitywebrequestaudio": { 251 | "version": "1.0.0", 252 | "depth": 0, 253 | "source": "builtin", 254 | "dependencies": { 255 | "com.unity.modules.unitywebrequest": "1.0.0", 256 | "com.unity.modules.audio": "1.0.0" 257 | } 258 | }, 259 | "com.unity.modules.unitywebrequesttexture": { 260 | "version": "1.0.0", 261 | "depth": 0, 262 | "source": "builtin", 263 | "dependencies": { 264 | "com.unity.modules.unitywebrequest": "1.0.0", 265 | "com.unity.modules.imageconversion": "1.0.0" 266 | } 267 | }, 268 | "com.unity.modules.unitywebrequestwww": { 269 | "version": "1.0.0", 270 | "depth": 0, 271 | "source": "builtin", 272 | "dependencies": { 273 | "com.unity.modules.unitywebrequest": "1.0.0", 274 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 275 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 276 | "com.unity.modules.audio": "1.0.0", 277 | "com.unity.modules.assetbundle": "1.0.0", 278 | "com.unity.modules.imageconversion": "1.0.0" 279 | } 280 | }, 281 | "com.unity.modules.vehicles": { 282 | "version": "1.0.0", 283 | "depth": 0, 284 | "source": "builtin", 285 | "dependencies": { 286 | "com.unity.modules.physics": "1.0.0" 287 | } 288 | }, 289 | "com.unity.modules.video": { 290 | "version": "1.0.0", 291 | "depth": 0, 292 | "source": "builtin", 293 | "dependencies": { 294 | "com.unity.modules.audio": "1.0.0", 295 | "com.unity.modules.ui": "1.0.0", 296 | "com.unity.modules.unitywebrequest": "1.0.0" 297 | } 298 | }, 299 | "com.unity.modules.vr": { 300 | "version": "1.0.0", 301 | "depth": 0, 302 | "source": "builtin", 303 | "dependencies": { 304 | "com.unity.modules.jsonserialize": "1.0.0", 305 | "com.unity.modules.physics": "1.0.0", 306 | "com.unity.modules.xr": "1.0.0" 307 | } 308 | }, 309 | "com.unity.modules.wind": { 310 | "version": "1.0.0", 311 | "depth": 0, 312 | "source": "builtin", 313 | "dependencies": {} 314 | }, 315 | "com.unity.modules.xr": { 316 | "version": "1.0.0", 317 | "depth": 0, 318 | "source": "builtin", 319 | "dependencies": { 320 | "com.unity.modules.physics": "1.0.0", 321 | "com.unity.modules.jsonserialize": "1.0.0", 322 | "com.unity.modules.subsystems": "1.0.0" 323 | } 324 | } 325 | } 326 | } 327 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/CamStream/Examples/Video Panel Example/Video Panel Example.unity 10 | guid: e913caf645897db42bbdacb4893c11d6 11 | - enabled: 0 12 | path: Assets/CamStream/Examples/Projection Example/Projection Example.unity 13 | guid: c26c9a511df0b8f4890621a3e15abdeb 14 | - enabled: 0 15 | path: Assets/CamStream/Examples/Matrix Usage Example/Matrix Usage Example.unity 16 | guid: 412fd74fbf15aa44d9057de5b59b3275 17 | m_configObjects: {} 18 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 2 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 41 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 42 | m_PreloadedShaders: [] 43 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 44 | type: 0} 45 | m_CustomRenderPipeline: {fileID: 0} 46 | m_TransparencySortMode: 0 47 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 48 | m_DefaultRenderingPath: 1 49 | m_DefaultMobileRenderingPath: 1 50 | m_TierSettings: [] 51 | m_LightmapStripping: 0 52 | m_FogStripping: 0 53 | m_InstancingStripping: 0 54 | m_LightmapKeepPlain: 1 55 | m_LightmapKeepDirCombined: 1 56 | m_LightmapKeepDynamicPlain: 1 57 | m_LightmapKeepDynamicDirCombined: 1 58 | m_LightmapKeepShadowMask: 1 59 | m_LightmapKeepSubtractive: 1 60 | m_FogKeepLinear: 1 61 | m_FogKeepExp: 1 62 | m_FogKeepExp2: 1 63 | m_AlbedoSwatchInfos: [] 64 | m_LightsUseLinearIntensity: 0 65 | m_LightsUseColorTemperature: 0 66 | m_LogWhenShaderIsCompiled: 0 67 | m_AllowEnlightenSupportForUpgradedProject: 1 68 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_ScopedRegistriesSettingsExpanded: 1 16 | oneTimeWarningShown: 0 17 | m_Registries: 18 | - m_Id: main 19 | m_Name: 20 | m_Url: https://packages.unity.com 21 | m_Scopes: [] 22 | m_IsDefault: 1 23 | m_UserSelectedRegistryName: 24 | m_UserAddingNewScopedRegistry: 0 25 | m_RegistryInfoDraft: 26 | m_ErrorMessage: 27 | m_Original: 28 | m_Id: 29 | m_Name: 30 | m_Url: 31 | m_Scopes: [] 32 | m_IsDefault: 0 33 | m_Modified: 0 34 | m_Name: 35 | m_Url: 36 | m_Scopes: 37 | - 38 | m_SelectedScopeIndex: 0 39 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ShowColliderAABB: 0 29 | m_ContactArrowScale: 0.2 30 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 31 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 32 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 33 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 34 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 35 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.4.31f1 2 | m_EditorVersionWithRevision: 2019.4.31f1 (bd5abf232a62) 3 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 3 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 3 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 3 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 3 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 3 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS4: 5 169 | PSM: 5 170 | PSP2: 2 171 | Samsung TV: 2 172 | Standalone: 5 173 | Tizen: 2 174 | Web: 5 175 | WebGL: 3 176 | WiiU: 5 177 | Windows Store Apps: 0 178 | XboxOne: 5 179 | iPhone: 2 180 | tvOS: 5 181 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: 7 | - Tip 8 | layers: 9 | - Default 10 | - TransparentFX 11 | - Ignore Raycast 12 | - 13 | - Water 14 | - UI 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | - 41 | m_SortingLayers: 42 | - name: Default 43 | uniqueID: 0 44 | locked: 0 45 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /HoloLensVideoCaptureExample/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HoloLensCameraStream for Unity 2 | This Unity plugin makes the HoloLens video camera frames available to a Unity app in real time. This enables Unity devs to easily use the HoloLens camera for computer vision (or anything they want). 3 | 4 | Use this if you need access to the HoloLens camera's frame buffer in Unity, including the [locatable camera attributes](https://developer.microsoft.com/en-us/windows/mixed-reality/locatable_camera). 5 | 6 | ## With this plugin, you can 7 | * Do computer vision and machine learning on the frames in real time. (algorithms not included) 8 | * Show a preview of what the HoloLens camera sees. 9 | * Obtain a 3D coordinate given an image pixel coordinate from the HoloLens video camera. For instance, you could identify a book using computer vision, then render something on top of that book. 10 | 11 | ## Getting Started 12 | The tutorials below will show you how to **build the plugin (DLL)** or run the **Unity sample app**. 13 | 14 | ### What's in this repository 15 | There are two separate "solutions" (if you will) in this repository: 16 | * **The Plugin (HoloLensCameraStream/)** - This is a Video Studio solution that builds the Unity Plugin, which is just a DLL (library file). You can drop this DLL into a Unity project (in the appropriate directory) and then use its public methods, properties, and events from Unity. 17 | * **The Unity example project (HoloLensVideoCaptureExample)/** - This shows you how to use the HoloLensCameraStream plugin in a Unity project. You can build it and run it on the HoloLens, or copy it and use it as a starter template for your own project. 18 | 19 | ### Things you need 20 | * [The HoloLens development tools](https://developer.microsoft.com/en-us/windows/mixed-reality/install_the_tools), sans Vuforia and the Emulator. 21 | 22 | ### Building the Plugin 23 | The plugin solution has two projects. One is the actual library project, and the other is a "dummy" or "placeholder" project that is used to keep the Unity editor from complaining ([more info here](https://docs.unity3d.com/Manual/windowsstore-plugins.html)). The placeholder project doesn't do anything, it just mimics the plugin's public API. To build the solution (including both projects), follow the steps below: 24 | 1. **Clone this repository.** 25 | 2. **Open the HoloLensCameraStream solution in Visual Studio.** It lives in `HoloLensCameraStream/HoloLensCameraStream/HoloLensCameraStream.sln`. 26 | 3. **Build the solution** In the VS menu, select **Build > Build Solution**. *Note: Make sure Visual Studio is set up to download missing NuGet packages, or you will get a spew of errors about missing namespaces.* 27 | 4. That's all! This will produce two DLLs, one is the real DLL, and the other is the "placeholder" described above. 28 | 29 | ### Integrating the plugin into a Unity project 30 | If you made some changes to the plugin project, and you want to use your newly-built DLLs, follow these steps. If you haven't made changes to the plugin, but just want to learn how to *use the CameraStream plugin in Unity*, skip this part and read instead about running the example project. 31 | 1. **Find the DLLs you just build:** Look in the output window after you build the plugin solution. You will see two paths to the newly-build DLLs. Navigate to them. 32 | 2. **Paste the plugin DLL into Unity:** Copy the plugin DLL from the output directory and paste it into the your Unity app. It must be pasted into the `Assets/Plugins/WSA/` directory in your Unity project because it will only compile for WSA devices. 33 | 3. **Paste the placeholder DLL into Unity:** Copy the placeholder (dummy) DLL from its output directory and paste it into your Unity app. It must be in the `Assets/Plugins/` directory in your Unity project. This is the DLL that the Unity editor compiles against uses while you're coding in Unity. 34 | 4. **Edit the plugin's settings:** In the Unity editor, select the `HoloLensCameraStream.dll` plugin file that you pasted in step 2. In the inspector, uncheck all platforms except `WSAPlayer`. Set the SDK to `UWP`, and set the Scripting Backend to `Any Scripting Backend`. In the Placeholder dropdown, select the `HoloLensCameraStream.dll` option (it will likely be the only option). 35 | 5. **Click Apply.** 36 | 6. **Edit the placeholder plugin's settings:** Select the placeholder (dummy) plugin in `Assets/Plugins/HoloLensCameraStream.dll`. Uncheck all platforms except `Editor`. 37 | 7. **Click Apply.** 38 | 39 | You should now be able to code against the HoloLensCameraStream plugin after importing said namespace in your Unity scripts. *Note: Your Unity project needs to be [appropriately configured for HoloLens development](https://developer.microsoft.com/en-us/windows/mixed-reality/holograms_100).* 40 | 41 | ### Running the example Unity project 42 | The example Unity project can be found in the root `HoloLensVideoCaptureExample/` directory. This Unity project is a great way to learn how to use the CameraStream plugin in Unity, or to use as a template for your own Unity project. Read on to learn how to build and run the example project on your HoloLens. You should be familiar with creating and configuring a new Unity-HoloLens project [according to Microsoft's instructions](https://developer.microsoft.com/en-us/windows/mixed-reality/holograms_100). As Microsoft and Unity update their HoloLens documentation, I'm sure this tutorial will become out of date. 43 | 1. **Open the example project:** Navigate to and open the example project directory (`HoloLensVideoCaptureExample/`) in Unity. 44 | 2. **Configure build settings:** Once the project opens, select **File > Build Settings**. In the Platform list, select `Windows Store`. Set the SDK to `Universal 10`; set Target device to `HoloLens`; set UWP Build Type to `D3D`; check the Unity C# Projects checkbox; and finally, click **Switch Platform**. 45 | 3. **Add Define Symbols:** Open **File > Build Settings > Player Settings > Other Settings** and add the following to `Scripting Define Symbols` depending on the XR system used in your project; Legacy built-in XR: `BUILTIN_XR`'; XR Plugin Management (Windows Mixed Reality): `XR_PLUGIN_WINDOWSMR`; XR Plugin Management (OpenXR):`XR_PLUGIN_OPENXR`. 46 | 4. **Build the project:** You can now build the Unity project, which generates a Visual Studio Solution (which you will then have to also build). With the Build Settings window still open, click **Build**. In the explorer window that appears, make a new folder called `App`, which should live as a sibling next to the 'Assets` folder. Then click Select Folder to generate the VS solution in that folder. Then wait for Unity to build the solution. 47 | 5. **Open the VS Solution:** When the solution is built, a Windows explorer folder will open. Open the newly-built VS solution, which lives in `App/HoloLensVideoCaptureExample.sln`. This is the solution that ultimately gets deployed to your HoloLens. 48 | 6. **Configure the deploy settings:** In the Visual Studio toolbar, change the solution platform from `ARM` to `x86` if you are building for Hololens1 or to `ARM64` if you are building for Hololens2; Change the deploy target (the green play button) to `Device` (if your HoloLens is plugged into your computer), or `Remote Machine` (if your HoloLens is connected via WiFi). 49 | 7. **Run the app:** Go to **Debug > Start Debugging**. Once the app is deployed to the HoloLens, you should see some confirmation output in the Output window. 50 | 51 | If you have questions, [check out the FAQ](https://github.com/VulcanTechnologies/HoloLensCameraStream/wiki/FAQ). 52 | 53 | ## Contributing 54 | We would love for you to contribute to this project. Take a look at the TODO list in the Plugin's solution, or look at the Issues tab on GitHub to see how you can contribute. Thanks, enjoy! 55 | --------------------------------------------------------------------------------