diff options
author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-11-06 15:12:42 -0500 |
---|---|---|
committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-11-06 15:12:42 -0500 |
commit | eb84bb298d2b95aec7b2ae12cbf25ac64f25379a (patch) | |
tree | efd616a157df06ab661c6d56651853431ac6b08b /VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders | |
download | unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.gz unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.bz2 unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.zip |
move to self host
Diffstat (limited to '')
34 files changed, 1290 insertions, 0 deletions
diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders.meta new file mode 100644 index 00000000..440ddd6d --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39a7af7b7f089ff4f965b22e5e064202 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mirror.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mirror.shader new file mode 100644 index 00000000..4597169c --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mirror.shader @@ -0,0 +1,73 @@ +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + +Shader "FX/MirrorReflection" +{ + Properties + { + _MainTex("Base (RGB)", 2D) = "white" {} + [HideInInspector] _ReflectionTex0("", 2D) = "white" {} + [HideInInspector] _ReflectionTex1("", 2D) = "white" {} + } + SubShader + { + Tags{ "RenderType" = "Opaque" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + #include "UnityInstancing.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + sampler2D _ReflectionTex0; + sampler2D _ReflectionTex1; + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 refl : TEXCOORD1; + float4 pos : SV_POSITION; + + UNITY_VERTEX_OUTPUT_STEREO + }; + + v2f vert(appdata v) + { + v2f o; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_OUTPUT(v2f, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.pos = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.refl = ComputeNonStereoScreenPos(o.pos); + + return o; + } + + half4 frag(v2f i) : SV_Target + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + half4 tex = tex2D(_MainTex, i.uv); + half4 refl = unity_StereoEyeIndex == 0 ? tex2Dproj(_ReflectionTex0, UNITY_PROJ_COORD(i.refl)) : tex2Dproj(_ReflectionTex1, UNITY_PROJ_COORD(i.refl)); + return tex * refl; + } + ENDCG + } + } +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mirror.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mirror.shader.meta new file mode 100644 index 00000000..7e73170d --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mirror.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 693137b858e4dc64c83be531351f45e6 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile.meta new file mode 100644 index 00000000..49ab650f --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8558af9681bcb2e41a0a2ba2a060968d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedDiffuse.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedDiffuse.shader new file mode 100644 index 00000000..e609a4ca --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedDiffuse.shader @@ -0,0 +1,45 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Bumped shader. Differences from regular Bumped one: +// - no Main Color +// - Normalmap uses Tiling/Offset of the Base texture +// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "VRChat/Mobile/Bumped Diffuse" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + [NoScaleOffset] _BumpMap ("Normalmap", 2D) = "bump" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 250 + + CGPROGRAM + #pragma target 3.0 + #pragma surface surf Lambert exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask + + UNITY_DECLARE_TEX2D(_MainTex); + UNITY_DECLARE_TEX2D(_BumpMap); + + struct Input + { + float2 uv_MainTex; + float4 color : COLOR; + }; + + void surf (Input IN, inout SurfaceOutput o) + { + fixed4 c = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex); + o.Albedo = c.rgb * IN.color; + o.Alpha = 1.0f; + o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_BumpMap, IN.uv_MainTex)); + } + ENDCG + } + + Fallback "VRChat/Mobile/Diffuse" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedDiffuse.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedDiffuse.shader.meta new file mode 100644 index 00000000..67087959 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedDiffuse.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f8c1f8ac363df824899534a0b30eef00 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedMappedSpecular.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedMappedSpecular.shader new file mode 100644 index 00000000..025c8720 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedMappedSpecular.shader @@ -0,0 +1,54 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Bumped Specular shader. Differences from regular Bumped Specular one: +// - no Main Color nor Specular Color +// - specular lighting directions are approximated per vertex +// - writes zero to alpha channel +// - Normalmap uses Tiling/Offset of the Base texture +// - no Deferred Lighting support +// - no Lightmap support +// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "VRChat/Mobile/Bumped Mapped Specular" +{ + Properties + { + _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} + _Shininess ("Shininess", Range (0.03, 1)) = 0.078125 + _SpecColor ("Specular Color", Color) = (1,1,1,1) + [NoScaleOffset] _BumpMap ("Normalmap", 2D) = "bump" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 250 + + CGPROGRAM + #pragma target 3.0 + #pragma surface surf BlinnPhong exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask + + UNITY_DECLARE_TEX2D(_MainTex); + UNITY_DECLARE_TEX2D(_BumpMap); + half _Shininess; + + struct Input + { + float2 uv_MainTex; + float4 color : COLOR; + }; + + void surf (Input IN, inout SurfaceOutput o) + { + fixed4 tex = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex); + o.Albedo = tex.rgb * IN.color; + o.Gloss = tex.a; + o.Alpha = 1.0f; + o.Specular = _Shininess; + o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_BumpMap, IN.uv_MainTex)); + } + ENDCG + } + + Fallback "VRChat/Mobile/Diffuse" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedMappedSpecular.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedMappedSpecular.shader.meta new file mode 100644 index 00000000..e830488b --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedMappedSpecular.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 528d55c4e8adab14b974ca665ed1b996 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedSpecular.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedSpecular.shader new file mode 100644 index 00000000..4ff96f09 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedSpecular.shader @@ -0,0 +1,64 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Bumped Specular shader. Differences from regular Bumped Specular one: +// - no Main Color nor Specular Color +// - specular lighting directions are approximated per vertex +// - writes zero to alpha channel +// - Normalmap uses Tiling/Offset of the Base texture +// - no Deferred Lighting support +// - no Lightmap support +// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "VRChat/Mobile/Bumped Mapped Specular" +{ + Properties + { + _Shininess ("Shininess", Range (0.03, 1)) = 0.078125 + _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} + [NoScaleOffset] _BumpMap ("Normalmap", 2D) = "bump" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 250 + + CGPROGRAM + #pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd halfasview interpolateview + + inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten) + { + fixed diff = max (0, dot (s.Normal, lightDir)); + fixed nh = max (0, dot (s.Normal, halfDir)); + fixed spec = pow (nh, s.Specular*128) * s.Gloss; + + fixed4 c; + c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten; + UNITY_OPAQUE_ALPHA(c.a); + return c; + } + + sampler2D _MainTex; + sampler2D _BumpMap; + half _Shininess; + + struct Input + { + float2 uv_MainTex; + float4 color : COLOR; + }; + + void surf (Input IN, inout SurfaceOutput o) + { + fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); + o.Albedo = tex.rgb * IN.color; + o.Gloss = tex.a; + o.Alpha = tex.a; + o.Specular = _Shininess; + o.Normal = UnpackNormal (tex2D(_BumpMap, IN.uv_MainTex)); + } + ENDCG + } + + FallBack "Mobile/VertexLit" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedSpecular.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedSpecular.shader.meta new file mode 100644 index 00000000..e840308d --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-BumpedSpecular.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 584dc70fbb9834e48beb29e3206e3ca0 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Diffuse.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Diffuse.shader new file mode 100644 index 00000000..0756948b --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Diffuse.shader @@ -0,0 +1,41 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Diffuse shader. Differences from regular Diffuse one: +// - no Main Color +// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "VRChat/Mobile/Diffuse" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 150 + + CGPROGRAM + #pragma target 3.0 + #pragma surface surf Lambert exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask + + UNITY_DECLARE_TEX2D(_MainTex); + + struct Input + { + float2 uv_MainTex; + float4 color : COLOR; + }; + + void surf (Input IN, inout SurfaceOutput o) + { + fixed4 c = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex); + o.Albedo = c.rgb * IN.color; + o.Alpha = 1.0f; + } + ENDCG + } + + FallBack "Diffuse" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Diffuse.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Diffuse.shader.meta new file mode 100644 index 00000000..30aae2b5 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Diffuse.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2dcd9e0568e0a6f45b92c60ba2eb16a0 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Lightmapped.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Lightmapped.shader new file mode 100644 index 00000000..2b03d6c0 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Lightmapped.shader @@ -0,0 +1,121 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Unlit shader. Simplest possible textured shader. +// - SUPPORTS lightmap +// - no lighting +// - no per-material color + +Shader "VRChat/Mobile/Lightmapped" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + // Non-lightmapped + Pass + { + Tags { "LightMode" = "Vertex" } + Lighting Off + SetTexture [_MainTex] + { + constantColor (1,1,1,1) + combine texture, constant // UNITY_OPAQUE_ALPHA_FFP + } + } + + // Lightmapped + Pass + { + Tags{ "LIGHTMODE" = "VertexLM" "RenderType" = "Opaque" } + + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + #include "UnityCG.cginc" + #pragma multi_compile_fog + #define USING_FOG (defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)) + + // uniforms + float4 _MainTex_ST; + + // vertex shader input data + struct appdata + { + float3 pos : POSITION; + float3 uv1 : TEXCOORD1; + float3 uv0 : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + // vertex-to-fragment interpolators + struct v2f + { + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; +#if USING_FOG + fixed fog : TEXCOORD2; +#endif + float4 pos : SV_POSITION; + UNITY_VERTEX_OUTPUT_STEREO + }; + + // vertex shader + v2f vert(appdata IN) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + // compute texture coordinates + o.uv0 = IN.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.uv1 = IN.uv0.xy * _MainTex_ST.xy + _MainTex_ST.zw; + + // fog +#if USING_FOG + float3 eyePos = UnityObjectToViewPos(float4(IN.pos, 1)); + float fogCoord = length(eyePos.xyz); // radial fog distance + UNITY_CALC_FOG_FACTOR_RAW(fogCoord); + o.fog = saturate(unityFogFactor); +#endif + + // transform position + o.pos = UnityObjectToClipPos(IN.pos); + return o; + } + + // textures + sampler2D _MainTex; + + // fragment shader + fixed4 frag(v2f IN) : SV_Target + { + fixed4 col, tex; + + // Fetch lightmap + half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, IN.uv0.xy); + col.rgb = DecodeLightmap(bakedColorTex); + + // Fetch color texture + tex = tex2D(_MainTex, IN.uv1.xy); + col.rgb = tex.rgb * col.rgb; + col.a = 1; + + // fog +#if USING_FOG + col.rgb = lerp(unity_FogColor.rgb, col.rgb, IN.fog); +#endif + return col; + } + + ENDCG + } + } +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Lightmapped.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Lightmapped.shader.meta new file mode 100644 index 00000000..5a077339 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Lightmapped.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b1f7ecc80417c414b9d62ce541d5bcbf +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-MatCapLit.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-MatCapLit.shader new file mode 100644 index 00000000..574a5914 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-MatCapLit.shader @@ -0,0 +1,119 @@ +// VRChat MatCapLit shader, based on Unity's Mobile/Diffuse. Copyright (c) 2019 VRChat. + +// Simple MatCapLit shader. +// -fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "VRChat/Mobile/MatCap Lit" +{ + Properties + { + _MainTex("Texture", 2D) = "white" {} + _MatCap ("MatCap (RGB)", 2D) = "white" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" "Queue"="Geometry" } + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile_fwdbase + #pragma multi_compile_instancing + #pragma skip_variants SHADOWS_SHADOWMASK SHADOWS_SCREEN SHADOWS_DEPTH SHADOWS_CUBE + + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + struct VertexInput + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + float3 normal : NORMAL; + float4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + float4 worldPos : TEXCOORD1; + float4 color : TEXCOORD2; + float4 indirect : TEXCOORD3; + float4 direct : TEXCOORD4; + float2 matcapUV : TEXCOORD5; + SHADOW_COORDS(7) + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + UNITY_DECLARE_TEX2D(_MainTex); + half4 _MainTex_ST; + + UNITY_DECLARE_TEX2D(_MatCap); + + float2 matcapSample(float3 viewDirection, float3 normalDirection) + { + half3 worldUp = float3(0,1,0); + half3 worldViewUp = normalize(worldUp - viewDirection * dot(viewDirection, worldUp)); + half3 worldViewRight = normalize(cross(viewDirection, worldViewUp)); + half2 matcapUV = half2(dot(worldViewRight, normalDirection), dot(worldViewUp, normalDirection)) * 0.5 + 0.5; + return matcapUV; + } + + VertexOutput vert (VertexInput v) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_OUTPUT(VertexOutput, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.pos = UnityObjectToClipPos(v.vertex); + o.worldPos = mul(unity_ObjectToWorld, v.vertex); + o.uv = v.uv; + + half3 indirectDiffuse = ShadeSH9(float4(0, 0, 0, 1)); // We don't care about anything other than the color from GI, so only feed in 0,0,0, rather than the normal + half4 lightCol = _LightColor0; + + //If we don't have a directional light or realtime light in the scene, we can derive light color from a slightly modified indirect color. + int lightEnv = int(any(_WorldSpaceLightPos0.xyz)); + if(lightEnv != 1) + lightCol = indirectDiffuse.xyzz * 0.2; + + float4 lighting = lightCol; + + o.color = v.color; + o.direct = lighting; + o.indirect = indirectDiffuse.xyzz; + + float3 worldNorm = normalize(unity_WorldToObject[0].xyz * v.normal.x + unity_WorldToObject[1].xyz * v.normal.y + unity_WorldToObject[2].xyz * v.normal.z); + worldNorm = mul((float3x3)UNITY_MATRIX_V, worldNorm); + o.matcapUV = matcapSample(normalize(_WorldSpaceCameraPos - o.worldPos), UnityObjectToWorldNormal(v.normal)); //worldNorm.xy * 0.5 + 0.5; + + TRANSFER_SHADOW(o); + return o; + } + + float4 frag (VertexOutput i, float facing : VFACE) : SV_Target + { + UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz); + + float4 albedo = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)); + float4 mc = UNITY_SAMPLE_TEX2D(_MatCap, i.matcapUV); + half4 final = (albedo * i.color * mc) * (i.direct * attenuation + i.indirect); + + return float4(final.rgb, 1); + } + ENDCG + } + } + + Fallback "VRChat/Mobile/Diffuse" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-MatCapLit.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-MatCapLit.shader.meta new file mode 100644 index 00000000..e885dfa2 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-MatCapLit.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ad043b7f9839cb48a75a9238d433dec +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Add.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Add.shader new file mode 100644 index 00000000..3e7cce34 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Add.shader @@ -0,0 +1,43 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Additive Particle shader. Differences from regular Additive Particle one: +// - no Tint color +// - no Smooth particle support +// - no AlphaTest +// - no ColorMask + +Shader "VRChat/Mobile/Particles/Additive" +{ + Properties + { + _MainTex ("Particle Texture", 2D) = "white" {} + } + + Category + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + Blend SrcAlpha One + Cull Off + Lighting Off + ZWrite Off + Fog { Color (0,0,0,0) } + + BindChannels + { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord + } + + SubShader + { + Pass + { + SetTexture [_MainTex] + { + combine texture * primary + } + } + } + } +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Add.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Add.shader.meta new file mode 100644 index 00000000..65366540 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Add.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9200bec112b65ec4fbbbd33fa89c20f4 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Alpha.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Alpha.shader new file mode 100644 index 00000000..60c5a8c6 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Alpha.shader @@ -0,0 +1,43 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Alpha Blended Particle shader. Differences from regular Alpha Blended Particle one: +// - no Tint color +// - no Smooth particle support +// - no AlphaTest +// - no ColorMask + +Shader "VRChat/Mobile/Particles/Alpha Blended" +{ + Properties + { + _MainTex ("Particle Texture", 2D) = "white" {} + } + + Category + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + Blend SrcAlpha OneMinusSrcAlpha + Cull Off + Lighting Off + ZWrite Off + Fog { Color (0,0,0,0) } + + BindChannels + { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord + } + + SubShader + { + Pass + { + SetTexture [_MainTex] + { + combine texture * primary + } + } + } + } +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Alpha.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Alpha.shader.meta new file mode 100644 index 00000000..e6b70f56 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Alpha.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8b39b95ac85682040beff730e0cfc77a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Multiply.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Multiply.shader new file mode 100644 index 00000000..d46c78a3 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Multiply.shader @@ -0,0 +1,47 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Simplified Multiply Particle shader. Differences from regular Multiply Particle one: +// - no Smooth particle support +// - no AlphaTest +// - no ColorMask + +Shader "VRChat/Mobile/Particles/Multiply" +{ + Properties + { + _MainTex ("Particle Texture", 2D) = "white" {} + } + + Category + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + Blend Zero SrcColor + Cull Off + Lighting Off + ZWrite Off + Fog { Color (1,1,1,1) } + + BindChannels + { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord + } + + SubShader + { + Pass + { + SetTexture [_MainTex] + { + combine texture * primary + } + SetTexture [_MainTex] + { + constantColor (1,1,1,1) + combine previous lerp (previous) constant + } + } + } + } +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Multiply.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Multiply.shader.meta new file mode 100644 index 00000000..20410047 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Particle-Multiply.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5b89f0c74ccf5049ba803c14a090378 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Skybox.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Skybox.shader new file mode 100644 index 00000000..fa3e8936 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Skybox.shader @@ -0,0 +1,73 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +Shader "VRChat/Mobile/Skybox" +{ + Properties + { + _Rotation ("Rotation", Range(0, 360)) = 0 + [NoScaleOffset] _Tex ("Cubemap", Cube) = "grey" {} + } + + SubShader + { + Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" } + Cull Off + ZWrite Off + + Pass + { + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + + samplerCUBE _Tex; + float _Rotation; + + float3 RotateAroundYInDegrees (float3 vertex, float degrees) + { + float alpha = degrees * UNITY_PI / 180.0; + float sina, cosa; + sincos(alpha, sina, cosa); + float2x2 m = float2x2(cosa, -sina, sina, cosa); + return float3(mul(m, vertex.xz), vertex.y).xzy; + } + + struct appdata_t + { + float4 vertex : POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float4 vertex : SV_POSITION; + float3 texcoord : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + v2f vert (appdata_t v) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + float3 rotated = RotateAroundYInDegrees(v.vertex, _Rotation); + o.vertex = UnityObjectToClipPos(rotated); + o.texcoord = v.vertex.xyz; + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + half4 tex = texCUBE(_Tex, i.texcoord); + return tex; + } + ENDCG + } + } + + Fallback Off +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Skybox.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Skybox.shader.meta new file mode 100644 index 00000000..eace8686 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-Skybox.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c0d3cb006bb294142bef136f492f2568 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-StandardLite.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-StandardLite.shader new file mode 100644 index 00000000..08450aa0 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-StandardLite.shader @@ -0,0 +1,168 @@ +Shader "VRChat/Mobile/Standard Lite" +{ + Properties + { + _MainTex("Albedo", 2D) = "white" {} + _Color("Color", Color) = (1,1,1,1) + + [NoScaleOffset] _MetallicGlossMap("Metallic(R) Smoothness(A) Map", 2D) = "white" {} + [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 1.0 + _Glossiness("Smoothness", Range(0.0, 1.0)) = 1.0 + + [NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {} + + [Toggle(_EMISSION)]_EnableEmission("Enable Emission", int) = 0 + [NoScaleOffset] _EmissionMap("Emission", 2D) = "white" {} + _EmissionColor("Emission Color", Color) = (1,1,1) + + [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 0 + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 200 + + CGPROGRAM + #define UNITY_BRDF_PBS BRDF2_Unity_PBS + #include "UnityPBSLighting.cginc" + + #pragma surface surf StandardMobile exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask + + #pragma target 3.0 + #pragma multi_compile _ _EMISSION + #pragma multi_compile _ _SPECULARHIGHLIGHTS_OFF + #pragma multi_compile _GLOSSYREFLECTIONS_OFF + + // ------------------------------------- + + struct Input + { + float2 uv_MainTex; + float4 color : COLOR; + }; + + struct SurfaceOutputStandardMobile + { + fixed3 Albedo; // base (diffuse or specular) color + float3 Normal; // tangent space normal, if written + half3 Emission; + half Metallic; // 0=non-metal, 1=metal + // Smoothness is the user facing name, it should be perceptual smoothness but user should not have to deal with it. + // Everywhere in the code you meet smoothness it is perceptual smoothness + half Smoothness; // 0=rough, 1=smooth + fixed Alpha; // alpha for transparencies + }; + + UNITY_DECLARE_TEX2D(_MainTex); + half4 _Color; + + UNITY_DECLARE_TEX2D(_MetallicGlossMap); + uniform half _Glossiness; + uniform half _Metallic; + + UNITY_DECLARE_TEX2D(_BumpMap); + uniform half _BumpScale; + + UNITY_DECLARE_TEX2D(_EmissionMap); + half4 _EmissionColor; + + // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader. + // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing. + // #pragma instancing_options assumeuniformscaling + UNITY_INSTANCING_BUFFER_START(Props) + // put more per-instance properties here + UNITY_INSTANCING_BUFFER_END(Props) + + // ------------------------------------- + + inline half4 LightingStandardMobile(SurfaceOutputStandardMobile s, float3 viewDir, UnityGI gi) + { + s.Normal = normalize(s.Normal); + + half oneMinusReflectivity; + half3 specColor; + s.Albedo = DiffuseAndSpecularFromMetallic(s.Albedo, s.Metallic, /*out*/ specColor, /*out*/ oneMinusReflectivity); + + half4 c = UNITY_BRDF_PBS(s.Albedo, specColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect); + UNITY_OPAQUE_ALPHA(c.a); + return c; + } + + inline UnityGI UnityGI_BaseMobile(UnityGIInput data, half3 normalWorld) + { + UnityGI o_gi; + ResetUnityGI(o_gi); + + o_gi.light = data.light; + o_gi.light.color *= data.atten; + + #if UNITY_SHOULD_SAMPLE_SH + o_gi.indirect.diffuse = ShadeSHPerPixel(normalWorld, data.ambient, data.worldPos); + #endif + + #if defined(LIGHTMAP_ON) + // Baked lightmaps + half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, data.lightmapUV.xy); + half3 bakedColor = DecodeLightmap(bakedColorTex); + + #ifdef DIRLIGHTMAP_COMBINED + fixed4 bakedDirTex = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, data.lightmapUV.xy); + o_gi.indirect.diffuse += DecodeDirectionalLightmap(bakedColor, bakedDirTex, normalWorld); + #else // not directional lightmap + o_gi.indirect.diffuse += bakedColor; + #endif + #endif + + return o_gi; + } + + inline half3 UnityGI_IndirectSpecularMobile(UnityGIInput data, Unity_GlossyEnvironmentData glossIn) + { + half3 specular; + + #ifdef _GLOSSYREFLECTIONS_OFF + specular = unity_IndirectSpecColor.rgb; + #else + half3 env0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE(unity_SpecCube0), data.probeHDR[0], glossIn); + specular = env0; + #endif + + return specular; + } + + inline UnityGI UnityGlobalIlluminationMobile(UnityGIInput data, half3 normalWorld, Unity_GlossyEnvironmentData glossIn) + { + UnityGI o_gi = UnityGI_BaseMobile(data, normalWorld); + o_gi.indirect.specular = UnityGI_IndirectSpecularMobile(data, glossIn); + return o_gi; + } + + inline void LightingStandardMobile_GI(SurfaceOutputStandardMobile s, UnityGIInput data, inout UnityGI gi) + { + Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(s.Smoothness, data.worldViewDir, s.Normal, lerp(unity_ColorSpaceDielectricSpec.rgb, s.Albedo, s.Metallic)); + gi = UnityGlobalIlluminationMobile(data, s.Normal, g); + } + + void surf(Input IN, inout SurfaceOutputStandardMobile o) + { + // Albedo comes from a texture tinted by color + half4 albedoMap = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex) * _Color * IN.color; + o.Albedo = albedoMap.rgb; + + // Metallic and smoothness come from slider variables + half4 metallicGlossMap = UNITY_SAMPLE_TEX2D(_MetallicGlossMap, IN.uv_MainTex); + o.Metallic = metallicGlossMap.r * _Metallic; + o.Smoothness = metallicGlossMap.a * _Glossiness; + + o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_BumpMap, IN.uv_MainTex)); + + #ifdef _EMISSION + o.Emission = UNITY_SAMPLE_TEX2D(_EmissionMap, IN.uv_MainTex) * _EmissionColor; + #endif + } + ENDCG + } + + FallBack "VRChat/Mobile/Diffuse" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-StandardLite.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-StandardLite.shader.meta new file mode 100644 index 00000000..1bd71e47 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-StandardLite.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0b7113dea2069fc4e8943843eff19f70 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-ToonLit.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-ToonLit.shader new file mode 100644 index 00000000..878cec11 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-ToonLit.shader @@ -0,0 +1,90 @@ +// VRChat Toon shader, based on Unity's Mobile/Diffuse. Copyright (c) 2019 VRChat. +//Partially derived from "XSToon" (MIT License) - Copyright (c) 2019 thexiexe@gmail.com +// Simplified Toon shader. +// -fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "VRChat/Mobile/Toon Lit" +{ + Properties + { + _MainTex("Texture", 2D) = "white" {} + } + + SubShader + { + Tags { "RenderType"="Opaque" "Queue"="Geometry" } + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile_fwdbase + #pragma skip_variants SHADOWS_SHADOWMASK SHADOWS_SCREEN SHADOWS_DEPTH SHADOWS_CUBE + + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + struct VertexInput + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + float4 color : COLOR; + }; + + struct VertexOutput + { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + float4 worldPos : TEXCOORD1; + float4 color : TEXCOORD2; + float4 indirect : TEXCOORD3; + float4 direct : TEXCOORD4; + SHADOW_COORDS(5) + }; + + UNITY_DECLARE_TEX2D(_MainTex); + half4 _MainTex_ST; + + VertexOutput vert (VertexInput v) + { + VertexOutput o; + o.pos = UnityObjectToClipPos(v.vertex); + o.worldPos = mul(unity_ObjectToWorld, v.vertex); + o.uv = v.uv; + + half3 indirectDiffuse = ShadeSH9(float4(0, 0, 0, 1)); // We don't care about anything other than the color from GI, so only feed in 0,0,0, rather than the normal + half4 lightCol = _LightColor0; + + //If we don't have a directional light or realtime light in the scene, we can derive light color from a slightly modified indirect color. + int lightEnv = int(any(_WorldSpaceLightPos0.xyz)); + if(lightEnv != 1) + lightCol = indirectDiffuse.xyzz * 0.2; + + float4 lighting = lightCol; + + o.color = v.color; + o.direct = lighting; + o.indirect = indirectDiffuse.xyzz; + TRANSFER_SHADOW(o); + return o; + } + + float4 frag (VertexOutput i, float facing : VFACE) : SV_Target + { + UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz); + + float4 albedo = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)); + half4 final = (albedo * i.color) * (i.direct * attenuation + i.indirect); + + return float4(final.rgb, 1); + } + ENDCG + } + } + Fallback "VRChat/Mobile/Diffuse" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-ToonLit.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-ToonLit.shader.meta new file mode 100644 index 00000000..50a9c7d9 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Mobile/VRChat-Mobile-ToonLit.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: affc81f3d164d734d8f13053effb1c5c +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Default.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Default.shader new file mode 100644 index 00000000..71ccdcb2 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Default.shader @@ -0,0 +1,45 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +Shader "VRChat/Sprites/Default" +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 + [HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1) + [HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1) + [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} + [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Cull Off + Lighting Off + ZWrite Off + Blend One OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex SpriteVert + #pragma fragment SpriteFrag + #pragma target 2.0 + #pragma multi_compile_instancing + #pragma multi_compile _ PIXELSNAP_ON + #pragma multi_compile _ ETC1_EXTERNAL_ALPHA + #include "UnitySprites.cginc" + ENDCG + } + } +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Default.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Default.shader.meta new file mode 100644 index 00000000..50c0b1d4 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Default.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f8fef09682fab74fb7a29d783391edb +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Diffuse.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Diffuse.shader new file mode 100644 index 00000000..556e726f --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Diffuse.shader @@ -0,0 +1,66 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +Shader "VRChat/Sprites/Diffuse" +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 + [HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1) + [HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1) + [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} + [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Cull Off + Lighting Off + ZWrite Off + Blend One OneMinusSrcAlpha + + CGPROGRAM + #pragma surface surf Lambert vertex:vert nofog nolightmap nodynlightmap keepalpha noinstancing + #pragma multi_compile _ PIXELSNAP_ON + #pragma multi_compile _ ETC1_EXTERNAL_ALPHA + #include "UnitySprites.cginc" + + struct Input + { + float2 uv_MainTex; + fixed4 color; + }; + + void vert (inout appdata_full v, out Input o) + { + v.vertex.xy *= _Flip.xy; + + #if defined(PIXELSNAP_ON) + v.vertex = UnityPixelSnap (v.vertex); + #endif + + UNITY_INITIALIZE_OUTPUT(Input, o); + o.color = v.color * _Color * _RendererColor; + } + + void surf (Input IN, inout SurfaceOutput o) + { + fixed4 c = SampleSpriteTexture (IN.uv_MainTex) * IN.color; + o.Albedo = c.rgb * c.a; + o.Alpha = c.a; + } + ENDCG + } + +Fallback "Transparent/VertexLit" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Diffuse.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Diffuse.shader.meta new file mode 100644 index 00000000..9e82d7c1 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/VRChat-Sprites-Diffuse.shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ae8ad653e1d98940bbc79866b9170f3 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Video-RealtimeEmissiveGamma.shader b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Video-RealtimeEmissiveGamma.shader new file mode 100644 index 00000000..d5cab373 --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Video-RealtimeEmissiveGamma.shader @@ -0,0 +1,53 @@ +// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax. + +Shader "Video/RealtimeEmissiveGamma" { + Properties { + _MainTex ("Emissive (RGB)", 2D) = "white" {} + _Emission ("Emission Scale", Float) = 1 + [Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0 + } + SubShader { + Tags { "RenderType"="Opaque" } + LOD 200 + + CGPROGRAM + // Physically based Standard lighting model, and enable shadows on all light types +#pragma surface surf Standard fullforwardshadows + + // Use shader model 3.0 target, to get nicer looking lighting +#pragma target 3.0 +#pragma shader_feature _EMISSION +#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA + + fixed _Emission; + sampler2D _MainTex; + + struct Input { + float2 uv_MainTex; + }; + + // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader. + // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing. + // #pragma instancing_options assumeuniformscaling + UNITY_INSTANCING_BUFFER_START(Props) + // put more per-instance properties here + UNITY_INSTANCING_BUFFER_END(Props) + + void surf (Input IN, inout SurfaceOutputStandard o) { + // emissive comes from texture + fixed4 e = tex2D (_MainTex, IN.uv_MainTex); + o.Albedo = fixed4(0,0,0,0); + o.Alpha = e.a; + +#if APPLY_GAMMA + e.rgb = pow(e.rgb,2.2); +#endif + o.Emission = e * _Emission; + o.Metallic = 0; + o.Smoothness = 0; + } + ENDCG + } + FallBack "Diffuse" + CustomEditor "RealtimeEmissiveGammaGUI" +} diff --git a/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Video-RealtimeEmissiveGamma.shader.meta b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Video-RealtimeEmissiveGamma.shader.meta new file mode 100644 index 00000000..7ca2777e --- /dev/null +++ b/VRCSDK3Worlds/Assets/VRCSDK/Sample Assets/Shaders/Video-RealtimeEmissiveGamma.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9788d723ed7eac946a9a599e4a6ba940 +timeCreated: 1528872578 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: |