-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HoloLens 2 Getting-started Sample App (#184)
* Adding HoloLens2 Getting Started Sample App * Adding Readme * Updating Readme with basic instructions * Updating WebView2 Package Version * Update Unity Version to 2021.3.24f1
- Loading branch information
1 parent
c8898ef
commit 1be6f4f
Showing
80 changed files
with
8,673 additions
and
0 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# This .gitignore file should be placed at the root of your Unity project directory | ||
# | ||
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore | ||
# | ||
/[Ll]ibrary/ | ||
/[Tt]emp/ | ||
/[Oo]bj/ | ||
/[Bb]uild/ | ||
/[Bb]uilds/ | ||
/[Ll]ogs/ | ||
/[Uu]ser[Ss]ettings/ | ||
|
||
|
||
# Ensure Packages folder included | ||
!/[Pp]ackages/ | ||
|
||
# MemoryCaptures can get excessive in size. | ||
# They also could contain extremely sensitive data | ||
/[Mm]emoryCaptures/ | ||
|
||
# Asset meta data should only be ignored when the corresponding asset is also ignored | ||
#!*/[Aa]ssets/**/*.meta | ||
|
||
# Recordings can get excessive in size | ||
/[Rr]ecordings/ | ||
|
||
# Uncomment this line if you wish to ignore the asset store tools plugin | ||
/[Aa]ssets/AssetStoreTools* | ||
|
||
# Autogenerated Jetbrains Rider plugin | ||
/[Aa]ssets/Plugins/Editor/JetBrains* | ||
|
||
# Visual Studio cache directory | ||
.vs/ | ||
|
||
# Gradle cache directory | ||
.gradle/ | ||
|
||
# Autogenerated VS/MD/Consulo solution and project files | ||
ExportedObj/ | ||
.consulo/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
*.pfx | ||
*.pfx.meta | ||
*.pdb | ||
*.mdb | ||
*.opendb | ||
*.VC.db | ||
.vsconfig | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
*.pdb.meta | ||
*.mdb.meta | ||
|
||
# Unity3D generated file on crash reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.aab | ||
*.unitypackage | ||
*.app | ||
|
||
# MRTK Packages | ||
/[Pp]ackages/[Mm]ixed[Rr]eality/ | ||
|
||
# Crashlytics generated file | ||
crashlytics-build.properties | ||
|
||
# Packed Addressables | ||
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* | ||
|
||
# Temporary auto-generated Android Assets | ||
/[Aa]ssets/[Ss]treamingAssets/aa.meta | ||
/[Aa]ssets/[Ss]treamingAssets/aa/* | ||
|
||
/[Aa]ssets/MixedRealityToolkit.Generated* | ||
/[Aa]ssets/TextMesh Pro* |
8 changes: 8 additions & 0 deletions
8
GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...ingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
104 changes: 104 additions & 0 deletions
104
.../HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/ChannelPacker.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file. | ||
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented. | ||
|
||
Shader "Hidden/ChannelPacker" | ||
{ | ||
Properties | ||
{ | ||
_MetallicMap("Metallic Map", 2D) = "black" {} | ||
_MetallicMapChannel("Metallic Map Channel", Int) = 0 // Red. | ||
_MetallicUniform("Metallic Uniform", Float) = -0.01 | ||
_OcclusionMap("Occlusion Map", 2D) = "white" {} | ||
_OcclusionMapChannel("Occlusion Map Channel", Int) = 1 // Green. | ||
_OcclusionUniform("Occlusion Uniform", Float) = -0.01 | ||
_EmissionMap("Emission Map", 2D) = "black" {} | ||
_EmissionMapChannel("Emission Map Channel", Int) = 4 // RGBAverage. | ||
_EmissionUniform("Emission Uniform", Float) = -0.01 | ||
_SmoothnessMap("Smoothness Map", 2D) = "gray" {} | ||
_SmoothnessMapChannel("Smoothness Map Channel", Int) = 3 // Alpha. | ||
_SmoothnessUniform("Smoothness Uniform", Float) = -0.01 | ||
} | ||
SubShader | ||
{ | ||
Pass | ||
{ | ||
CGPROGRAM | ||
|
||
#pragma vertex vert | ||
#pragma fragment frag | ||
|
||
#include "UnityCG.cginc" | ||
|
||
struct appdata | ||
{ | ||
float4 vertex : POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
struct v2f | ||
{ | ||
float4 vertex : SV_POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
sampler2D _MetallicMap; | ||
int _MetallicMapChannel; | ||
float _MetallicUniform; | ||
sampler2D _OcclusionMap; | ||
int _OcclusionMapChannel; | ||
float _OcclusionUniform; | ||
sampler2D _EmissionMap; | ||
int _EmissionMapChannel; | ||
float _EmissionUniform; | ||
sampler2D _SmoothnessMap; | ||
int _SmoothnessMapChannel; | ||
float _SmoothnessUniform; | ||
|
||
v2f vert(appdata v) | ||
{ | ||
v2f o; | ||
o.vertex = UnityObjectToClipPos(v.vertex); | ||
o.uv = v.uv; | ||
|
||
return o; | ||
} | ||
|
||
fixed4 ToGrayScale(fixed4 color) | ||
{ | ||
return color.r * 0.21 + color.g * 0.71 + color.b * 0.08; | ||
} | ||
|
||
fixed Sample(fixed4 color, int channel, float uniformValue) | ||
{ | ||
if (uniformValue >= 0.0) | ||
{ | ||
return uniformValue; | ||
} | ||
|
||
if (channel == 4) | ||
{ | ||
return ToGrayScale(color); | ||
} | ||
|
||
return color[channel]; | ||
} | ||
|
||
fixed4 frag(v2f i) : SV_Target | ||
{ | ||
fixed4 output; | ||
|
||
output.r = Sample(tex2D(_MetallicMap, i.uv), _MetallicMapChannel, _MetallicUniform); | ||
output.g = Sample(tex2D(_OcclusionMap, i.uv), _OcclusionMapChannel, _OcclusionUniform); | ||
output.b = Sample(tex2D(_EmissionMap, i.uv), _EmissionMapChannel, _EmissionUniform); | ||
output.a = Sample(tex2D(_SmoothnessMap, i.uv), _SmoothnessMapChannel, _SmoothnessUniform); | ||
|
||
return output; | ||
} | ||
|
||
ENDCG | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...Lens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/ChannelPacker.shader.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/DepthBufferPostProcess.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file. | ||
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented. | ||
|
||
Shader "Mixed Reality Toolkit/Depth Buffer Viewer" | ||
{ | ||
Properties | ||
{ | ||
_DepthTex("Texture", 2D) = "black" {} | ||
_MainTex("Base (RGB)", 2D) = "green" {} | ||
} | ||
|
||
SubShader | ||
{ | ||
Pass | ||
{ | ||
CGPROGRAM | ||
#pragma vertex vert_img | ||
#pragma fragment frag | ||
|
||
#include "UnityCG.cginc" | ||
|
||
uniform sampler2D _MainTex; | ||
sampler2D _DepthTex; | ||
|
||
float4 frag(v2f_img i) : COLOR | ||
{ | ||
return Linear01Depth(SAMPLE_DEPTH_TEXTURE(_DepthTex, i.uv)); | ||
} | ||
ENDCG | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...tingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/DepthBufferPostProcess.shader.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
...loLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/InstancedColored.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file. | ||
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented. | ||
|
||
Shader "Hidden/Instanced-Colored" | ||
{ | ||
Properties | ||
{ | ||
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0) | ||
_ZWrite("ZWrite", Int) = 1.0 // On | ||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Int) = 4.0 // LEqual | ||
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull", Int) = 0.0 // Off | ||
} | ||
|
||
SubShader | ||
{ | ||
Pass | ||
{ | ||
Name "Main" | ||
Tags{ "RenderType" = "Opaque" } | ||
ZWrite[_ZWrite] | ||
ZTest[_ZTest] | ||
Cull[_Cull] | ||
|
||
CGPROGRAM | ||
|
||
#pragma vertex vert | ||
#pragma fragment frag | ||
|
||
#pragma multi_compile_instancing | ||
|
||
#include "UnityCG.cginc" | ||
|
||
struct appdata_t | ||
{ | ||
fixed4 vertex : POSITION; | ||
UNITY_VERTEX_INPUT_INSTANCE_ID | ||
}; | ||
|
||
struct v2f | ||
{ | ||
fixed4 vertex : SV_POSITION; | ||
fixed4 color : COLOR0; | ||
UNITY_VERTEX_OUTPUT_STEREO | ||
}; | ||
|
||
float4x4 _ParentLocalToWorldMatrix; | ||
|
||
UNITY_INSTANCING_BUFFER_START(Props) | ||
UNITY_DEFINE_INSTANCED_PROP(float4, _Color) | ||
UNITY_INSTANCING_BUFFER_END(Props) | ||
|
||
v2f vert(appdata_t v) | ||
{ | ||
v2f o; | ||
UNITY_SETUP_INSTANCE_ID(v); | ||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); | ||
o.vertex = mul(UNITY_MATRIX_VP, mul(_ParentLocalToWorldMatrix, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0)))); | ||
o.color = UNITY_ACCESS_INSTANCED_PROP(Props, _Color); | ||
|
||
return o; | ||
} | ||
|
||
fixed4 frag(v2f i) : SV_Target | ||
{ | ||
return i.color; | ||
} | ||
|
||
ENDCG | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...s2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/InstancedColored.shader.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.