Skip to content

Commit 1be6f4f

Browse files
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
1 parent c8898ef commit 1be6f4f

File tree

80 files changed

+8673
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+8673
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Uu]ser[Ss]ettings/
12+
13+
14+
# Ensure Packages folder included
15+
!/[Pp]ackages/
16+
17+
# MemoryCaptures can get excessive in size.
18+
# They also could contain extremely sensitive data
19+
/[Mm]emoryCaptures/
20+
21+
# Asset meta data should only be ignored when the corresponding asset is also ignored
22+
#!*/[Aa]ssets/**/*.meta
23+
24+
# Recordings can get excessive in size
25+
/[Rr]ecordings/
26+
27+
# Uncomment this line if you wish to ignore the asset store tools plugin
28+
/[Aa]ssets/AssetStoreTools*
29+
30+
# Autogenerated Jetbrains Rider plugin
31+
/[Aa]ssets/Plugins/Editor/JetBrains*
32+
33+
# Visual Studio cache directory
34+
.vs/
35+
36+
# Gradle cache directory
37+
.gradle/
38+
39+
# Autogenerated VS/MD/Consulo solution and project files
40+
ExportedObj/
41+
.consulo/
42+
*.csproj
43+
*.unityproj
44+
*.sln
45+
*.suo
46+
*.tmp
47+
*.user
48+
*.userprefs
49+
*.pidb
50+
*.booproj
51+
*.svd
52+
*.pfx
53+
*.pfx.meta
54+
*.pdb
55+
*.mdb
56+
*.opendb
57+
*.VC.db
58+
.vsconfig
59+
60+
# Unity3D generated meta files
61+
*.pidb.meta
62+
*.pdb.meta
63+
*.mdb.meta
64+
65+
# Unity3D generated file on crash reports
66+
sysinfo.txt
67+
68+
# Builds
69+
*.apk
70+
*.aab
71+
*.unitypackage
72+
*.app
73+
74+
# MRTK Packages
75+
/[Pp]ackages/[Mm]ixed[Rr]eality/
76+
77+
# Crashlytics generated file
78+
crashlytics-build.properties
79+
80+
# Packed Addressables
81+
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
82+
83+
# Temporary auto-generated Android Assets
84+
/[Aa]ssets/[Ss]treamingAssets/aa.meta
85+
/[Aa]ssets/[Ss]treamingAssets/aa/*
86+
87+
/[Aa]ssets/MixedRealityToolkit.Generated*
88+
/[Aa]ssets/TextMesh Pro*

GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
5+
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.
6+
7+
Shader "Hidden/ChannelPacker"
8+
{
9+
Properties
10+
{
11+
_MetallicMap("Metallic Map", 2D) = "black" {}
12+
_MetallicMapChannel("Metallic Map Channel", Int) = 0 // Red.
13+
_MetallicUniform("Metallic Uniform", Float) = -0.01
14+
_OcclusionMap("Occlusion Map", 2D) = "white" {}
15+
_OcclusionMapChannel("Occlusion Map Channel", Int) = 1 // Green.
16+
_OcclusionUniform("Occlusion Uniform", Float) = -0.01
17+
_EmissionMap("Emission Map", 2D) = "black" {}
18+
_EmissionMapChannel("Emission Map Channel", Int) = 4 // RGBAverage.
19+
_EmissionUniform("Emission Uniform", Float) = -0.01
20+
_SmoothnessMap("Smoothness Map", 2D) = "gray" {}
21+
_SmoothnessMapChannel("Smoothness Map Channel", Int) = 3 // Alpha.
22+
_SmoothnessUniform("Smoothness Uniform", Float) = -0.01
23+
}
24+
SubShader
25+
{
26+
Pass
27+
{
28+
CGPROGRAM
29+
30+
#pragma vertex vert
31+
#pragma fragment frag
32+
33+
#include "UnityCG.cginc"
34+
35+
struct appdata
36+
{
37+
float4 vertex : POSITION;
38+
float2 uv : TEXCOORD0;
39+
};
40+
41+
struct v2f
42+
{
43+
float4 vertex : SV_POSITION;
44+
float2 uv : TEXCOORD0;
45+
};
46+
47+
sampler2D _MetallicMap;
48+
int _MetallicMapChannel;
49+
float _MetallicUniform;
50+
sampler2D _OcclusionMap;
51+
int _OcclusionMapChannel;
52+
float _OcclusionUniform;
53+
sampler2D _EmissionMap;
54+
int _EmissionMapChannel;
55+
float _EmissionUniform;
56+
sampler2D _SmoothnessMap;
57+
int _SmoothnessMapChannel;
58+
float _SmoothnessUniform;
59+
60+
v2f vert(appdata v)
61+
{
62+
v2f o;
63+
o.vertex = UnityObjectToClipPos(v.vertex);
64+
o.uv = v.uv;
65+
66+
return o;
67+
}
68+
69+
fixed4 ToGrayScale(fixed4 color)
70+
{
71+
return color.r * 0.21 + color.g * 0.71 + color.b * 0.08;
72+
}
73+
74+
fixed Sample(fixed4 color, int channel, float uniformValue)
75+
{
76+
if (uniformValue >= 0.0)
77+
{
78+
return uniformValue;
79+
}
80+
81+
if (channel == 4)
82+
{
83+
return ToGrayScale(color);
84+
}
85+
86+
return color[channel];
87+
}
88+
89+
fixed4 frag(v2f i) : SV_Target
90+
{
91+
fixed4 output;
92+
93+
output.r = Sample(tex2D(_MetallicMap, i.uv), _MetallicMapChannel, _MetallicUniform);
94+
output.g = Sample(tex2D(_OcclusionMap, i.uv), _OcclusionMapChannel, _OcclusionUniform);
95+
output.b = Sample(tex2D(_EmissionMap, i.uv), _EmissionMapChannel, _EmissionUniform);
96+
output.a = Sample(tex2D(_SmoothnessMap, i.uv), _SmoothnessMapChannel, _SmoothnessUniform);
97+
98+
return output;
99+
}
100+
101+
ENDCG
102+
}
103+
}
104+
}

GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/ChannelPacker.shader.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
5+
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.
6+
7+
Shader "Mixed Reality Toolkit/Depth Buffer Viewer"
8+
{
9+
Properties
10+
{
11+
_DepthTex("Texture", 2D) = "black" {}
12+
_MainTex("Base (RGB)", 2D) = "green" {}
13+
}
14+
15+
SubShader
16+
{
17+
Pass
18+
{
19+
CGPROGRAM
20+
#pragma vertex vert_img
21+
#pragma fragment frag
22+
23+
#include "UnityCG.cginc"
24+
25+
uniform sampler2D _MainTex;
26+
sampler2D _DepthTex;
27+
28+
float4 frag(v2f_img i) : COLOR
29+
{
30+
return Linear01Depth(SAMPLE_DEPTH_TEXTURE(_DepthTex, i.uv));
31+
}
32+
ENDCG
33+
}
34+
}
35+
}

GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/DepthBufferPostProcess.shader.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
5+
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.
6+
7+
Shader "Hidden/Instanced-Colored"
8+
{
9+
Properties
10+
{
11+
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
12+
_ZWrite("ZWrite", Int) = 1.0 // On
13+
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Int) = 4.0 // LEqual
14+
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull", Int) = 0.0 // Off
15+
}
16+
17+
SubShader
18+
{
19+
Pass
20+
{
21+
Name "Main"
22+
Tags{ "RenderType" = "Opaque" }
23+
ZWrite[_ZWrite]
24+
ZTest[_ZTest]
25+
Cull[_Cull]
26+
27+
CGPROGRAM
28+
29+
#pragma vertex vert
30+
#pragma fragment frag
31+
32+
#pragma multi_compile_instancing
33+
34+
#include "UnityCG.cginc"
35+
36+
struct appdata_t
37+
{
38+
fixed4 vertex : POSITION;
39+
UNITY_VERTEX_INPUT_INSTANCE_ID
40+
};
41+
42+
struct v2f
43+
{
44+
fixed4 vertex : SV_POSITION;
45+
fixed4 color : COLOR0;
46+
UNITY_VERTEX_OUTPUT_STEREO
47+
};
48+
49+
float4x4 _ParentLocalToWorldMatrix;
50+
51+
UNITY_INSTANCING_BUFFER_START(Props)
52+
UNITY_DEFINE_INSTANCED_PROP(float4, _Color)
53+
UNITY_INSTANCING_BUFFER_END(Props)
54+
55+
v2f vert(appdata_t v)
56+
{
57+
v2f o;
58+
UNITY_SETUP_INSTANCE_ID(v);
59+
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
60+
o.vertex = mul(UNITY_MATRIX_VP, mul(_ParentLocalToWorldMatrix, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0))));
61+
o.color = UNITY_ACCESS_INSTANCED_PROP(Props, _Color);
62+
63+
return o;
64+
}
65+
66+
fixed4 frag(v2f i) : SV_Target
67+
{
68+
return i.color;
69+
}
70+
71+
ENDCG
72+
}
73+
}
74+
}

GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp/Assets/MRTK/Shaders/InstancedColored.shader.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)