Skip to content

Commit

Permalink
feat. initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-Yulin committed Apr 2, 2024
0 parents commit 94e01dd
Show file tree
Hide file tree
Showing 179 changed files with 23,784 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# 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
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.app

# 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/*
6 changes: 6 additions & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
8 changes: 8 additions & 0 deletions Assets/MRTK.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MRTK/Shaders.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions Assets/MRTK/Shaders/ChannelPacker.shader
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 Assets/MRTK/Shaders/ChannelPacker.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions Assets/MRTK/Shaders/DepthBufferPostProcess.shader
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 Assets/MRTK/Shaders/DepthBufferPostProcess.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions Assets/MRTK/Shaders/InstancedColored.shader
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 Assets/MRTK/Shaders/InstancedColored.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 94e01dd

Please sign in to comment.