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 /VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06 | |
| download | unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.gz unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.bz2 unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.zip | |
move to self host
Diffstat (limited to 'VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06')
126 files changed, 8153 insertions, 0 deletions
diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets.meta new file mode 100644 index 00000000..8b1b0347 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a48ec6baa160e64baf2aa5a117ed07f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources.meta new file mode 100644 index 00000000..b9e36eb8 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9030c8e3c966a614b81b094f39776168 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi.meta new file mode 100644 index 00000000..8fa50b8d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e358698c8e859e94fbbda54a4428795c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders.meta new file mode 100644 index 00000000..c3927baa --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3fe973e1c127384aaedd911261dad0f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon.meta new file mode 100644 index 00000000..50dfc610 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d2f20f9c03e4c514a9faf9c679ada849 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes.meta new file mode 100644 index 00000000..6baace70 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4bc74a6ac74a9bc43bfdb320832fbb67 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiAlphaToCoverage.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiAlphaToCoverage.cginc new file mode 100644 index 00000000..42eb0e1b --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiAlphaToCoverage.cginc @@ -0,0 +1,32 @@ +#ifndef POI_ALPHA_TO_COVERAGE + #define POI_ALPHA_TO_COVERAGE + + half _MainMipScale; + float _MainAlphaToCoverage; + + float CalcMipLevel(float2 texture_coord) + { + float2 dx = ddx(texture_coord); + float2 dy = ddy(texture_coord); + float delta_max_sqr = max(dot(dx, dx), dot(dy, dy)); + + return 0.5 * log2(delta_max_sqr); + } + + void ApplyAlphaToCoverage(inout float4 finalColor) + { + // Force Model Opacity to 1 if desired + + if (float(1) == 1) + { + + if(float(0)) + { + // rescale alpha by mip level + finalColor.a *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * float4(0.0004882813,0.0004882813,2048,2048).zw)) * float(0.25); + // rescale alpha by partial derivative + finalColor.a = (finalColor.a - float(0.5)) / max(fwidth(finalColor.a), 0.0001) + float(0.5); + } + } + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiAlphaToCoverage.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiAlphaToCoverage.cginc.meta new file mode 100644 index 00000000..5fcd5bef --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiAlphaToCoverage.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 16bec5ba4f9ab9b44a79ff401107c4b0 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBackFace.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBackFace.cginc new file mode 100644 index 00000000..e529136f --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBackFace.cginc @@ -0,0 +1,32 @@ +#ifndef POI_BACKFACE + #define POI_BACKFACE + + float _BackFaceEnabled; + float _BackFaceTextureUV; + float _BackFaceDetailIntensity; + float _BackFaceEmissionStrength; + float2 _BackFacePanning; + float _BackFaceHueShift; + float4 _BackFaceColor; + UNITY_DECLARE_TEX2D_NOSAMPLER(_BackFaceTexture); float4 _BackFaceTexture_ST; + + float3 BackFaceColor; + void applyBackFaceTexture(inout float backFaceDetailIntensity, inout float mixedHueShift, inout float4 albedo, inout float3 backFaceEmission) + { + backFaceEmission = 0; + BackFaceColor = 0; + + if (float(0)) + { + if(!poiMesh.isFrontFace) + { + albedo = POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float4(1,1,1,1); + backFaceDetailIntensity = float(1); + BackFaceColor = albedo.rgb; + mixedHueShift = float(0); + backFaceEmission = BackFaceColor * float(0); + } + } + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBackFace.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBackFace.cginc.meta new file mode 100644 index 00000000..d4414b56 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBackFace.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 093400a109a171649a232498c1daa0d3 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlackLight.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlackLight.cginc new file mode 100644 index 00000000..750364ae --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlackLight.cginc @@ -0,0 +1,54 @@ +#ifndef POI_BLACKLIGHT + #define POI_BLACKLIGHT + + float4 _BlackLightMaskStart; + float4 _BlackLightMaskEnd; + float4 _BlackLightMaskKeys; + float _BlackLightMaskDebug; + float _BlackLightMaskDissolve; + float _BlackLightMaskMetallic; + float _BlackLightMaskClearCoat; + float _BlackLightMaskMatcap; + float _BlackLightMaskMatcap2; + float _BlackLightMaskEmission; + float _BlackLightMaskEmission2; + float _BlackLightMaskFlipbook; + float _BlackLightMaskPanosphere; + float _BlackLightMaskIridescence; + + half _BlackLightMaskGlitter; + + half4 blackLightMask; + + void createBlackLightMask() + { + blackLightMask = 0; + #ifdef VERTEXLIGHT_ON + + for (int lightIndex = 0; lightIndex < 4; lightIndex ++) + { + float3 lightPos = float3(unity_4LightPosX0[lightIndex], unity_4LightPosY0[lightIndex], unity_4LightPosZ0[lightIndex]); + if (!distance(unity_LightColor[lightIndex].rgb, float3(0, 0, 0))) + { + for (int maskIndex = 0; maskIndex < 4; maskIndex ++) + { + float4 comparison = _BlackLightMaskKeys; + if(unity_LightColor[lightIndex].a == comparison[maskIndex]) + { + blackLightMask[maskIndex] = max(blackLightMask[maskIndex], smoothstep(_BlackLightMaskEnd[maskIndex], _BlackLightMaskStart[maskIndex], distance(poiMesh.worldPos, lightPos))); + } + } + } + } + #endif + } +#endif + +/* +#ifdef POI_BLACKLIGHT + if (_BlackLightMaskDissolve != 4) + { + blackLightMask[mask]; + } +#endif +*/ diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlackLight.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlackLight.cginc.meta new file mode 100644 index 00000000..92d4ae01 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlackLight.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ac357071812a0cf4fac77b3eb2515f62 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlending.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlending.cginc new file mode 100644 index 00000000..f87ae6dc --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlending.cginc @@ -0,0 +1,39 @@ +#ifndef POI_BLENDING + #define POI_BLENDING + + /* + 0: Zero float4(0.0, 0.0, 0.0, 0.0), + 1: One float4(1.0, 1.0, 1.0, 1.0), + 2: DstColor destinationColor, + 3: SrcColor sourceColor, + 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor, + 5: SrcAlpha sourceColor.aaaa, + 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor, + 7: DstAlpha destinationColor.aaaa, + 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor., + 9: SrcAlphaSaturate saturate(sourceColor.aaaa), + 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa, + */ + + float4 poiBlend(const float sourceFactor, const float4 sourceColor, const float destinationFactor, const float4 destinationColor, const float4 blendFactor) + { + float4 sA = 1-blendFactor; + const float4 blendData[11] = { + float4(0.0, 0.0, 0.0, 0.0), + float4(1.0, 1.0, 1.0, 1.0), + destinationColor, + sourceColor, + float4(1.0, 1.0, 1.0, 1.0) - destinationColor, + sA, + float4(1.0, 1.0, 1.0, 1.0) - sourceColor, + sA, + float4(1.0, 1.0, 1.0, 1.0) - sA, + saturate(sourceColor.aaaa), + 1 - sA, + }; + + return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor,sourceColor, sA); + } + +#endif + diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlending.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlending.cginc.meta new file mode 100644 index 00000000..9dea5446 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBlending.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0073d570060edda48a6fc1fe39a93697 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBulge.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBulge.cginc new file mode 100644 index 00000000..6e4db3fc --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBulge.cginc @@ -0,0 +1,34 @@ +#ifndef POI_BULGE + #define POI_BULGE + + + sampler2D _BulgeMask; + float _BuldgeFadeLength; + float _BuldgeHeight; + + void bulgyWolgy(inout v2f o) + { + float depth = DecodeFloatRG(tex2Dlod(_CameraDepthTexture, float4(o.grabPos.xy / o.grabPos.w, 0, 0))); + float bulgeMask = tex2Dlod(_BulgeMask, float4(o.uv0.xy, 0, 0)); + depth = Linear01Depth(depth); + + float intersect = 0; + if (depth != 1) + { + float diff = distance(depth, Linear01Depth(o.pos.z / o.pos.w)); + if(diff > 0) + { + intersect = 1 - smoothstep(0, _ProjectionParams.w * _BuldgeFadeLength, diff); + } + } + float4 offset = intersect * _BuldgeHeight * float4(o.normal, 0); + + offset = IsInMirror() ? 0: offset; + offset *= bulgeMask; + + o.worldPos = mul(unity_ObjectToWorld, o.localPos) + offset; + o.localPos = mul(unity_WorldToObject, o.worldPos); + o.pos = UnityObjectToClipPos(o.localPos); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBulge.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBulge.cginc.meta new file mode 100644 index 00000000..5e92626a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiBulge.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7d773442108354747a06a6c733bd9d13 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiClearCoat.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiClearCoat.cginc new file mode 100644 index 00000000..5adf7340 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiClearCoat.cginc @@ -0,0 +1,108 @@ +#ifndef POI_CLEARCOAT + #define POI_CLEARCOAT + + samplerCUBE _ClearCoatCubeMap; + float _ClearCoatSampleWorld; + POI_TEXTURE_NOSAMPLER(_ClearCoatMask); + POI_TEXTURE_NOSAMPLER(_ClearCoatSmoothnessMap); + float _ClearCoatInvertSmoothness; + float _ClearCoat; + float _ClearCoatSmoothness; + float3 _ClearCoatTint; + float _ClearCoatNormalToUse; + float _ClearCoatForceLighting; + float lighty_clear_boy_uwu_var; + + + float3 CalculateClearCoatEnvironmentalReflections() + { + float3 reflectionColor; + + float smoothnessMap = (POI2D_SAMPLER_PAN(_ClearCoatSmoothnessMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0))); + if (float(0) == 1) + { + smoothnessMap = 1 - smoothnessMap; + } + smoothnessMap *= float(0); + float roughness = 1 - smoothnessMap; + + lighty_clear_boy_uwu_var = 0; + + float3 reflectedDir = float(0) == 0 ? poiCam.vertexReflectionDir: poiCam.reflectionDir; + + float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS); + bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0; + + + if(float(0) == 0 && no_probe == 0) + { + + Unity_GlossyEnvironmentData envData; + envData.roughness = roughness; + envData.reflUVW = BoxProjection( + reflectedDir, poiMesh.worldPos.xyz, + unity_SpecCube0_ProbePosition, + unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax + ); + float3 probe0 = Unity_GlossyEnvironment( + UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData + ); + envData.reflUVW = BoxProjection( + reflectedDir, poiMesh.worldPos.xyz, + unity_SpecCube1_ProbePosition, + unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax + ); + + float interpolator = unity_SpecCube0_BoxMin.w; + + if(interpolator < 0.99999) + { + float3 probe1 = Unity_GlossyEnvironment( + UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), + unity_SpecCube0_HDR, envData + ); + reflectionColor = lerp(probe1, probe0, interpolator); + } + else + { + reflectionColor = probe0; + } + } + else + { + lighty_clear_boy_uwu_var = 1; + reflectionColor = texCUBElod(_ClearCoatCubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS)); + } + + if(float(0)) + { + lighty_clear_boy_uwu_var = 1; + } + + return reflectionColor * float4(1,1,1,1); + } + + void calculateAndApplyClearCoat(inout float4 finalColor) + { + half clearCoatMap = POI2D_SAMPLER_PAN(_ClearCoatMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + #ifdef POI_BLACKLIGHT + if(_BlackLightMaskClearCoat != 4) + { + clearCoatMap *= blackLightMask[_BlackLightMaskClearCoat]; + } + #endif + + half3 reflectionColor = CalculateClearCoatEnvironmentalReflections(); + + float NormalDotView = abs(dot(float(1), float(0) == 0 ? poiLight.N0DotV: poiLight.nDotV).r); + #ifdef POI_LIGHTING + finalColor.rgb = lerp(finalColor.rgb, reflectionColor * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var), clearCoatMap * float(1) * clamp(FresnelTerm(float(1), NormalDotView), 0, 1)); + //finalColor.rgb += reflectionColor; + //finalColor.rgb = finalColor.rgb * (1- (reflectionColor.r + reflectionColor.g + reflectionColor.b)/3) + reflectionColor * clearCoatMap * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var); + #else + finalColor.rgb = lerp(finalColor.rgb, reflectionColor, clearCoatMap * float(1) * clamp(FresnelTerm(float(1), NormalDotView), 0, 1)); + #endif + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiClearCoat.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiClearCoat.cginc.meta new file mode 100644 index 00000000..620fc952 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiClearCoat.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f260a568071fb7248a350feac3e38515 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiColors.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiColors.cginc new file mode 100644 index 00000000..687dc443 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiColors.cginc @@ -0,0 +1,262 @@ +#ifndef POI_COLOR + #define POI_COLOR + + #ifndef pi + #define pi float(3.14159265359) + #endif + + static const float Epsilon = 1e-10; + // The weights of RGB contributions to luminance. + // Should sum to unity. + static const float3 HCYwts = float3(0.299, 0.587, 0.114); + static const float HCLgamma = 3; + static const float HCLy0 = 100; + static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5 + static const float3 wref = float3(1.0, 1.0, 1.0); + #define TAU 6.28318531 + + float3 HUEtoRGB(in float H) + { + float R = abs(H * 6 - 3) - 1; + float G = 2 - abs(H * 6 - 2); + float B = 2 - abs(H * 6 - 4); + return saturate(float3(R, G, B)); + } + + float3 RGBtoHCV(in float3 RGB) + { + // Based on work by Sam Hocevar and Emil Persson + float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0): float4(RGB.gb, 0.0, -1.0 / 3.0); + float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r): float4(RGB.r, P.yzx); + float C = Q.x - min(Q.w, Q.y); + float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z); + return float3(H, C, Q.x); + } + + float3 HSVtoRGB(in float3 HSV) + { + float3 RGB = HUEtoRGB(HSV.x); + return((RGB - 1) * HSV.y + 1) * HSV.z; + } + + float3 RGBtoHSV(in float3 RGB) + { + float3 HCV = RGBtoHCV(RGB); + float S = HCV.y / (HCV.z + Epsilon); + return float3(HCV.x, S, HCV.z); + } + + float3 HSLtoRGB(in float3 HSL) + { + float3 RGB = HUEtoRGB(HSL.x); + float C = (1 - abs(2 * HSL.z - 1)) * HSL.y; + return(RGB - 0.5) * C + HSL.z; + } + + float3 RGBtoHSL(in float3 RGB) + { + float3 HCV = RGBtoHCV(RGB); + float L = HCV.z - HCV.y * 0.5; + float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon); + return float3(HCV.x, S, L); + } + + float3 HCYtoRGB(in float3 HCY) + { + + + float3 RGB = HUEtoRGB(HCY.x); + float Z = dot(RGB, HCYwts); + if (HCY.z < Z) + { + HCY.y *= HCY.z / Z; + } + else if(Z < 1) + { + HCY.y *= (1 - HCY.z) / (1 - Z); + } + return(RGB - Z) * HCY.y + HCY.z; + } + + float3 RGBtoHCY(in float3 RGB) + { + // Corrected by David Schaeffer + float3 HCV = RGBtoHCV(RGB); + float Y = dot(RGB, HCYwts); + float Z = dot(HUEtoRGB(HCV.x), HCYwts); + if (Y < Z) + { + HCV.y *= Z / (Epsilon + Y); + } + else + { + HCV.y *= (1 - Z) / (Epsilon + 1 - Y); + } + return float3(HCV.x, HCV.y, Y); + } + + float3 HCLtoRGB(in float3 HCL) + { + float3 RGB = 0; + if(HCL.z != 0) + { + float H = HCL.x; + float C = HCL.y; + float L = HCL.z * HCLmaxL; + float Q = exp((1 - C / (2 * L)) * (HCLgamma / HCLy0)); + float U = (2 * L - C) / (2 * Q - 1); + float V = C / Q; + float A = (H + min(frac(2 * H) / 4, frac(-2 * H) / 8)) * pi * 2; + float T; + H *= 6; + if(H <= 0.999) + { + T = tan(A); + RGB.r = 1; + RGB.g = T / (1 + T); + } + else if(H <= 1.001) + { + RGB.r = 1; + RGB.g = 1; + } + else if(H <= 2) + { + T = tan(A); + RGB.r = (1 + T) / T; + RGB.g = 1; + } + else if(H <= 3) + { + T = tan(A); + RGB.g = 1; + RGB.b = 1 + T; + } + else if(H <= 3.999) + { + T = tan(A); + RGB.g = 1 / (1 + T); + RGB.b = 1; + } + else if(H <= 4.001) + { + RGB.g = 0; + RGB.b = 1; + } + else if(H <= 5) + { + T = tan(A); + RGB.r = -1 / T; + RGB.b = 1; + } + else + { + T = tan(A); + RGB.r = 1; + RGB.b = -T; + } + RGB = RGB * V + U; + } + return RGB; + } + + float3 RGBtoHCL(in float3 RGB) + { + float3 HCL; + float H = 0; + float U = min(RGB.r, min(RGB.g, RGB.b)); + float V = max(RGB.r, max(RGB.g, RGB.b)); + float Q = HCLgamma / HCLy0; + HCL.y = V - U; + if(HCL.y != 0) + { + H = atan2(RGB.g - RGB.b, RGB.r - RGB.g) / pi; + Q *= U / V; + } + Q = exp(Q); + HCL.x = frac(H / 2 - min(frac(H), frac(-H)) / 6); + HCL.y *= Q; + HCL.z = lerp(-U, V, Q) / (HCLmaxL * 2); + return HCL; + } + + //HSL MODIFT + float3 ModifyViaHSL(float3 color, float3 HSLMod) + { + float3 colorHSL = RGBtoHSL(color); + colorHSL.r = frac(colorHSL.r + HSLMod.r); + colorHSL.g = saturate(colorHSL.g + HSLMod.g); + colorHSL.b = saturate(colorHSL.b + HSLMod.b); + return HSLtoRGB(colorHSL); + } + + float3 hueShift(float3 col, float hueAdjust) + { + hueAdjust *= 2 * pi; + const float3 k = float3(0.57735, 0.57735, 0.57735); + half cosAngle = cos(hueAdjust); + return col * cosAngle + cross(k, col) * sin(hueAdjust) + k * dot(k, col) * (1.0 - cosAngle); + } + + float3 poiSaturation(float3 In, float Saturation) + { + float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750)); + return luma.xxx + Saturation.xxx * (In - luma.xxx); + } + // LCH + float xyzF(float t) + { + return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645)); + } + float xyzR(float t) + { + return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655)); + } + float3 rgb2lch(in float3 c) + { + c = mul(float3x3(0.4124, 0.3576, 0.1805, + 0.2126, 0.7152, 0.0722, + 0.0193, 0.1192, 0.9505), c); + c.x = xyzF(c.x / wref.x); + c.y = xyzF(c.y / wref.y); + c.z = xyzF(c.z / wref.z); + float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z)); + return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y)); + } + + float3 lch2rgb(in float3 c) + { + c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y); + + float lg = 1. / 116. * (c.x + 16.); + float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y), + wref.y * xyzR(lg), + wref.z * xyzR(lg - 0.005 * c.z)); + + float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986, + - 0.9689, 1.8758, 0.0415, + 0.0557, -0.2040, 1.0570), xyz); + + return rgb; + } + + //cheaply lerp around a circle + float lerpAng(in float a, in float b, in float x) + { + float ang = fmod(fmod((a - b), TAU) + pi * 3., TAU) - pi; + return ang * x + b; + } + + //Linear interpolation between two colors in Lch space + float3 lerpLch(in float3 a, in float3 b, in float x) + { + float hue = lerpAng(a.z, b.z, x); + return float3(lerp(b.xy, a.xy, x), hue); + } + + float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha) + { + return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha)); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiColors.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiColors.cginc.meta new file mode 100644 index 00000000..6f10592c --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiColors.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e94d9185faed65a43ae83147566e9c2d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiData.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiData.cginc new file mode 100644 index 00000000..ace8c467 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiData.cginc @@ -0,0 +1,249 @@ +#ifndef POI_DATA + #define POI_DATA + + float _ParallaxBias; + float _LightingAdditiveLimitIntensity; + float _LightingAdditiveMaxIntensity; + POI_TEXTURE_NOSAMPLER(_BumpMap); + #ifdef FINALPASS + POI_TEXTURE_NOSAMPLER(_DetailMask); + POI_TEXTURE_NOSAMPLER(_DetailNormalMap); + float _DetailNormalMapScale; + #endif + float _BumpScale; + + void calculateAttenuation(v2f i) + { + #ifdef FORWARD_ADD_PASS + #if defined(POINT) || defined(SPOT) + POI_LIGHT_ATTENUATION(attenuation, shadow, i, i.worldPos.xyz) + poiLight.additiveShadow = shadow; + #else + UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz) + poiLight.additiveShadow == 0; + #endif + #else + UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz) + // fix for rare bug where light atten is 0 when there is no directional light in the scene + #ifdef FORWARD_BASE_PASS + if (all(_LightColor0.rgb == 0.0)) + { + attenuation = 1.0; + } + #endif + #endif + poiLight.attenuation = attenuation; + } + + void calculateVertexLightingData(in v2f i) + { + #ifdef VERTEXLIGHT_ON + float4 toLightX = unity_4LightPosX0 - i.worldPos.x; + float4 toLightY = unity_4LightPosY0 - i.worldPos.y; + float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z; + float4 lengthSq = 0; + lengthSq += toLightX * toLightX; + lengthSq += toLightY * toLightY; + lengthSq += toLightZ * toLightZ; + + float4 lightAttenSq = unity_4LightAtten0; + float4 atten = 1.0 / (1.0 + lengthSq * lightAttenSq); + float4 vLightWeight = saturate(1 - (lengthSq * lightAttenSq / 25)); + poiLight.vAttenuation = min(atten, vLightWeight * vLightWeight); + + poiLight.vDotNL = 0; + poiLight.vDotNL += toLightX * poiMesh.normals[1].x; + poiLight.vDotNL += toLightY * poiMesh.normals[1].y; + poiLight.vDotNL += toLightZ * poiMesh.normals[1].z; + + float4 corr = rsqrt(lengthSq); + poiLight.vDotNL = max(0, poiLight.vDotNL * corr); + poiLight.vAttenuationDotNL = poiLight.vAttenuation * poiLight.vDotNL; + + for (int index = 0; index < 4; index ++) + { + poiLight.vPosition[index] = float3(unity_4LightPosX0[index], unity_4LightPosY0[index], unity_4LightPosZ0[index]); + + float3 vertexToLightSource = poiLight.vPosition[index] - poiMesh.worldPos; + poiLight.vDirection[index] = normalize(vertexToLightSource); + //poiLight.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]); + poiLight.vColor[index] = unity_LightColor[index].rgb; + + if (float(0) == 1) + { + float intensity = max(0.001, (0.299 * poiLight.vColor[index].r + 0.587 * poiLight.vColor[index].g + 0.114 * poiLight.vColor[index].b)); + poiLight.vColor[index] = min(poiLight.vColor[index], poiLight.vColor[index] / (intensity / float(1))); + } + poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir); + poiLight.vDotNL[index] = dot(poiMesh.normals[1], -poiLight.vDirection[index]); + poiLight.vCorrectedDotNL[index] = .5 * (poiLight.vDotNL[index] + 1); + + #ifdef POI_VAR_DOTLH + poiLight.vDotLH[index] = saturate(dot(poiLight.vDirection[index], poiLight.vHalfDir[index])); + #endif + + #ifdef POI_VAR_DOTNH + poiLight.vDotNH[index] = saturate(dot(poiMesh.normals[1], poiLight.vHalfDir[index])); + #endif + } + #endif + } + + void calculateLightingData(in v2f i) + { + #ifdef FORWARD_BASE_PASS + //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb))); + float3 magic = max(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0); + float3 normalLight = _LightColor0.rgb; + poiLight.color = magic + normalLight; + #else + #ifdef FORWARD_ADD_PASS + poiLight.color = _LightColor0.rgb; + + + if (float(0) == 1) + { + float additiveLightIntensity = max(0.001, (0.299 * poiLight.color.r + 0.587 * poiLight.color.g + 0.114 * poiLight.color.b)); + poiLight.color = min(poiLight.color, poiLight.color / (additiveLightIntensity / float(1))); + } + #endif + #endif + + #ifdef FORWARD_BASE_PASS + poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz); + #else + #if defined(POINT) || defined(SPOT) + poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos); + #else + poiLight.direction = _WorldSpaceLightPos0; + #endif + #endif + + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); + + #ifdef POI_VAR_DOTNH + poiLight.dotNH = saturate(dot(poiMesh.normals[1], poiLight.halfDir)); + #endif + + #ifdef POI_VAR_DOTLH + poiLight.dotLH = saturate(dot(poiLight.direction, poiLight.halfDir)); + #endif + + poiLight.nDotV = dot(poiMesh.normals[1], poiCam.viewDir); + poiLight.N0DotV = dot(poiMesh.normals[0], poiCam.viewDir); + poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); + poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir); + poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir); + poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir); + } + + float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign) + { + return cross(normal, tangent.xyz) * (binormalSign * unity_WorldTransformParams.w); + } + + void InitializeMeshData(inout v2f i, uint facing) + { + poiMesh.isFrontFace = facing; + poiMesh.normals[0] = normalize(i.normal); + poiMesh.binormal = CreateBinormal(i.normal, i.tangent.xyz, i.tangent.w); + poiMesh.tangent = i.tangent.xyz; + + #ifndef OUTLINE + if(!poiMesh.isFrontFace) + { + poiMesh.normals[0] *= -1; + poiMesh.tangent *= -1; + poiMesh.binormal *= -1; + } + #endif + + poiMesh.worldPos = i.worldPos; + poiMesh.localPos = i.localPos; + poiMesh.barycentricCoordinates = i.barycentricCoordinates; + poiMesh.uv[0] = i.uv0.xy; + poiMesh.uv[1] = i.uv0.zw; + poiMesh.uv[2] = i.uv1.xy; + poiMesh.uv[3] = i.uv1.zw; + + #ifdef POI_UV_DISTORTION + poiMesh.uv[4] = calculateDistortionUV(i.uv0.xy); + #else + poiMesh.uv[4] = poiMesh.uv[0]; + #endif + + poiMesh.vertexColor = i.vertexColor; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + poiMesh.lightmapUV = i.lightmapUV; + #endif + poiMesh.modelPos = i.modelPos; + + #ifdef FUR + poiMesh.furAlpha = i.furAlpha; + #endif + } + + void initializeCamera(v2f i) + { + poiCam.viewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + poiCam.forwardDir = getCameraForward(); + poiCam.worldPos = _WorldSpaceCameraPos; + poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos); + poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos); + poiCam.grabPos = i.grabPos; + poiCam.screenUV = calcScreenUVs(i.grabPos); + poiCam.clipPos = i.pos; + #if defined(GRAIN) + poiCam.worldDirection = i.worldDirection; + #endif + + poiCam.tangentViewDir = normalize(i.tangentViewDir); + poiCam.tangentViewDir.xy /= (poiCam.tangentViewDir.z + float(0.42)); + } + + void calculateTangentData() + { + poiTData.tangentTransform = float3x3(poiMesh.tangent, poiMesh.binormal, poiMesh.normals[0]); + poiTData.tangentToWorld = transpose(float3x3(poiMesh.tangent, poiMesh.binormal, poiMesh.normals[0])); + } + + void CalculateReflectionData() + { + #if defined(_METALLICGLOSSMAP) || defined(_COLORCOLOR_ON) + poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]); + poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]); + #endif + } + + void calculateNormals(inout half3 detailMask) + { + half3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0.86)); + #ifdef FINALPASS + detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + if(float(1) > 0) + { + half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(1) * detailMask.g); + poiMesh.tangentSpaceNormal = BlendNormals(mainNormal, detailNormal); + } + else + { + poiMesh.tangentSpaceNormal = mainNormal; + } + #else + poiMesh.tangentSpaceNormal = mainNormal; + #endif + + #ifdef POI_RGBMASK + calculateRGBNormals(poiMesh.tangentSpaceNormal); + #endif + + poiMesh.normals[1] = normalize( + poiMesh.tangentSpaceNormal.x * poiMesh.tangent + + poiMesh.tangentSpaceNormal.y * poiMesh.binormal + + poiMesh.tangentSpaceNormal.z * poiMesh.normals[0] + ); + + poiCam.viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[1])); + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiData.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiData.cginc.meta new file mode 100644 index 00000000..324626a6 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiData.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0c245079230e54d45871942654cb24ec +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDebug.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDebug.cginc new file mode 100644 index 00000000..125d2cd9 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDebug.cginc @@ -0,0 +1,107 @@ +#ifndef POI_DEBUG + #define POI_DEBUG + + float _DebugEnabled; + float _DebugMeshData; + float _DebugLightingData; + float _DebugCameraData; + + void displayDebugInfo(inout float4 finalColor) + { + + if (float(0) != 0) + { + //Mesh Data + if (float(0) == 1) + { + finalColor.rgb = poiMesh.normals[0]; + return; + } + else if(float(0) == 2) + { + finalColor.rgb = poiMesh.normals[1]; + return; + } + else if(float(0) == 3) + { + finalColor.rgb = poiMesh.tangent; + return; + } + else if(float(0) == 4) + { + finalColor.rgb = poiMesh.binormal; + return; + } + else if(float(0) == 5) + { + finalColor.rgb = poiMesh.localPos; + return; + } + + #ifdef POI_LIGHTING + if(float(0) == 1) + { + finalColor.rgb = poiLight.attenuation; + return; + } + else if(float(0) == 2) + { + finalColor.rgb = poiLight.directLighting; + return; + } + else if(float(0) == 3) + { + finalColor.rgb = poiLight.indirectLighting; + return; + } + else if(float(0) == 4) + { + finalColor.rgb = poiLight.lightMap; + return; + } + else if(float(0) == 5) + { + finalColor.rgb = poiLight.rampedLightMap; + return; + } + else if(float(0) == 6) + { + finalColor.rgb = poiLight.finalLighting; + return; + } + else if(float(0) == 7) + { + finalColor.rgb = poiLight.nDotL; + return; + } + #endif + + if(float(0) == 1) + { + finalColor.rgb = poiCam.viewDir; + return; + } + else if(float(0) == 2) + { + finalColor.rgb = poiCam.tangentViewDir; + return; + } + else if(float(0) == 3) + { + finalColor.rgb = poiCam.forwardDir; + return; + } + else if(float(0) == 4) + { + finalColor.rgb = poiCam.worldPos; + return; + } + else if(float(0) == 5) + { + finalColor.rgb = poiCam.viewDotNormal; + return; + } + } + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDebug.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDebug.cginc.meta new file mode 100644 index 00000000..16b61c6d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDebug.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 22ba3178ae124184cbdeabfbdbf6b201 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDecal.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDecal.cginc new file mode 100644 index 00000000..280fcbc1 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDecal.cginc @@ -0,0 +1,58 @@ +#ifndef POI_DECAL + #define POI_DECAL + + POI_TEXTURE_NOSAMPLER(_DecalTexture); + POI_TEXTURE_NOSAMPLER(_DecalMask); + float4 _DecalColor; + fixed _DecalTiled; + fixed _DecalBlendAdd; + fixed _DecalBlendMultiply; + fixed _DecalBlendReplace; + half _DecalRotation; + half2 _DecalScale; + half2 _DecalPosition; + half _DecalRotationSpeed; + float _DecalEmissionStrength; + + void applyDecal(inout float4 albedo, inout float3 decalEmission) + { + float2 uv = poiMesh.uv[float(0)]; + float2 decalCenter = float4(0.5,0.5,0,0); + float theta = radians(float(0) + _Time.z * float(0)); + float cs = cos(theta); + float sn = sin(theta); + uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y); + uv = remap(uv, float2(0, 0) - float4(1,1,0,0) / 2 + float4(0.5,0.5,0,0), float4(1,1,0,0) / 2 + float4(0.5,0.5,0,0), float2(0, 0), float2(1, 1)); + + half decalAlpha = 1; + //float2 uv = TRANSFORM_TEX(poiMesh.uv[float(0)], _DecalTexture) + _Time.x * float4(0,0,0,0); + float4 decalColor = POI2D_SAMPLER_PAN(_DecalTexture, _MainTex, uv, float4(0,0,0,0)) * float4(1,1,1,1); + decalAlpha *= POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + + if (!float(0)) + { + if(uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0) + { + decalAlpha = 0; + } + } + + if(float(0)) + { + albedo.rgb = lerp(albedo.rgb, decalColor.rgb, decalColor.a * decalAlpha * float(0)); + } + + if(float(0)) + { + albedo.rgb *= lerp(1, decalColor.rgb, decalColor.a * decalAlpha * float(0)); + } + + if(float(0)) + { + albedo.rgb += decalColor.rgb * decalColor.a * decalAlpha * float(0); + } + albedo = saturate(albedo); + decalEmission = decalColor.rgb * decalColor.a * decalAlpha * float(0); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDecal.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDecal.cginc.meta new file mode 100644 index 00000000..de48825a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDecal.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 480a435aebc04a8489c755c44c713fe1 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDefines.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDefines.cginc new file mode 100644 index 00000000..9b70067a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDefines.cginc @@ -0,0 +1,21 @@ +#ifndef POI_DEFINES + #define POI_DEFINES + + #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04) + + #ifdef _SPECGLOSSMAP // Specular + #ifndef POI_VAR_DOTNH + #define POI_VAR_DOTNH + #endif + #ifndef POI_VAR_DOTLH + #define POI_VAR_DOTLH + #endif + #endif + + #ifdef VIGNETTE_MASKED // Lighting + #ifndef POI_VAR_DOTNL + #define POI_VAR_DOTNL + #endif + #endif + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDefines.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDefines.cginc.meta new file mode 100644 index 00000000..8508147c --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDefines.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2c566e93419732d44ab940997dc27526 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDepthColor.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDepthColor.cginc new file mode 100644 index 00000000..828460bc --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDepthColor.cginc @@ -0,0 +1,112 @@ +#ifndef POI_DEPTH_COLOR + #define POI_DEPTH_COLOR + + float4 _DepthGlowColor; + float _DepthGlowEmission; + float _FadeLength; + float _DepthAlphaMin; + float _DepthAlphaMax; + POI_TEXTURE_NOSAMPLER(_DepthGradient); + POI_TEXTURE_NOSAMPLER(_DepthMask); + float _DepthGradientTextureUV; + float _DepthGradientBlend; + + /* + void applyDepthColor(inout float4 finalColor, inout float3 depthTouchEmission, inout float3 finalEmission, float4 worldDirection, float4 clipPos) + { + float3 touchEmission = 0; + if (!IsInMirror()) + { + float fadeLength = _FadeLength; + fadeLength *= 0.01; + float depth = DecodeFloatRG(tex2Dproj(_CameraDepthTexture, worldDirection)); + depth = Linear01Depth(depth); + if(depth != 1) + { + float diff = distance(depth, Linear01Depth(clipPos.z)); + float intersect = 0; + if(diff > 0) + { + intersect = clamp(1 - smoothstep(0, _ProjectionParams.w * fadeLength, diff), 0, 1); + } + half4 depthGradient = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthGradient, _MainTex, intersect); + half3 depthMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthMask, _MainTex, poiMesh.uv[0]); + half3 depthColor = depthGradient.rgb * _DepthGlowColor.rgb; + finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask); + finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect); + touchEmission = depthColor * _DepthGlowEmission * intersect * depthMask; + } + } + depthTouchEmission = touchEmission; + } + */ + + inline float CorrectedLinearEyeDepth(float z, float B) + { + return 1.0 / (z / PM._34 + B); + } + + void applyDepthColor(inout float4 finalColor, inout float3 depthTouchEmission, inout float3 finalEmission, in float4 worldDirection) + { + float3 touchEmission = 0; + float fadeLength = _FadeLength; + fadeLength *= 0.01; + + float perspectiveDivide = 1.0f / poiCam.clipPos.w; + float4 direction = worldDirection * perspectiveDivide; + float2 screenPos = poiCam.grabPos.xy * perspectiveDivide; + float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screenPos); + + #if UNITY_REVERSED_Z + if (z == 0) + #else + if(z == 1) + #endif + return; + + float depth = CorrectedLinearEyeDepth(z, direction.w); + float3 worldpos = direction * depth + _WorldSpaceCameraPos.xyz; + /* + finalColor.rgb = frac(worldpos); + return; + */ + + float diff = distance(worldpos, poiMesh.worldPos); + float intersect = 0; + intersect = clamp(1 - smoothstep(0, fadeLength, diff), 0, 1); + half3 depthMask = POI2D_SAMPLER_PAN(_DepthMask, _MainTex, poiMesh.uv[_DepthMaskUV], _DepthMaskPan); + + half4 depthGradient = 0; + half3 depthColor = 0; + + + if (_DepthGradientTextureUV == 0) + { + depthGradient = POI2D_SAMPLER_PAN(_DepthGradient, _MainTex, float2(intersect, intersect), _DepthGradientPan); + depthColor = depthGradient.rgb * _DepthGlowColor.rgb; + } + else + { + depthGradient = POI2D_SAMPLER_PAN(_DepthGradient, _MainTex, poiMesh.uv[_DepthGradientUV], _DepthGradientPan); + depthColor = depthGradient.rgb * _DepthGlowColor.rgb * intersect; + } + + + if(_DepthGradientBlend == 0) // rpelace + { + finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask); + } + else if(_DepthGradientBlend == 1) // add + { + finalColor.rgb += depthColor * intersect * depthMask; + } + else if(_DepthGradientBlend == 2) // multiply + { + finalColor.rgb *= lerp(1, depthColor, intersect * depthMask); + } + finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect * depthMask); + touchEmission = depthColor * _DepthGlowEmission * intersect * depthMask; + + depthTouchEmission = touchEmission; + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDepthColor.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDepthColor.cginc.meta new file mode 100644 index 00000000..483e60a8 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDepthColor.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8ac29e5a1be99c44e95a8039d65a6f8b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDissolve.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDissolve.cginc new file mode 100644 index 00000000..41e6efee --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDissolve.cginc @@ -0,0 +1,171 @@ +#ifndef POI_DISSOLVE + #define POI_DISSOLVE + + float _DissolveType; + float _DissolveEdgeWidth; + float4 _DissolveEdgeColor; + sampler2D _DissolveEdgeGradient; float4 _DissolveEdgeGradient_ST; + float _DissolveEdgeEmission; + float4 _DissolveTextureColor; + + POI_TEXTURE_NOSAMPLER(_DissolveToTexture); + POI_TEXTURE_NOSAMPLER(_DissolveNoiseTexture); + POI_TEXTURE_NOSAMPLER(_DissolveDetailNoise); + POI_TEXTURE_NOSAMPLER(_DissolveMask); + + float _DissolveMaskInvert; + float _DissolveAlpha; + float _ContinuousDissolve; + float _DissolveDetailStrength; + float _DissolveEdgeHardness; + float _DissolveInvertNoise; + float _DissolveInvertDetailNoise; + float _DissolveToEmissionStrength; + + // Point to Point + float _DissolveP2PWorldLocal; + float _DissolveP2PEdgeLength; + float4 _DissolveStartPoint; + float4 _DissolveEndPoint; + + // World Dissolve + float _DissolveWorldShape; + float4 _DissolveShapePosition; + float4 _DissolveShapeRotation; + float _DissolveShapeScale; + float _DissolveInvertShape; + float _DissolveShapeEdgeLength; + + float _DissolveAlpha0; + float _DissolveAlpha1; + float _DissolveAlpha2; + float _DissolveAlpha3; + float _DissolveAlpha4; + float _DissolveAlpha5; + float _DissolveAlpha6; + float _DissolveAlpha7; + float _DissolveAlpha8; + float _DissolveAlpha9; + + // Masking + float _DissolveEmissionSide; + float _DissolveEmission1Side; + float _DissolveUseVertexColors; + + float4 edgeColor; + float edgeAlpha; + float dissolveAlpha; + float4 dissolveToTexture; + //Globals + + + void calculateDissolve(inout float4 albedo, inout float3 dissolveEmission) + { + + float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + + + if (float(0)) + { + // Vertex Color Imprecision hype + dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000; + } + + dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float4(1,1,1,0); + float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + + float da = _DissolveAlpha + + float(0) + + float(0) + + float(0) + + float(0) + + float(0) + + float(0) + + float(0) + + float(0) + + float(0) + + float(0); + da = saturate(da); + + float dds = float(0.117); + #ifdef POI_BLACKLIGHT + if(_BlackLightMaskDissolve != 4) + { + dissolveMask *= blackLightMask[_BlackLightMaskDissolve]; + } + #endif + + if(float(0)) + { + dissolveMask = 1 - dissolveMask; + } + + float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiMesh.uv[float(0)], float4(0.5,1,0,0)); + + if(float(0)) + { + dissolveNoiseTexture = 1 - dissolveNoiseTexture; + } + if(float(0)) + { + dissolveDetailNoise = 1 - dissolveDetailNoise; + } + if(float(0) != 0) + { + da = sin(_Time.y * float(0)) * .5 + .5; + } + da *= dissolveMask; + dissolveAlpha = da; + edgeAlpha = 0; + + + if(float(2) == 1) // Basic + { + da = remap(da, 0, 1, -float(0.002), 1); + dissolveAlpha = da; + //Adjust detail strength to avoid artifacts + dds *= smoothstep(1, .99, da); + float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds); + + noise = saturate(noise + 0.001); + //noise = remap(noise, 0, 1, float(0.002), 1 - float(0.002)); + dissolveAlpha = dissolveAlpha >= noise; + edgeAlpha = remapClamped(noise, da + float(0.002), da, 0, 1) * (1 - dissolveAlpha); + } + else if (float(2) == 2) // Point to Point + { + float3 direction; + float3 currentPos; + float distanceTo = 0; + direction = normalize(float4(0,1,0,0) - float4(0,-1,0,0)); + currentPos = lerp(float4(0,-1,0,0), float4(0,1,0,0), dissolveAlpha); + if (float(0) == 0) + { + distanceTo = dot(poiMesh.localPos - currentPos, direction) - dissolveDetailNoise * dds; + edgeAlpha = smoothstep(float(0.1), 0, distanceTo); + dissolveAlpha = step(distanceTo, 0); + edgeAlpha *= 1 - dissolveAlpha; + } + else + { + distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds; + edgeAlpha = smoothstep(float(0.1), 0, distanceTo); + dissolveAlpha = step(distanceTo, 0); + edgeAlpha *= 1 - dissolveAlpha; + } + } + + albedo = lerp(albedo, dissolveToTexture, dissolveAlpha); + + + if(float(0.002)) + { + edgeColor = tex2D(_DissolveEdgeGradient, TRANSFORM_TEX(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient)) * float4(1,1,1,1); + albedo.rgb = lerp(albedo.rgb, edgeColor.rgb, smoothstep(0, 1 - float(0.117) * .99999999999, edgeAlpha)); + } + + dissolveEmission = lerp(0, dissolveToTexture * float(0), dissolveAlpha) + lerp(0, edgeColor.rgb * float(0), smoothstep(0, 1 - float(0.117) * .99999999999, edgeAlpha)); + } + + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDissolve.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDissolve.cginc.meta new file mode 100644 index 00000000..c093d3ef --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDissolve.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bfc63a3cc6771f74e9477a1d151771a2 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDithering.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDithering.cginc new file mode 100644 index 00000000..91efad39 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDithering.cginc @@ -0,0 +1,34 @@ +#ifndef POI_DITHERING + #define POI_DITHERING + fixed _DitheringEnabled; + fixed _DitherGradient; + + half calcDither(half2 grabPos) + { + half dither = Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8)); + return dither; + } + + #ifndef POI_SHADOW + void applyDithering(inout float4 finalColor) + { + + if (float(0)) + { + half dither = calcDither(poiCam.screenUV.xy); + finalColor.a = finalColor.a - (dither * (1 - finalColor.a) * float(0.1)); + } + } + #else + void applyShadowDithering(inout float alpha, float2 screenUV) + { + + if(float(0)) + { + half dither = calcDither(screenUV); + alpha = alpha - (dither * (1 - alpha) * float(0.1)); + } + } + #endif + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDithering.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDithering.cginc.meta new file mode 100644 index 00000000..137ff1e2 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiDithering.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7f7d2f9886b35354bbeff7e939072cd5 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEmission.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEmission.cginc new file mode 100644 index 00000000..bdb0a281 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEmission.cginc @@ -0,0 +1,240 @@ +#ifndef POI_EMISSION + #define POI_EMISSION + + float4 _EmissionColor; + POI_TEXTURE_NOSAMPLER(_EmissionMap); + POI_TEXTURE_NOSAMPLER(_EmissionMask); + UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve); float4 _EmissionScrollingCurve_ST; + float _EmissionBaseColorAsMap; + float _EmissionStrength; + float _EnableEmission; + float _EmissionHueShift; + float4 _EmissiveScroll_Direction; + float _EmissiveScroll_Width; + float _EmissiveScroll_Velocity; + float _EmissiveScroll_Interval; + float _EmissionBlinkingEnabled; + float _EmissiveBlink_Min; + float _EmissiveBlink_Max; + float _EmissiveBlink_Velocity; + float _ScrollingEmission; + float _EnableGITDEmission; + float _GITDEMinEmissionMultiplier; + float _GITDEMaxEmissionMultiplier; + float _GITDEMinLight; + float _GITDEMaxLight; + float _GITDEWorldOrMesh; + float _EmissionCenterOutEnabled; + float _EmissionCenterOutSpeed; + float _EmissionHueShiftEnabled; + float _EmissionBlinkingOffset; + float _EmissionScrollingOffset; + + float4 _EmissionColor1; + #ifdef EFFECT_HUE_VARIATION + POI_TEXTURE_NOSAMPLER(_EmissionMap1); + POI_TEXTURE_NOSAMPLER(_EmissionMask1); + UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve1); float4 _EmissionScrollingCurve1_ST; + #endif + float _EmissionBaseColorAsMap1; + float _EmissionStrength1; + float _EnableEmission1; + float _EmissionHueShift1; + float4 _EmissiveScroll_Direction1; + float _EmissiveScroll_Width1; + float _EmissiveScroll_Velocity1; + float _EmissiveScroll_Interval1; + float _EmissionBlinkingEnabled1; + float _EmissiveBlink_Min1; + float _EmissiveBlink_Max1; + float _EmissiveBlink_Velocity1; + float _ScrollingEmission1; + float _EnableGITDEmission1; + float _GITDEMinEmissionMultiplier1; + float _GITDEMaxEmissionMultiplier1; + float _GITDEMinLight1; + float _GITDEMaxLight1; + float _GITDEWorldOrMesh1; + float _EmissionCenterOutEnabled1; + float _EmissionCenterOutSpeed1; + float _EmissionHueShiftEnabled1; + float _EmissionBlinkingOffset1; + float _EmissionScrollingOffset1; + + float _EmissionReplace; + + float _EmissionScrollingVertexColor; + float _EmissionScrollingVertexColor1; + + float _EmissionScrollingUseCurve; + float _EmissionScrollingUseCurve1; + + float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled) + { + float glowInTheDarkMultiplier = 1; + + if (enabled) + { + #ifdef POI_LIGHTING + float3 lightValue = float(0) ? poiLight.finalLighting.rgb: poiLight.directLighting.rgb; + float gitdeAlpha = (clamp(poiMax(lightValue), minLight, maxLight) - minLight) / (maxLight - minLight); + glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha); + #endif + } + return glowInTheDarkMultiplier; + } + + float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position) + { + float phase = 0; + phase = dot(position, direction); + phase -= (_Time.y + offset) * velocity; + phase /= interval; + phase -= floor(phase); + phase = saturate(phase); + return(pow(phase, scrollWidth) + pow(1 - phase, scrollWidth * 4)) * 0.5; + } + + float calculateBlinkingEmission(in float blinkMin, in float blinkMax, in float blinkVelocity, float offset) + { + float amplitude = (blinkMax - blinkMin) * 0.5f; + float base = blinkMin + amplitude; + return sin((_Time.y + offset) * blinkVelocity) * amplitude + base; + } + + float3 calculateEmissionNew(in float4 baseColor, inout float4 finalColor) + { + // First Emission + float3 emission0 = 0; + float emissionStrength0 = float(0.62); + float3 emissionColor0 = 0; + + float glowInTheDarkMultiplier0 = calculateGlowInTheDark(float(0), float(1), float(1), float(0), float(0)); + + + if (!float(0)) + { + emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * lerp(1, baseColor, float(0)).rgb * float4(1,1,1,1).rgb; + } + else + { + emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * float4(1,1,0,0).xy) + _Time.x * float(5)) * lerp(1, baseColor, float(0)).rgb * float4(1,1,1,1).rgb; + } + + + if(float(0)) + { + float3 pos = poiMesh.localPos; + + if(float(0)) + { + pos = poiMesh.vertexColor.rgb; + } + + + if(float(0)) + { + emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _EmissionScrollingCurve) + (dot(pos, float4(0,-10,0,0)) * float(20)) + _Time.x * float(10)); + } + else + { + emissionStrength0 *= calculateScrollingEmission(float4(0,-10,0,0), float(10), float(20), float(10), float(0), pos); + } + } + + + if(float(0)) + { + emissionStrength0 *= calculateBlinkingEmission(float(0), float(1), float(4), float(0)); + } + + emissionColor0 = hueShift(emissionColor0, float(0) * float(0)); + float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _EmissionMask) + _Time.x * float4(0,0,0,0)); + + #ifdef POI_BLACKLIGHT + if(_BlackLightMaskEmission != 4) + { + emissionMask0 *= blackLightMask[_BlackLightMaskEmission]; + } + #endif + + emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0; + emission0 = emissionStrength0 * emissionColor0; + + #ifdef POI_DISSOLVE + + if(float(2) != 2) + { + emission0 *= lerp(1 - dissolveAlpha, dissolveAlpha, float(2)); + } + #endif + + // Second Emission + float3 emission1 = 0; + float emissionStrength1 = 0; + float3 emissionColor1 = 0; + + #ifdef EFFECT_HUE_VARIATION + emissionStrength1 = float(0); + float glowInTheDarkMultiplier1 = calculateGlowInTheDark(float(0), float(1), float(1), float(0), float(0)); + + + if (!float(0)) + { + emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * lerp(1, baseColor, float(0)).rgb * float4(1,1,1,1).rgb; + } + else + { + emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * float4(1,1,0,0).xy) + _Time.x * float(5)).rgb * lerp(1, baseColor, float(0)).rgb * float4(1,1,1,1).rgb; + } + + + if(float(0)) + { + float3 pos1 = poiMesh.localPos; + + if(float(0)) + { + pos1 = poiMesh.vertexColor.rgb; + } + + + if(float(0)) + { + emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _EmissionScrollingCurve1) + (dot(pos1, float4(0,-10,0,0)) * float(20)) + _Time.x * float(10)); + } + else + { + emissionStrength1 *= calculateScrollingEmission(float4(0,-10,0,0), float(10), float(20), float(10), float(0), pos1); + } + } + + if(float(0)) + { + emissionStrength1 *= calculateBlinkingEmission(float(0), float(1), float(4), float(0)); + } + + emissionColor1 = hueShift(emissionColor1, float(0) * float(0)); + float emissionMask1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask1, _MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _EmissionMask1) + _Time.x * float4(0,0,0,0)); + #ifdef POI_BLACKLIGHT + if(_BlackLightMaskEmission2 != 4) + { + emissionMask1 *= blackLightMask[_BlackLightMaskEmission2]; + } + #endif + emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1; + emission1 = emissionStrength1 * emissionColor1; + + #ifdef POI_DISSOLVE + if(float(2) != 2) + { + emission1 *= lerp(1 - dissolveAlpha, dissolveAlpha, float(2)); + } + #endif + #endif + finalColor.rgb = lerp(finalColor.rgb, saturate(emissionColor0 + emissionColor1), saturate(emissionStrength0 + emissionStrength1) * float(0) * poiMax(emission0 + emission1)); + + return emission0 + emission1; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEmission.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEmission.cginc.meta new file mode 100644 index 00000000..205c5b85 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEmission.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2c4b9a3d0f305224886ef4a80a1bcea1 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEnvironmentalRimLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEnvironmentalRimLighting.cginc new file mode 100644 index 00000000..70403d3b --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEnvironmentalRimLighting.cginc @@ -0,0 +1,43 @@ +#ifndef POI_ENVIRONMENTAL_RIM + #define POI_ENVIRONMENTAL_RIM + + //enviro rim + float _EnableEnvironmentalRim; + POI_TEXTURE_NOSAMPLER(_RimEnviroMask); + float _RimEnviroBlur; + float _RimEnviroMinBrightness; + float _RimEnviroWidth; + float _RimEnviroSharpness; + float _RimEnviroIntensity; + + float3 calculateEnvironmentalRimLighting(in float4 albedo) + { + float enviroRimAlpha = saturate(1 - smoothstep(min(float(0), float(0.545)), float(0.545), poiCam.viewDotNormal)); + float(0.319) *= 1.7 - 0.7 * float(0.319); + + float3 enviroRimColor = 0; + float interpolator = unity_SpecCube0_BoxMin.w; + + if (interpolator < 0.99999) + { + //Probe 1 + float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], float(0.319) * UNITY_SPECCUBE_LOD_STEPS); + float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR); + + //Probe 2 + float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, poiMesh.normals[1], float(0.319) * UNITY_SPECCUBE_LOD_STEPS); + float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR); + + enviroRimColor = lerp(reflectionColor1, reflectionColor0, interpolator); + } + else + { + float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], float(0.319) * UNITY_SPECCUBE_LOD_STEPS); + enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR); + } + + half enviroMask = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).rgb); + return lerp(0, max(0, (enviroRimColor - float(0)) * albedo.rgb), enviroRimAlpha).rgb * enviroMask * float(1); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta new file mode 100644 index 00000000..b692bb59 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7dcb08c3579e35040b0ef51d43b7c2ac +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFlipbook.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFlipbook.cginc new file mode 100644 index 00000000..0ed89b59 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFlipbook.cginc @@ -0,0 +1,153 @@ +#ifndef POI_FLIPBOOK + #define POI_FLIPBOOK + + UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST; + float4 _FlipbookColor; + float _FlipbookFPS; + float _FlipbookTotalFrames; + float4 _FlipbookScaleOffset; + float _FlipbookTiled; + float _FlipbookCurrentFrame; + float _FlipbookEmissionStrength; + float _FlipbookRotation; + float _EnableFlipbook; + float _FlipbookTexArrayUV; + float _FlipbookAlphaControlsFinalAlpha; + float _FlipbookRotationSpeed; + float _FlipbookIntensityControlsAlpha; + float _FlipbookColorReplaces; + float2 _FlipbookTexArrayPan; + + // blending + float _FlipbookReplace; + float _FlipbookMultiply; + float _FlipbookAdd; + POI_TEXTURE_NOSAMPLER(_FlipbookMask); + + // anim + float _FlipbookMovementType; + float4 _FlipbookStartEndOffset; + float _FlipbookMovementSpeed; + + // Global + float4 flipBookPixel; + float4 flipBookPixelMultiply; + float flipBookMask; + + #ifndef POI_SHADOW + + void applyFlipbook(inout float4 finalColor, inout float3 flipbookEmission) + { + flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + float4 flipbookScaleOffset = float4(1,1,0,0); + flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy; + float2 uv = frac(poiMesh.uv[float(0)]); + float theta = radians(float(0) + _Time.z * float(0)); + float cs = cos(theta); + float sn = sin(theta); + float2 spriteCenter = flipbookScaleOffset.zw + .5; + // 2d rotation + uv = float2((uv.x - spriteCenter.x) * cs - (uv.y - spriteCenter.y) * sn + spriteCenter.x, (uv.x - spriteCenter.x) * sn + (uv.y - spriteCenter.y) * cs + spriteCenter.y); + + float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(0, 0), float2(1, 1)); + + + if (float(0) == 0) + { + if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0) + { + flipBookPixel = 0; + return; + } + } + + uint currentFrame = floor(float(-1)) % float(1); + if(float(-1) < 0) + { + currentFrame = (_Time.y / (1 / float(30))) % float(1); + } + flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * float4(0,0,0,0), currentFrame)); + + if(float(0)) + { + flipBookPixel.a = poiMax(flipBookPixel.rgb); + } + + if(float(0)) + { + flipBookPixel.rgb = float4(1,1,1,1).rgb; + } + else + { + flipBookPixel.rgb *= float4(1,1,1,1).rgb; + } + + #ifdef POI_BLACKLIGHT + + if(_BlackLightMaskFlipbook != 4) + { + flipBookMask *= blackLightMask[_BlackLightMaskFlipbook]; + } + #endif + + finalColor.rgb = lerp(finalColor, flipBookPixel.rgb, flipBookPixel.a * float4(1,1,1,1).a * float(1) * flipBookMask); + finalColor.rgb = finalColor + flipBookPixel.rgb * float(0) * flipBookMask; + finalColor.rgb = finalColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * float4(1,1,1,1).a * flipBookMask * float(0)); + + + if(float(0)) + { + finalColor.a = lerp(finalColor.a, flipBookPixel.a * float4(1,1,1,1).a, flipBookMask); + } + flipbookEmission = lerp(0, flipBookPixel.rgb * float(0), flipBookPixel.a * float4(1,1,1,1).a * flipBookMask); + } + + #else + + float applyFlipbookAlphaToShadow(float2 uv) + { + + if(float(0)) + { + float flipbookShadowAlpha = 0; + + float4 flipbookScaleOffset = float4(1,1,0,0); + flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy; + float theta = radians(float(0)); + + float cs = cos(theta); + float sn = sin(theta); + float2 spriteCenter = flipbookScaleOffset.zw + .5; + uv = float2((uv.x - spriteCenter.x) * cs - (uv.y - spriteCenter.y) * sn + spriteCenter.x, (uv.x - spriteCenter.x) * sn + (uv.y - spriteCenter.y) * cs + spriteCenter.y); + + float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(0, 0), float2(1, 1)); + + + uint currentFrame = floor(float(-1)) % float(1); + if(float(-1) < 0) + { + currentFrame = (_Time.y / (1 / float(30))) % float(1); + } + half4 flipbookColor = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * float4(0,0,0,0), currentFrame)); + + if(float(0)) + { + flipbookColor.a = poiMax(flipbookColor.rgb); + } + + + if(float(0) == 0) + { + if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0) + { + flipbookColor.a = 0; + } + } + return flipbookColor.a * float4(1,1,1,1).a; + } + return 1; + } + + #endif +#endif + diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFlipbook.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFlipbook.cginc.meta new file mode 100644 index 00000000..ad1783e8 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFlipbook.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 07612fd5d6af9e943a11ff39045a0355 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFrag.cginc new file mode 100644 index 00000000..1eb08e89 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFrag.cginc @@ -0,0 +1,376 @@ +#ifndef POIFRAG + #define POIFRAG + + float _MainEmissionStrength; + float _IgnoreFog; + half _GIEmissionMultiplier; + float _IridescenceTime; + float _AlphaToMask; + float _ForceOpaque; + float _commentIfZero_EnableGrabpass; + float _AlphaPremultiply; + float2 _MainTexPan; + float _MainTextureUV; + float _commentIfZero_LightingAdditiveEnable; + + float4 frag(v2f i, uint facing: SV_IsFrontFace): SV_Target + { + #ifdef FORWARD_ADD_PASS + #if !defined(POI_LIGHTING) + return 0; + #endif + #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) && defined(DIRECTIONAL) + return 0; + #endif + #endif + #ifdef FORWARD_ADD_PASS + + if (float(1) == 0) + { + return 0; + } + #endif + UNITY_SETUP_INSTANCE_ID(i); + // Color + float4 albedo = 1; + float4 finalColor = 1; + + // Lighting + float bakedCubemap = 0; // Whether or not metallic should run before or after lighting multiplication + float3 finalSpecular0 = 0; + float3 finalSpecular1 = 0; + float3 finalSSS = 0; + fixed lightingAlpha = 1; + float3 finalEnvironmentalRim = 0; + + // Emissions + float3 finalEmission = 0; + float3 finalLighting = 1; + float3 IridescenceEmission = 0; + float3 spawnInEmission = 0; + float3 voronoiEmission = 0; + float3 matcapEmission = 0; + float3 depthTouchEmission = 0; + float3 decalEmission = 0; + float3 glitterEmission = 0; + float3 panosphereEmission = 0; + float3 backFaceEmission = 0; + float3 dissolveEmission = 0; + float3 rimLightEmission = 0; + float3 flipbookEmission = 0; + float3 textOverlayEmission = 0; + float3 videoEmission = 0; + /********************************************************************** + Initialize the base data that's needed everywhere else in the shader + **********************************************************************/ + calculateAttenuation(i); + InitializeMeshData(i, facing); + initializeCamera(i); + calculateTangentData(); + + + #ifdef POI_BLACKLIGHT + createBlackLightMask(); + + if (_BlackLightMaskDebug) + { + return float4(blackLightMask.rgb, 1); + } + #endif + + // This has to happen in the initializbecause it alters UV data globally + #ifdef POI_PARALLAX + calculateandApplyParallax(); + #endif + + // Basically every texture relies on the maintex sampler to function and that's why this is here. + float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _MainTex) + _Time.x * float4(0,0,0,0)); + half3 detailMask = 1; + calculateNormals(detailMask); + calculateVertexLightingData(i); + /********************************************************************** + Calculate Light Maps + **********************************************************************/ + #ifdef POI_DATA + calculateLightingData(i); + #endif + #ifdef POI_LIGHTING + calculateBasePassLightMaps(); + #endif + + /********************************************************************** + Calculate Color Data + **********************************************************************/ + + initTextureData(albedo, mainTexture, backFaceEmission, dissolveEmission, detailMask); + + #ifdef POI_DECAL + applyDecal(albedo, decalEmission); + #endif + + + #ifdef POI_IRIDESCENCE + + if (_IridescenceTime == 0) + { + applyIridescence(albedo, IridescenceEmission); + } + #endif + + #ifdef POI_VORONOI + applyVoronoi(albedo, voronoiEmission); + #endif + + #ifdef POI_MSDF + ApplyTextOverlayColor(albedo, textOverlayEmission); + #endif + + #ifdef POI_ENVIRONMENTAL_RIM + finalEnvironmentalRim = calculateEnvironmentalRimLighting(albedo); + #endif + + #if defined(POI_METAL) || defined(POI_CLEARCOAT) + CalculateReflectionData(); + #endif + + #ifdef POI_DATA + distanceFade(albedo); + #endif + + #ifdef POI_RANDOM + albedo.a *= i.angleAlpha; + #endif + + #ifdef MATCAP + applyMatcap(albedo, matcapEmission); + #endif + + #ifdef PANOSPHERE + applyPanosphereColor(albedo, panosphereEmission); + #endif + + #ifdef POI_FLIPBOOK + applyFlipbook(albedo, flipbookEmission); + #endif + + #ifdef POI_GLITTER + applyGlitter(albedo, glitterEmission); + #endif + + #ifdef POI_RIM + applyRimLighting(albedo, rimLightEmission); + #endif + + #ifdef POI_DEPTH_COLOR + applyDepthColor(albedo, depthTouchEmission, finalEmission, i.worldDirection); + #endif + + #ifdef POI_IRIDESCENCE + + if(_IridescenceTime == 1) + { + applyIridescence(albedo, IridescenceEmission); + } + #endif + + #ifdef POI_VIDEO + applyScreenEffect(albedo, videoEmission); + #endif + + applySpawnIn(albedo, spawnInEmission, poiMesh.uv[0], poiMesh.localPos); + + /********************************************************************** + Handle a few alpha options + **********************************************************************/ + + if (float(1) == 1) + { + + if(float(1) == 0) + { + applyDithering(albedo); + } + } + + albedo.a = max(float(0), albedo.a); + + + if(float(1) >= 1) + { + clip(albedo.a - float(0.5)); + } + + + if(float(0)) + { + albedo.rgb *= saturate(albedo.a + 0.0000000001); + } + + /********************************************************************** + Lighting Time :) + **********************************************************************/ + + #ifdef POI_LIGHTING + finalLighting = calculateFinalLighting(albedo.rgb, finalColor); + + #ifdef SUBSURFACE + finalSSS = calculateSubsurfaceScattering(); + #endif + #endif + + float4 finalColorBeforeLighting = albedo; + finalColor = finalColorBeforeLighting; + + #ifdef POI_SPECULAR + finalSpecular0 = calculateSpecular(finalColorBeforeLighting); + #endif + #ifdef POI_PARALLAX + calculateAndApplyInternalParallax(finalColor); + #endif + + #ifdef POI_ALPHA_TO_COVERAGE + ApplyAlphaToCoverage(finalColor); + #endif + + + if (float(1) == 1) + { + + if(float(1) == 1) + { + applyDithering(finalColor); + } + } + + #ifdef POI_METAL + calculateMetallicness(); + bool probeExists = shouldMetalHappenBeforeLighting(); + + if(!probeExists) + { + ApplyMetallicsFake(finalColor, albedo); + } + #endif + + #ifdef POI_LIGHTING + #if defined(FORWARD_ADD_PASS) && defined(POI_METAL) + finalLighting *= 1 - metalicMap; + #endif + #endif + + #ifdef VERTEXLIGHT_ON + finalColor.rgb *= finalLighting + poiLight.vFinalLighting; + #else + finalColor.rgb *= finalLighting; + #endif + + #ifdef POI_METAL + + if(probeExists) + { + ApplyMetallics(finalColor, albedo); + } + #endif + + finalColor.rgb += finalSpecular0 + finalEnvironmentalRim + finalSSS; + + #ifdef FORWARD_BASE_PASS + #ifdef POI_CLEARCOAT + calculateAndApplyClearCoat(finalColor); + #endif + #endif + + finalColor.a = saturate(finalColor.a); + + /********************************************************************** + Add Up all the emission values :D + **********************************************************************/ + #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS) + finalEmission += finalColorBeforeLighting.rgb * float(0) * albedo.a; + finalEmission += wireframeEmission; + finalEmission += IridescenceEmission; + finalEmission += spawnInEmission; + finalEmission += voronoiEmission; + finalEmission += matcapEmission; + finalEmission += depthTouchEmission; + finalEmission += decalEmission; + finalEmission += glitterEmission; + finalEmission += panosphereEmission; + finalEmission += backFaceEmission; + finalEmission += rimLightEmission; + finalEmission += flipbookEmission; + finalEmission += videoEmission; + finalEmission += textOverlayEmission; + finalEmission += dissolveEmission; + #ifdef POI_EMISSION + finalEmission += calculateEmissionNew(finalColorBeforeLighting, finalColor); + #endif + #endif + + /********************************************************************** + Meta Pass Hype :D + **********************************************************************/ + #ifdef POI_META_PASS + UnityMetaInput meta; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta); + meta.Emission = finalEmission * float(1); + meta.Albedo = saturate(finalColor.rgb); + #ifdef POI_SPECULAR + meta.SpecularColor = poiLight.color.rgb * float4(1,1,1,1).rgb * lerp(1, albedo.rgb, float(1)) * float4(1,1,1,1).a; + #else + meta.SpecularColor = poiLight.color.rgb * albedo.rgb; + #endif + return UnityMetaFragment(meta); + #endif + + /********************************************************************** + Apply Emission to finalColor + **********************************************************************/ + finalColor.rgb += finalEmission; + + /********************************************************************** + Grabpass features + **********************************************************************/ + + + if (_commentIfZero_EnableGrabpass) + { + applyGrabEffects(finalColor); + } + + /********************************************************************** + Unity Fog + **********************************************************************/ + #ifdef FORWARD_BASE_PASS + + if (float(0) == 0) + { + UNITY_APPLY_FOG(i.fogCoord, finalColor); + } + #endif + + #ifdef FORWARD_ADD_PASS + if(float(1) > 0) + { + finalColor.rgb *= finalColor.a; + } + #endif + + + if(float(1) == 0) + { + finalColor.a = 1; + } + + #ifdef FORWARD_ADD_PASS + //finalColor.rgb = smoothstep(float(0), float(0.5), 1 - (.5 * poiLight.nDotL + .5)); + #endif + + #ifdef POI_DEBUG + displayDebugInfo(finalColor); + #endif + + //finalColor.rgb = frac(finalColor.rgb); + return finalColor; + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFrag.cginc.meta new file mode 100644 index 00000000..54d7b38c --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFrag.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5cd5ddf0ad898d04aa6dacd3224f6084 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFur.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFur.cginc new file mode 100644 index 00000000..8d260cdf --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFur.cginc @@ -0,0 +1,41 @@ +#ifndef POI_FUR + #define POI_FUR + + UNITY_DECLARE_TEX2D_NOSAMPLER(_FurTexture); float4 _FurTexture_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_FurHeightMap); float4 _FurHeightMap_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_FurMask); float4 _FurMask_ST; + float _FurAO; + float4 _FurColor; + float _FurLayers; + float _FurMinDistance; + float _FurMaxDistance; + float _FurHeightMapMin; + float _FurHeightMapMax; + float _FurDebug; + float _AoRampMin; + float _AoRampMax; + float _FurTipAlpha; + float _FurFadeStart; + + //globals + half furHeightMap; + half furMask; + + void calculateFur() + { + + furHeightMap = UNITY_SAMPLE_TEX2D_SAMPLER(_FurHeightMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurHeightMap)).x; + furHeightMap = remap(furHeightMap, 0, _FurHeightMapMax, _FurHeightMapMin, 1); + furMask = poiMax(UNITY_SAMPLE_TEX2D_SAMPLER(_FurMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurMask)).xyz); + half3 furTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_FurTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurTexture)); + clip(furHeightMap - poiMesh.furAlpha); + clip(furMask - poiMesh.furAlpha); + + albedo.rgb = lerp(mainTexture.rgb, furTexture.rgb * _FurColor.rgb, ceil(poiMesh.furAlpha)); + float aoRampMax = _AoRampMax - (1 - furMask); + albedo.rgb *= lerp(1, smoothstep(_AoRampMin, aoRampMax, furHeightMap), _FurAO); + + albedo.a *= smoothstep(1.01, _FurTipAlpha, remapClamped(poiMesh.furAlpha, _FurFadeStart, 1, 0, 1)) + float(0); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFur.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFur.cginc.meta new file mode 100644 index 00000000..77d3f05a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiFur.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d057fbd0447d9254a861aa871511bc0d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGeomFur.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGeomFur.cginc new file mode 100644 index 00000000..032f3b08 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGeomFur.cginc @@ -0,0 +1,37 @@ +float _FurLength; +float _FurGravityStrength; + +[instance(4)] +[maxvertexcount(20)] +void geomFur(triangle v2f IN[3], inout TriangleStream < v2f > tristream, uint InstanceID : SV_GSInstanceID) +{ + float4 fur_worldPos[3]; + v2f o_fur[3]; + float3 offset = (float3(0, -1, 0) * (_FurLength*.9) *_FurGravityStrength); + + for (int i = 0; i < 3; i++) + { + if (InstanceID == 0) { + IN[i].furAlpha = 0; + tristream.Append(IN[i]); + } + o_fur[i] = IN[i]; + fur_worldPos[i] = float4(IN[i].worldPos + IN[i].normal * _FurLength, 1); + } + if (InstanceID == 0) { + tristream.RestartStrip(); + } + int Total_FurLayers = clamp(floor(_FurLayers * (1 - smoothstep(_FurMinDistance, _FurMaxDistance, distance(IN[0].worldPos, getCameraPosition())))), min(1, _FurLayers), _FurLayers); + + int startLayer = max(int(InstanceID) * 6 - 1, 0); + for (int layer = startLayer; layer < Total_FurLayers; layer++) { + for (int i = 0; i < 3; i++) { + o_fur[i].furAlpha = float(layer) / Total_FurLayers; + o_fur[i].worldPos = float4(lerp(IN[i].worldPos, fur_worldPos[i] + offset * o_fur[i].furAlpha, o_fur[i].furAlpha),1); + o_fur[i].pos = UnityWorldToClipPos(o_fur[i].worldPos); + o_fur[i].furAlpha += .01; + tristream.Append(o_fur[i]); + } + tristream.RestartStrip(); + } +} diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGeomFur.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGeomFur.cginc.meta new file mode 100644 index 00000000..f2317a24 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGeomFur.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3d29cc9a9f36fb543963be9d6a557952 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGlitter.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGlitter.cginc new file mode 100644 index 00000000..e31b6498 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGlitter.cginc @@ -0,0 +1,232 @@ +#ifndef POI_GLITTER + #define POI_GLITTER + + half3 _GlitterColor; + POI_TEXTURE_NOSAMPLER(_GlitterMask); + float2 _GlitterPan; + POI_TEXTURE_NOSAMPLER(_GlitterColorMap); + POI_TEXTURE_NOSAMPLER(_GlitterTexture); + half _GlitterSpeed; + half _GlitterBrightness; + float _GlitterFrequency; + float _GlitterJitter; + half _GlitterSize; + half _GlitterContrast; + half _GlitterAngleRange; + half _GlitterMinBrightness; + half _GlitterBias; + float _GlitterRandomColors; + float2 _GlitterMinMaxSaturation; + float2 _GlitterMinMaxBrightness; + fixed _GlitterUseSurfaceColor; + float _GlitterBlendType; + float _GlitterMode; + float _GlitterShape; + float _GlitterCenterSize; + float _glitterFrequencyLinearEmissive; + float _GlitterJaggyFix; + float _GlitterRandomRotation; + float _GlitterTextureRotation; + float4 _GlitterMinMaxSize; + float _GlitterRandomSize; + + + float3 randomFloat3(float2 Seed, float maximum) + { + return(.5 + float3( + frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453), + frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453), + frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453) + ) * .5) * (maximum); + } + + float3 randomFloat3Range(float2 Seed, float Range) + { + return(float3( + frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453), + frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453), + frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) + ) * 2 - 1) * Range; + } + + float3 randomFloat3WiggleRange(float2 Seed, float Range) + { + float3 rando = (float3( + frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453), + frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453), + frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) + ) * 2 - 1); + float speed = 1 + float(10); + return float3(sin((_Time.x + rando.x * pi) * speed), sin((_Time.x + rando.y * pi) * speed), sin((_Time.x + rando.z * pi) * speed)) * Range; + } + + void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out) + { + float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453); + Out = lerp(Min, Max, randomno); + } + + float3 RandomColorFromPoint(float2 rando) + { + fixed hue = random2(rando.x + rando.y).x; + fixed saturation = lerp(float4(0.8,1,0,1).x, float4(0.8,1,0,1).y, rando.x); + fixed value = lerp(float4(0.8,1,0,1).x, float4(0.8,1,0,1).y, rando.y); + float3 hsv = float3(hue, saturation, value); + return HSVtoRGB(hsv); + } + + void applyGlitter(inout float4 albedo, inout float3 glitterEmission) + { + + + // Scale + float2 st = poiMesh.uv[0] * float(300); + + // Tile the space + float2 i_st = floor(st); + float2 f_st = frac(st); + + float m_dist = 10.; // minimun distance + float2 m_point = 0; // minimum point + float2 randoPoint = 0; + float2 dank; + for (int j = -1; j <= 1; j ++) + { + for (int i = -1; i <= 1; i ++) + { + float2 neighbor = float2(i, j); + float2 pos = random2(i_st + neighbor); + float2 rando = pos; + pos = 0.5 + 0.5 * sin(float(1) * 6.2831 * pos); + float2 diff = neighbor + pos - f_st; + float dist = length(diff); + + if (dist < m_dist) + { + dank = diff; + m_dist = dist; + m_point = pos; + randoPoint = rando; + } + } + } + + float randomFromPoint = random(randoPoint); + + float size = float(0.3); + + if(float(0)) + { + size = remapClamped(randomFromPoint, 0, 1, float4(0.1,0.5,0,1).x, float4(0.1,0.5,0,1).y); + } + + + // Assign a color using the closest point position + //color += dot(m_point, float2(.3, .6)); + + // Add distance field to closest point center + // color.g = m_dist; + + // Show isolines + //color -= abs(sin(40.0 * m_dist)) * 0.07; + + // Draw cell center + half glitterAlpha = 1; + switch(float(0)) + { + case 0: //circle + glitterAlpha = (1. - step(size, m_dist)); + break; + case 1: //sqaure + float jaggyFix = pow(poiCam.distanceToVert, 2) * float(0); + + + if (float(0)) + { + float2 center = float2(0, 0); + float theta = radians((random(randoPoint) + _Time.x * float(0)) * 360); + float cs = cos(theta); + float sn = sin(theta); + dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y); + glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y))); + } + else + { + glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y))); + } + break; + } + + float3 finalGlitter = 0; + + switch(float(0)) + { + case 0: + float3 randomRotation = 0; + + if(float(10) > 0) + { + randomRotation = randomFloat3WiggleRange(randoPoint, float(90)); + } + else + { + randomRotation = randomFloat3Range(randoPoint, float(90)); + } + float3 norm = poiMesh.normals[0]; + + float3 glitterReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm)); + finalGlitter = lerp(0, float(0) * glitterAlpha, glitterAlpha) + max(pow(saturate(dot(lerp(glitterReflectionDirection, poiCam.viewDir, float(0.8)), poiCam.viewDir)), float(300)), 0); + finalGlitter *= glitterAlpha; + break; + case 1: + float offset = random(randoPoint); + float brightness = sin((_Time.x + offset) * float(10)) * float(20) - (float(20) - 1); + finalGlitter = max(float(0) * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * float(0.08) * 10)); + break; + } + + + half3 glitterColor = float4(1,1,1,1); + glitterColor *= lerp(1, albedo, float(0)); + glitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).rgb; + + float2 uv = remapClamped(dank, -size, size, 0, 1); + + if(float(0) && !float(0)) + { + float2 fakeUVCenter = float2(.5, .5); + float theta = radians((random(randoPoint) + _Time.x * float(0)) * 360); + float cs = cos(theta); + float sn = sin(theta); + uv = float2((uv.x - fakeUVCenter.x) * cs - (uv.y - fakeUVCenter.y) * sn + fakeUVCenter.x, (uv.x - fakeUVCenter.x) * sn + (uv.y - fakeUVCenter.y) * cs + fakeUVCenter.y); + } + float4 glitterTexture = POI2D_SAMPLER_PAN(_GlitterTexture, _MainTex, uv, float4(0,0,0,0)); + //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv)); + glitterColor *= glitterTexture.rgb; + float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + #ifdef POI_BLACKLIGHT + if (_BlackLightMaskGlitter != 4) + { + glitterMask *= blackLightMask[_BlackLightMaskGlitter]; + } + #endif + + if(float(0)) + { + glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y)); + } + + + if(float(0) == 1) + { + albedo.rgb = lerp(albedo.rgb, finalGlitter * glitterColor * float(3), finalGlitter * glitterTexture.a * glitterMask); + glitterEmission = finalGlitter * glitterColor * max(0, (float(3) - 1) * glitterTexture.a) * glitterMask; + } + else + { + glitterEmission = finalGlitter * glitterColor * float(3) * glitterTexture.a * glitterMask; + } + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGlitter.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGlitter.cginc.meta new file mode 100644 index 00000000..1a96b442 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGlitter.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0f361daa9d0023b418261d032bc32015 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGrab.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGrab.cginc new file mode 100644 index 00000000..060cb720 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGrab.cginc @@ -0,0 +1,127 @@ +#ifndef POI_GRAB + #define POI_GRAB + + float _RefractionIndex; + float _RefractionOpacity; + float _RefractionChromaticAberattion; + float _RefractionEnabled; + float _GrabSrcBlend; + float _GrabDstBlend; + float _GrabPassUseAlpha; + float _GrabPassBlendFactor; + float _GrabBlurDistance; + float _GrabBlurQuality; + float _GrabBlurDirections; + POI_TEXTURE_NOSAMPLER(_GrabPassBlendMap); + + UNITY_DECLARE_TEX2D_NOSAMPLER(_RefractionOpacityMask); float4 _RefractionOpacityMask_ST; + + float4 blur(float2 uv) + { + float two_pi = 6.28318530718; + + float2 radius = _GrabBlurDistance / _ScreenParams.xy * 100; // Arbitrary constant to match old blur + float quality = floor(_GrabBlurQuality); + float directions = floor(_GrabBlurDirections); + + // Pixel colour + float4 color = tex2D(_PoiGrab, uv); + + float deltaAngle = two_pi / directions; + float deltaQuality = 1.0 / quality; + for (int i = 0; i < directions; i ++) + { + for (int j = 0; j < quality; j ++) + { + float angle = deltaAngle * i + j; + float offset = deltaQuality * (j + 1); + color += tex2D(_PoiGrab, uv + float2(cos(angle), sin(angle)) * radius * offset); + } + } + + // Output to screen + color /= quality * directions + 1; + return color; + } + + inline float4 Refraction(float indexOfRefraction, float chromaticAberration, float2 projectedGrabPos) + { + float4 refractionColor; + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(poiMesh.worldPos)); + float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.normals[1], 0.0))) * (1.0 / (poiCam.grabPos.z + 1.0))) * (1.0 - dot(poiMesh.normals[1], worldViewDir))); + float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x)); + + + if (_RefractionChromaticAberattion > 0) + { + float4 redAlpha = tex2D(_PoiGrab, (projectedGrabPos + cameraRefraction)); + float green = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 - chromaticAberration)))).g; + float blue = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 + chromaticAberration)))).b; + refractionColor = float4(redAlpha.r, green, blue, redAlpha.a); + } + else + { + float2 refractedGrab = projectedGrabPos + cameraRefraction; + + #ifdef CHROMATIC_ABERRATION_LOW + refractionColor = blur(refractedGrab); + #else + refractionColor = tex2D(_PoiGrab, (refractedGrab)); + #endif + } + return refractionColor; + } + + void calculateRefraction(float2 projectedGrabPos, inout float4 finalColor) + { + float3 refraction = 1; + + if(_RefractionEnabled == 1) + { + refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos).rgb; + } + else + { + #ifdef CHROMATIC_ABERRATION_LOW + refraction = blur(projectedGrabPos); + #else + refraction = tex2Dproj(_PoiGrab, poiCam.grabPos); + #endif + } + + float blendFactor = _GrabPassBlendFactor * POI2D_SAMPLER_PAN(_GrabPassBlendMap, _MainTex, poiMesh.uv[_GrabPassBlendMapUV], _GrabPassBlendMapPan).r; + + if(_GrabPassUseAlpha) + { + finalColor = poiBlend(_GrabSrcBlend, finalColor, _GrabDstBlend, float4(refraction, 1), blendFactor * (1 - finalColor.a)); + finalColor.a = 1; + } + else + { + finalColor = poiBlend(_GrabSrcBlend, finalColor, _GrabDstBlend, float4(refraction, 1), blendFactor); + } + } + + float2 calculateGrabPosition() + { + float4 grabPos = poiCam.grabPos; + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float halfPosW = grabPos.w * 0.5; + grabPos.y = (grabPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW; + #if SHADER_API_D3D9 || SHADER_API_D3D11 + grabPos.w += 0.00000000001; + #endif + return(grabPos / grabPos.w).xy; + } + + void applyGrabEffects(inout float4 finalColor) + { + float2 projectedGrabPos = calculateGrabPosition(); + calculateRefraction(projectedGrabPos, finalColor); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGrab.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGrab.cginc.meta new file mode 100644 index 00000000..1bab287d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiGrab.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 901bb9c7a73d0c04dad98990286c6b24 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHelpers.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHelpers.cginc new file mode 100644 index 00000000..9ae9e754 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHelpers.cginc @@ -0,0 +1,338 @@ +#ifndef POI_HELPER + #define POI_HELPER + + #include "CGI_PoiColors.cginc" + + #ifndef pi + #define pi float(3.14159265359) + #endif + + float linearSin(float x) + { + return pow(min(cos(pi * x / 2.0), 1.0 - abs(x)), 1.0); + } + + float random(float2 p) + { + return frac(sin(dot(p, float2(12.9898, 78.2383))) * 43758.5453123); + } + + float2 random2(float2 p) + { + return frac(sin(float2(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)))) * 43758.5453); + } + + float3 random3(float3 p) + { + return frac(sin(float3(dot(p, float3(127.1, 311.7, 248.6)), dot(p, float3(269.5, 183.3, 423.3)), dot(p, float3(248.3, 315.9, 184.2)))) * 43758.5453); + } + + float3 mod(float3 x, float y) + { + return x - y * floor(x / y); + } + float2 mod(float2 x, float y) + { + return x - y * floor(x / y); + } + + //1/7 + #define K 0.142857142857 + //3/7 + #define Ko 0.428571428571 + + // Permutation polynomial: (34x^2 + x) mod 289 + float3 Permutation(float3 x) + { + return mod((34.0 * x + 1.0) * x, 289.0); + } + + bool IsInMirror() + { + return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f; + } + + float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) + { + #if UNITY_SPECCUBE_BOX_PROJECTION + + if (cubemapPosition.w > 0) + { + float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction; + float scalar = min(min(factors.x, factors.y), factors.z); + direction = direction * scalar + (position - cubemapPosition); + } + #endif + return direction; + } + + // Camera + float3 getCameraPosition() + { + #ifdef USING_STEREO_MATRICES + return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5); + #endif + return _WorldSpaceCameraPos; + } + + float3 getCameraForward() + { + #if UNITY_SINGLE_PASS_STEREO + float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1)); + float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1)); + #else + float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)); + float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)); + #endif + return normalize(p2 - p1); + } + + float3 grayscale_vector_node() + { + return float3(0, 0.3823529, 0.01845836); + } + + float3 grayscale_for_light() + { + return float3(0.298912, 0.586611, 0.114478); + } + + //Math Operators + + float remap(float x, float minOld, float maxOld, float minNew, float maxNew) + { + return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); + } + + float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew) + { + return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); + } + + float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew) + { + return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); + } + + float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew) + { + return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); + } + + float remapClamped(float x, float minOld, float maxOld, float minNew, float maxNew) + { + return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); + } + + float2 remapClamped(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew) + { + return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); + } + + float3 remapClamped(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew) + { + return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); + } + + float4 remapClamped(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew) + { + return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); + } + + float poiMax(float2 i) + { + return max(i.x, i.y); + } + + float poiMax(float3 i) + { + return max(max(i.x, i.y), i.z); + } + + float poiMax(float4 i) + { + return max(max(max(i.x, i.y), i.z), i.w); + } + + float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis) + { + axis = normalize(axis); + float s = sin(angle); + float c = cos(angle); + float oc = 1.0 - c; + + return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0, + oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0, + oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0, + 0.0, 0.0, 0.0, 1.0); + } + + float4x4 poiRotationMatrixFromAngles(float x, float y, float z) + { + float angleX = radians(x); + float c = cos(angleX); + float s = sin(angleX); + float4x4 rotateXMatrix = float4x4(1, 0, 0, 0, + 0, c, -s, 0, + 0, s, c, 0, + 0, 0, 0, 1); + + float angleY = radians(y); + c = cos(angleY); + s = sin(angleY); + float4x4 rotateYMatrix = float4x4(c, 0, s, 0, + 0, 1, 0, 0, + - s, 0, c, 0, + 0, 0, 0, 1); + + float angleZ = radians(z); + c = cos(angleZ); + s = sin(angleZ); + float4x4 rotateZMatrix = float4x4(c, -s, 0, 0, + s, c, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); + } + + float4x4 poiRotationMatrixFromAngles(float3 angles) + { + float angleX = radians(angles.x); + float c = cos(angleX); + float s = sin(angleX); + float4x4 rotateXMatrix = float4x4(1, 0, 0, 0, + 0, c, -s, 0, + 0, s, c, 0, + 0, 0, 0, 1); + + float angleY = radians(angles.y); + c = cos(angleY); + s = sin(angleY); + float4x4 rotateYMatrix = float4x4(c, 0, s, 0, + 0, 1, 0, 0, + - s, 0, c, 0, + 0, 0, 0, 1); + + float angleZ = radians(angles.z); + c = cos(angleZ); + s = sin(angleZ); + float4x4 rotateZMatrix = float4x4(c, -s, 0, 0, + s, c, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); + } + +#endif + +half2 calcScreenUVs(half4 grabPos) +{ + half2 uv = grabPos / (grabPos.w + 0.0000000001); + #if UNITY_SINGLE_PASS_STEREO + uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y); + #else + uv.xy *= _ScreenParams.xy; + #endif + + return uv; +} + +float inverseLerp(float A, float B, float T) +{ + return(T - A) / (B - A); +} + +float inverseLerp2(float2 a, float2 b, float2 value) +{ + float2 AB = b - a; + float2 AV = value - a; + return dot(AV, AB) / dot(AB, AB); +} + +float inverseLerp3(float3 a, float3 b, float3 value) +{ + float3 AB = b - a; + float3 AV = value - a; + return dot(AV, AB) / dot(AB, AB); +} + +float inverseLerp4(float4 a, float4 b, float4 value) +{ + float4 AB = b - a; + float4 AV = value - a; + return dot(AV, AB) / dot(AB, AB); +} + +// Dithering +inline half Dither8x8Bayer(int x, int y) +{ + const half dither[ 64 ] = { + 1, 49, 13, 61, 4, 52, 16, 64, + 33, 17, 45, 29, 36, 20, 48, 32, + 9, 57, 5, 53, 12, 60, 8, 56, + 41, 25, 37, 21, 44, 28, 40, 24, + 3, 51, 15, 63, 2, 50, 14, 62, + 35, 19, 47, 31, 34, 18, 46, 30, + 11, 59, 7, 55, 10, 58, 6, 54, + 43, 27, 39, 23, 42, 26, 38, 22 + }; + int r = y * 8 + x; + return dither[r] / 64; +} + +// UV Manipulation +float2 TransformUV(half2 offset, half rotation, half2 scale, float2 uv) +{ + float theta = radians(rotation); + scale = 1 - scale; + float cs = cos(theta); + float sn = sin(theta); + float2 centerPoint = offset + .5; + uv = float2((uv.x - centerPoint.x) * cs - (uv.y - centerPoint.y) * sn + centerPoint.x, (uv.x - centerPoint.x) * sn + (uv.y - centerPoint.y) * cs + centerPoint.y); + + return remap(uv, float2(0, 0) + offset + (scale * .5), float2(1, 1) + offset - (scale * .5), float2(0, 0), float2(1, 1)); +} + +bool isVR() +{ + // USING_STEREO_MATRICES + #if UNITY_SINGLE_PASS_STEREO + return true; + #else + return false; + #endif +} + +bool isVRHandCamera() +{ + return !isVR() && abs(UNITY_MATRIX_V[0].y) > 0.0000005; +} + +bool isDesktop() +{ + return !isVRHandCamera(); +} + +bool isVRHandCameraPreview() +{ + return isVRHandCamera() && _ScreenParams.y == 720; +} + +bool isVRHandCameraPicture() +{ + return isVRHandCamera() && _ScreenParams.y == 1080; +} + +bool isPanorama() +{ + // Crude method + // FOV=90=camproj=[1][1] + return unity_CameraProjection[1][1] == 1 && _ScreenParams.x == 1075 && _ScreenParams.y == 1025; +} + +float3 calculateluminance(float3 color) +{ + return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; +} diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHelpers.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHelpers.cginc.meta new file mode 100644 index 00000000..ae637ad5 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHelpers.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b830f5ccdb0d49e4f9451b14de107180 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHologram.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHologram.cginc new file mode 100644 index 00000000..6ee66d3a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHologram.cginc @@ -0,0 +1,36 @@ +#ifndef POI_HOLOGRAM + #define POI_HOLOGRAM + + UNITY_DECLARE_TEX2D_NOSAMPLER(_HoloAlphaMap); float4 _HoloAlphaMap_ST; + float _HoloCoordinateSpace; // 0 World, 1 Local, 2 UV + float3 _HoloDirection; + float _HoloScrollSpeed; + float _HoloLineDensity; + + fixed _HoloFresnelAlpha; + fixed _HoloRimSharpness; + fixed _HoloRimWidth; + void ApplyHoloAlpha(inout float4 color) + { + float uv = 0; + + if (_HoloCoordinateSpace == 0) + { + uv = dot(normalize(_HoloDirection), poiMesh.worldPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed; + } + + if(_HoloCoordinateSpace == 1) + { + uv = dot(normalize(_HoloDirection), poiMesh.localPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed; + } + + if(_HoloCoordinateSpace == 2) + { + uv = dot(_HoloDirection, poiMesh.uv[0] * _HoloLineDensity) + _Time.x * _HoloScrollSpeed; + } + float holoRim = saturate(1 - smoothstep(min(_HoloRimSharpness, _HoloRimWidth), _HoloRimWidth, poiCam.viewDotNormal)); + holoRim = abs(lerp(1, holoRim, _HoloFresnelAlpha)); + color.a *= UNITY_SAMPLE_TEX2D_SAMPLER(_HoloAlphaMap, _MainTex, uv).r * holoRim; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHologram.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHologram.cginc.meta new file mode 100644 index 00000000..2071e815 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiHologram.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1f2a00d8169e98c418b45c3c6981a49e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiIridescence.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiIridescence.cginc new file mode 100644 index 00000000..bcea8ccc --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiIridescence.cginc @@ -0,0 +1,61 @@ +#ifndef POI_IRIDESCENCE + #define POI_IRIDESCENCE + + UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceRamp); float4 _IridescenceRamp_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceMask); float4 _IridescenceMask_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceNormalMap); float4 _IridescenceNormalMap_ST; + float _IridescenceNormalUV; + float _IridescenceMaskUV; + float _IridescenceNormalSelection; + float _IridescenceNormalIntensity; + float _IridescenceNormalToggle; + float _IridescenceIntensity; + fixed _IridescenceAddBlend; + fixed _IridescenceReplaceBlend; + fixed _IridescenceMultiplyBlend; + float _IridescenceEmissionStrength; + + //global + + float3 calculateNormal(float3 baseNormal) + { + float3 normal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceNormalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceNormalUV], _IridescenceNormalMap)), _IridescenceNormalIntensity); + return normalize( + normal.x * poiMesh.tangent + + normal.y * poiMesh.binormal + + normal.z * baseNormal + ); + } + + void applyIridescence(inout float4 albedo, inout float3 IridescenceEmission) + { + float3 normal = poiMesh.normals[_IridescenceNormalSelection]; + + // Use custom normal map + + if (_IridescenceNormalToggle) + { + normal = calculateNormal(normal); + } + + float ndotv = dot(normal, poiCam.viewDir); + + float4 iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, 1 - abs(ndotv)); + float4 iridescenceMask = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask)); + + #ifdef POI_BLACKLIGHT + if(_BlackLightMaskIridescence != 4) + { + iridescenceMask *= blackLightMask[_BlackLightMaskIridescence]; + } + #endif + + + albedo.rgb = lerp(albedo.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask); + albedo.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask); + albedo.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask)); + + IridescenceEmission = saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * _IridescenceEmissionStrength; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiIridescence.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiIridescence.cginc.meta new file mode 100644 index 00000000..bcd882a5 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiIridescence.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 15503a1aca01918499f5852d68d3ec9d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiLighting.cginc new file mode 100644 index 00000000..3a588c4e --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiLighting.cginc @@ -0,0 +1,668 @@ + +#ifndef POI_LIGHTING + #define POI_LIGHTING + + float _LightingShadingEnabled; + float _LightingRampType; + float _LightingIgnoreAmbientColor; + float _UseShadowTexture; + float _LightingEnableAO; + float _LightingDetailShadowsEnabled; + + float _LightingOnlyUnityShadows; + float _LightingMode; + float _ForceLightDirection; + float _ShadowStrength; + float _OutlineShadowStrength; + float _ShadowOffset; + float3 _LightDirection; + float _ForceShadowStrength; + float _CastedShadowSmoothing; + float _AttenuationMultiplier; + float _EnableLighting; + float _LightingControlledUseLightColor; + fixed _LightingStandardSmoothness; + fixed _LightingStandardControlsToon; + fixed _LightingMinLightBrightness; + float _LightingUseShadowRamp; + float _LightingMinShadowBrightnessRatio; + UNITY_DECLARE_TEX2D(_ToonRamp); + fixed _LightingMonochromatic; + + fixed _LightingGradientStart; + fixed _LightingGradientEnd; + float3 _LightingShadowColor; + POI_TEXTURE_NOSAMPLER(_LightingShadowTexture); + float _AOStrength; + fixed _LightingDetailStrength; + fixed _LightingAdditiveDetailStrength; + fixed _LightingNoIndirectMultiplier; + fixed _LightingNoIndirectThreshold; + float _LightingUncapped; + + float _LightingDirectColorMode; + float _LightingIndirectColorMode; + float _LightingAdditiveType; + fixed _LightingAdditiveGradientStart; + fixed _LightingAdditiveGradientEnd; + fixed _LightingAdditivePassthrough; + float _LightingDirectAdjustment; + float _LightingIndirect; + // HSL JUNK + float _LightingEnableHSL; + float _LightingShadowHue; + float _LightingShadowSaturation; + float _LightingShadowLightness; + float _LightingHSLIntensity; + /* + UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp3); + half _LightingShadowStrength3; + half _ShadowOffset3; + */ + + half4 shadowStrength; + + POI_TEXTURE_NOSAMPLER(_LightingDetailShadows); + POI_TEXTURE_NOSAMPLER(_LightingAOTex); + POI_TEXTURE_NOSAMPLER(_LightingShadowMask); + + /* + * MIT License + * + * Copyright (c) 2018 s-ilent + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + /* + * Silent's code starts here + */ + + float shEvaluateDiffuseL1Geomerics_local(float L0, float3 L1, float3 n) + { + // average energy + float R0 = max(0, L0); + + // avg direction of incoming light + float3 R1 = 0.5f * L1; + + // directional brightness + float lenR1 = length(R1); + + // linear angle between normal and direction 0-1 + //float q = 0.5f * (1.0f + dot(R1 / lenR1, n)); + //float q = dot(R1 / lenR1, n) * 0.5 + 0.5; + float q = dot(normalize(R1), n) * 0.5 + 0.5; + q = saturate(q); // Thanks to ScruffyRuffles for the bug identity. + + // power for q + // lerps from 1 (linear) to 3 (cubic) based on directionality + float p = 1.0f + 2.0f * lenR1 / R0; + + // dynamic range constant + // should vary between 4 (highly directional) and 0 (ambient) + float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0); + + return R0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)); + } + + half3 BetterSH9(half4 normal) + { + float3 indirect; + float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0; + indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal); + indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal); + indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal); + indirect = max(0, indirect); + indirect += SHEvalLinearL2(normal); + return indirect; + } + + float3 BetterSH9(float3 normal) + { + return BetterSH9(float4(normal, 1)); + } + + /* + * Standard stuff starts here + */ + UnityLight CreateLight(float3 normal, fixed detailShadowMap) + { + UnityLight light; + light.dir = poiLight.direction; + light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, float(0)) * detailShadowMap); + light.ndotl = DotClamped(normal, poiLight.direction); + return light; + } + + float FadeShadows(float attenuation) + { + #if HANDLE_SHADOWS_BLENDING_IN_GI || ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + // UNITY_LIGHT_ATTENUATION doesn't fade shadows for us. + + #if ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + attenuation = lerp(1, poiLight.attenuation, float(0)); + #endif + + float viewZ = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float shadowFadeDistance = UnityComputeShadowFadeDistance(poiMesh.worldPos, viewZ); + float shadowFade = UnityComputeShadowFade(shadowFadeDistance); + float bakedAttenuation = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + attenuation = UnityMixRealtimeAndBakedShadows( + attenuation, bakedAttenuation, shadowFade + ); + #endif + + return attenuation; + } + + void ApplySubtractiveLighting(inout UnityIndirect indirectLight) + { + #if SUBTRACTIVE_LIGHTING + poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, float(0))); + + float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz)); + float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb; + float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate; + subtractedLight = max(subtractedLight, unity_ShadowColor.rgb); + subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x); + indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse); + #endif + } + + float3 weightedBlend(float3 layer1, float3 layer2, float2 weights) + { + return(weights.x * layer1 + weights.y * layer2) / (weights.x + weights.y); + } + + UnityIndirect CreateIndirectLight(float3 normal) + { + UnityIndirect indirectLight; + indirectLight.diffuse = 0; + indirectLight.specular = 0; + + #if defined(FORWARD_BASE_PASS) + #if defined(LIGHTMAP_ON) + indirectLight.diffuse = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, poiMesh.lightmapUV.xy)); + + #if defined(DIRLIGHTMAP_COMBINED) + float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( + unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy + ); + indirectLight.diffuse = DecodeDirectionalLightmap( + indirectLight.diffuse, lightmapDirection, normal + ); + #endif + ApplySubtractiveLighting(indirectLight); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + float3 dynamicLightDiffuse = DecodeRealtimeLightmap( + UNITY_SAMPLE_TEX2D(unity_DynamicLightmap, poiMesh.lightmapUV.zw) + ); + + #if defined(DIRLIGHTMAP_COMBINED) + float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( + unity_DynamicDirectionality, unity_DynamicLightmap, + poiMesh.lightmapUV.zw + ); + indirectLight.diffuse += DecodeDirectionalLightmap( + dynamicLightDiffuse, dynamicLightmapDirection, normal + ); + #else + indirectLight.diffuse += dynamicLightDiffuse; + #endif + #endif + + #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) + #if UNITY_LIGHT_PROBE_PROXY_VOLUME + if (unity_ProbeVolumeParams.x == 1) + { + indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume( + float4(normal, 1), poiMesh.worldPos + ); + indirectLight.diffuse = max(0, indirectLight.diffuse); + #if defined(UNITY_COLORSPACE_GAMMA) + indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse); + #endif + } + else + { + indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1))); + } + #else + indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1))); + #endif + #endif + + float3 reflectionDir = reflect(-poiCam.viewDir, normal); + Unity_GlossyEnvironmentData envData; + envData.roughness = 1 - float(0); + envData.reflUVW = BoxProjection( + reflectionDir, poiMesh.worldPos.xyz, + unity_SpecCube0_ProbePosition, + unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax + ); + float3 probe0 = Unity_GlossyEnvironment( + UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData + ); + envData.reflUVW = BoxProjection( + reflectionDir, poiMesh.worldPos.xyz, + unity_SpecCube1_ProbePosition, + unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax + ); + #if UNITY_SPECCUBE_BLENDING + float interpolator = unity_SpecCube0_BoxMin.w; + + if(interpolator < 0.99999) + { + float3 probe1 = Unity_GlossyEnvironment( + UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), + unity_SpecCube0_HDR, envData + ); + indirectLight.specular = lerp(probe1, probe0, interpolator); + } + else + { + indirectLight.specular = probe0; + } + #else + indirectLight.specular = probe0; + #endif + float occlusion = 1; + + if(float(1)) + { + occlusion = lerp(1, POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(1)); + } + + indirectLight.diffuse *= occlusion; + indirectLight.diffuse = max(indirectLight.diffuse, float(0)); + indirectLight.specular *= occlusion; + #endif + + return indirectLight; + } + + /* + * Poiyomi's cool as heck code starts here :smug: + */ + + half PoiDiffuse(half NdotV, half NdotL, half LdotH) + { + half fd90 = 0.5 + 2 * LdotH * LdotH * SmoothnessToPerceptualRoughness(.5); + // Two schlick fresnel term + half lightScatter = (1 + (fd90 - 1) * Pow5(1 - NdotL)); + half viewScatter = (1 + (fd90 - 1) * Pow5(1 - NdotV)); + + return lightScatter * viewScatter; + } + + float3 ShadeSH9Indirect() + { + return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0)); + } + + float3 ShadeSH9Direct() + { + return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0)); + } + + float3 ShadeSH9Normal(float3 normalDirection) + { + return ShadeSH9(half4(normalDirection, 1.0)); + } + + half3 GetSHLength() + { + half3 x, x1; + x.r = length(unity_SHAr); + x.g = length(unity_SHAg); + x.b = length(unity_SHAb); + x1.r = length(unity_SHBr); + x1.g = length(unity_SHBg); + x1.b = length(unity_SHBb); + return x + x1; + } + + float3 calculateRealisticLighting(float4 colorToLight, fixed detailShadowMap) + { + return UNITY_BRDF_PBS(1, 0, 0, float(0), poiMesh.normals[1], poiCam.viewDir, CreateLight(poiMesh.normals[1], detailShadowMap), CreateIndirectLight(poiMesh.normals[1])); + } + + void calculateBasePassLightMaps() + { + #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS) + float AOMap = 1; + float AOStrength = 1; + float3 lightColor = poiLight.color; + /* + * Generate Basic Light Maps + */ + + bool lightExists = false; + if (all(_LightColor0.rgb >= 0.002)) + { + lightExists = true; + } + #ifndef OUTLINE + + if(float(1)) + { + AOMap = POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + AOStrength = float(1); + } + + #ifdef FORWARD_BASE_PASS + //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb))); + if (lightExists) + { + lightColor = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)); + } + else + { + lightColor = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0); + } + + //lightColor = magic * magiratio + normalLight * normaRatio; + //lightColor = magic + normalLight; + #endif + #endif + + float3 grayscale_vector = float3(.33333, .33333, .33333); + float3 ShadeSH9Plus = GetSHLength(); + float3 ShadeSH9Minus = BetterSH9(float4(0, 0, 0, 1)); + + shadowStrength = 1; + #ifndef OUTLINE + shadowStrength = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float(1); + #else + shadowStrength = float(1); + #endif + + float bw_lightColor = dot(lightColor, grayscale_vector); + float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, float(0))) + dot(ShadeSH9Normal(poiMesh.normals[1]), grayscale_vector)); + float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector); + float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector); + float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting); + + fixed detailShadow = 1; + + if (float(0)) + { + detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(1)).r; + } + + if(float(0)) + { + poiLight.lightMap = poiLight.attenuation; + } + else + { + poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting); + } + poiLight.lightMap *= detailShadow; + + /* + * Decide on light colors + */ + + float3 indirectLighting = 0; + float3 directLighting = 0; + + + + + if (float(0) == 1) + { + indirectLighting = BetterSH9(float4(poiMesh.normals[0], 1)); + } + else + { + indirectLighting = ShadeSH9Minus; + } + + poiLight.directLighting = lightColor; + poiLight.indirectLighting = indirectLighting; + + + if(float(0) == 0) + { + float3 magic = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0); + float3 normalLight = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)); + + float magiLumi = calculateluminance(magic); + float normaLumi = calculateluminance(normalLight); + float maginormalumi = magiLumi + normaLumi; + + float magiratio = magiLumi / maginormalumi; + float normaRatio = normaLumi / maginormalumi; + + float target = calculateluminance(magic * magiratio + normalLight * normaRatio); + float3 properLightColor = magic + normalLight; + float properLuminance = calculateluminance(magic + normalLight); + directLighting = properLightColor * max(0.0001, (target / properLuminance)); + } + else + { + directLighting = lightColor; + } + + + if(!float(0)) + { + float directluminance = calculateluminance(directLighting); + float indirectluminance = calculateluminance(indirectLighting); + directLighting = min(directLighting, directLighting / max(0.0001, (directluminance / 1))); + indirectLighting = min(indirectLighting, indirectLighting / max(0.0001, (indirectluminance / 1))); + } + + directLighting = lerp(directLighting, dot(directLighting, float3(0.299, 0.587, 0.114)), float(0)); + indirectLighting = lerp(indirectLighting, dot(indirectLighting, float3(0.299, 0.587, 0.114)), float(0)); + + if(max(max(indirectLighting.x, indirectLighting.y), indirectLighting.z) <= _LightingNoIndirectThreshold && max(max(directLighting.x, directLighting.y), directLighting.z) >= 0) + { + indirectLighting = directLighting * _LightingNoIndirectMultiplier; + } + + + if(float(0)) + { + float directluminance = clamp(directLighting.r * 0.299 + directLighting.g * 0.587 + directLighting.b * 0.114, 0, 1); + if(directluminance > 0) + { + indirectLighting = max(0.001, indirectLighting); + } + float indirectluminance = clamp(indirectLighting.r * 0.299 + indirectLighting.g * 0.587 + indirectLighting.b * 0.114, 0, 1); + float targetluminance = directluminance * float(0); + if(indirectluminance < targetluminance) + { + indirectLighting = indirectLighting / max(0.0001, indirectluminance / targetluminance); + } + } + + /* + * Create Shade Maps + */ + + if (float(0)) + { + switch(float(0)) + { + case 0: // Ramp Texture + { + poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + float(0)), shadowStrength.r); + + if (float(0)) + { + poiLight.finalLighting = lerp(poiLight.rampedLightMap * directLighting * lerp(1, AOMap, AOStrength), directLighting, poiLight.rampedLightMap); + } + else + { + poiLight.finalLighting = lerp(indirectLighting * lerp(1, AOMap, AOStrength), directLighting, poiLight.rampedLightMap); + } + } + break; + case 1: // Math Gradient + { + poiLight.rampedLightMap = saturate(1 - smoothstep(float(0) - .000001, float(0.5), 1 - poiLight.lightMap)); + float3 shadowColor = float4(1,1,1,1); + + if (float(0)) + { + shadowColor = 1; + } + + if(float(0)) + { + poiLight.finalLighting = lerp((directLighting * shadowColor * lerp(1, AOMap, AOStrength)), (directLighting), saturate(poiLight.rampedLightMap + 1 - float(1))); + } + else + { + poiLight.finalLighting = lerp((indirectLighting * shadowColor * lerp(1, AOMap, AOStrength)), (directLighting), saturate(poiLight.rampedLightMap + 1 - float(1))); + } + } + break; + } + } + else + { + poiLight.rampedLightMap = 1 - smoothstep(0, .5, 1 - poiLight.lightMap); + poiLight.finalLighting = directLighting; + } + + if(!float(0)) + { + poiLight.finalLighting = saturate(poiLight.finalLighting); + } + //poiLight.finalLighting *= .8; + #endif + } + + void applyShadowTexture(inout float4 albedo) + { + + if (float(0) && float(0) == 1) + { + albedo.rgb = lerp(albedo.rgb, POI2D_SAMPLER_PAN(_LightingShadowTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float4(1,1,1,1), (1 - poiLight.rampedLightMap) * shadowStrength); + } + } + + float3 calculateNonImportantLighting(float attenuation, float attenuationDotNL, float3 albedo, float3 lightColor, half dotNL) + { + fixed detailShadow = 1; + + if(float(0)) + { + detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(1)).r; + } + + if(float(1) == 0) + { + return lightColor * attenuationDotNL * detailShadow; + } + else + { + return lerp(lightColor * attenuation, lightColor * float(0.5) * attenuation, smoothstep(float(0), float(0.5), dotNL)) * detailShadow; + } + } + + + float3 calculateFinalLighting(inout float3 albedo, float4 finalColor) + { + float3 finalLighting = 1; + // Additive Lighting + #ifdef FORWARD_ADD_PASS + fixed detailShadow = 1; + + if (float(0)) + { + detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(1)).r; + } + + if(float(1) == 0) + { + finalLighting = poiLight.color * poiLight.attenuation * max(0, poiLight.nDotL) * detailShadow; + } + else + { + #if defined(POINT) || defined(SPOT) + finalLighting = lerp(poiLight.color * max(poiLight.additiveShadow, float(0.5)), poiLight.color * float(0.5), smoothstep(float(0), float(0.5), 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * detailShadow; + #else + finalLighting = lerp(poiLight.color * max(poiLight.attenuation, float(0.5)), poiLight.color * float(0.5), smoothstep(float(0), float(0.5), 1 - (.5 * poiLight.nDotL + .5))) * detailShadow; + #endif + } + #endif + + // Base and Meta Lighting + #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS) + #ifdef VERTEXLIGHT_ON + poiLight.vFinalLighting = 0; + + for (int index = 0; index < 4; index ++) + { + poiLight.vFinalLighting += calculateNonImportantLighting(poiLight.vAttenuation[index], poiLight.vAttenuationDotNL[index], albedo, poiLight.vColor[index], poiLight.vCorrectedDotNL[index]); + } + #endif + + switch(float(0)) + { + case 0: // Toon Lighting + { + // HSL Shading + + if (float(0)) + { + float3 HSLMod = float3(float(0.5) * 2 - 1, float(0.5) * 2 - 1, float(0.5) * 2 - 1) * (1 - poiLight.rampedLightMap); + albedo = lerp(albedo.rgb, ModifyViaHSL(albedo.rgb, HSLMod), float(1)); + } + + // Normal Shading + + if (float(0) > 0) + { + poiLight.finalLighting = max(0.001, poiLight.finalLighting); + float finalluminance = calculateluminance(poiLight.finalLighting); + finalLighting = max(poiLight.finalLighting, poiLight.finalLighting / max(0.0001, (finalluminance / float(0)))); + } + else + { + finalLighting = poiLight.finalLighting; + } + } + break; + case 1: // realistic + { + fixed detailShadow = 1; + + if (float(0)) + { + detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(1)).r; + } + + float3 realisticLighting = calculateRealisticLighting(finalColor, detailShadow).rgb; + finalLighting = lerp(realisticLighting, dot(realisticLighting, float3(0.299, 0.587, 0.114)), float(0)); + } + break; + } + #endif + return finalLighting; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiLighting.cginc.meta new file mode 100644 index 00000000..239d63a3 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiLighting.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b28e6469d40f211478220a7ccd604459 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMSDF.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMSDF.cginc new file mode 100644 index 00000000..c23736df --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMSDF.cginc @@ -0,0 +1,243 @@ +#ifndef POI_MSDF + #define POI_MSDF + + sampler2D _TextGlyphs; + float4 _TextGlyphs_ST; + float4 _TextGlyphs_TexelSize; + float _TextFPSUV; + float _TextTimeUV; + float _TextPositionUV; + float _TextPixelRange; + + float _TextFPSEnabled; + float _TextPositionEnabled; + float _TextTimeEnabled; + + + float4 _TextFPSColor; + half _TextFPSEmissionStrength; + fixed4 _TextFPSPadding; + half2 _TextFPSOffset; + half2 _TextFPSScale; + half _TextFPSRotation; + + fixed _TextPositionVertical; + float4 _TextPositionColor; + half _TextPositionEmissionStrength; + fixed4 _TextPositionPadding; + half2 _TextPositionOffset; + half2 _TextPositionScale; + half _TextPositionRotation; + + float4 _TextTimeColor; + half _TextTimeEmissionStrength; + fixed4 _TextTimePadding; + half2 _TextTimeOffset; + half2 _TextTimeScale; + half _TextTimeRotation; + + #define glyphWidth 0.0625 + + #define ASCII_LEFT_PARENTHESIS 40 + #define ASCII_RIGHT_PARENTHESIS 41 + #define ASCII_POSITIVE 43 + #define ASCII_PERIOD 46 + #define ASCII_NEGATIVE 45 + #define ASCII_COMMA 44 + #define ASCII_E 69 + #define ASCII_F 70 + #define ASCII_I 73 + #define ASCII_M 77 + #define ASCII_O 79 + #define ASCII_P 80 + #define ASCII_S 83 + #define ASCII_T 54 + #define ASCII_SEMICOLON 58 + + float3 globalTextEmission; + + half2 getAsciiCoordinate(float index) + { + return half2((index - 1) / 16, 1 - ((floor(index / 16 - glyphWidth)) / 16)); + } + + float median(float r, float g, float b) + { + return max(min(r, g), min(max(r, g), b)); + } + + void ApplyPositionText(inout float4 albedo, float2 uv) + { + float3 cameraPos = clamp(getCameraPosition(), -999, 999); + float3 absCameraPos = abs(cameraPos); + float totalCharacters = 20; + float positionArray[20]; + positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE; + positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48; + positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48; + positionArray[3] = floor(absCameraPos.x % 10) + 48; + positionArray[4] = ASCII_PERIOD; + positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48; + positionArray[6] = ASCII_COMMA; + positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE; + positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48; + positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48; + positionArray[10] = floor(absCameraPos.y % 10) + 48; + positionArray[11] = ASCII_PERIOD; + positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48; + positionArray[13] = ASCII_COMMA; + positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE; + positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48; + positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48; + positionArray[17] = floor(absCameraPos.z % 10) + 48; + positionArray[18] = ASCII_PERIOD; + positionArray[19] = floor((absCameraPos.z * 10) % 10) + 48; + + uv = TransformUV(float4(0,0,0,0), float(0), float4(1,1,1,1), uv); + + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) + { + return; + } + + float currentCharacter = floor(uv.x * totalCharacters); + half2 glyphPos = getAsciiCoordinate(positionArray[currentCharacter]); + + float2 startUV = float2(1 / totalCharacters * currentCharacter, 0); + float2 endUV = float2(1 / totalCharacters * (currentCharacter + 1), 1); + + fixed4 textPositionPadding = float4(0,0,0,0); + textPositionPadding *= 1 / totalCharacters; + uv = remapClamped(uv, startUV, endUV, float2(glyphPos.x + textPositionPadding.x, glyphPos.y - glyphWidth + textPositionPadding.y), float2(glyphPos.x + glyphWidth - textPositionPadding.z, glyphPos.y - textPositionPadding.w)); + + if (uv.x > glyphPos.x + glyphWidth - textPositionPadding.z - .001 || uv.x < glyphPos.x + textPositionPadding.x + .001 || uv.y > glyphPos.y - textPositionPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textPositionPadding.y + .001) + { + return; + } + + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; + float2 msdfUnit = float(4) / float4(1,1,1,1).zw; + float sigDist = median(samp.r, samp.g, samp.b) - 0.5; + sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1); + float opacity = clamp(sigDist + 0.5, 0, 1); + albedo.rgb = lerp(albedo.rgb, float4(1,0,1,1).rgb, opacity * float4(1,0,1,1).a); + globalTextEmission += float4(1,0,1,1).rgb * opacity * float(0); + } + + void ApplyTimeText(inout float4 albedo, float2 uv) + { + float instanceTime = _Time.y; + float hours = instanceTime / 3600; + float minutes = (instanceTime / 60) % 60; + float seconds = instanceTime % 60; + float totalCharacters = 8; + float timeArray[8]; + timeArray[0] = floor((hours * .1) % 10) + 48; + timeArray[1] = floor(hours % 10) + 48; + timeArray[2] = ASCII_SEMICOLON; + timeArray[3] = floor((minutes * .1) % 10) + 48; + timeArray[4] = floor(minutes % 10) + 48; + timeArray[5] = ASCII_SEMICOLON; + timeArray[6] = floor((seconds * .1) % 10) + 48; + timeArray[7] = floor(seconds % 10) + 48; + + uv = TransformUV(float4(0,0,0,0), float(0), float4(1,1,1,1), uv); + + if(uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) + { + return; + } + + float currentCharacter = floor(uv.x * totalCharacters); + half2 glyphPos = getAsciiCoordinate(timeArray[currentCharacter]); + // 0.1428571 = 1/7 = 1 / totalCharacters + float startUV = 1 / totalCharacters * currentCharacter; + float endUV = 1 / totalCharacters * (currentCharacter + 1); + fixed4 textTimePadding = float4(0,0,0,0); + textTimePadding *= 1 / totalCharacters; + uv = remapClamped(uv, float2(startUV, 0), float2(endUV, 1), float2(glyphPos.x + textTimePadding.x, glyphPos.y - glyphWidth + textTimePadding.y), float2(glyphPos.x + glyphWidth - textTimePadding.z, glyphPos.y - textTimePadding.w)); + + if (uv.x > glyphPos.x + glyphWidth - textTimePadding.z - .001 || uv.x < glyphPos.x + textTimePadding.x + .001 || uv.y > glyphPos.y - textTimePadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textTimePadding.y + .001) + { + return; + } + + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; + float2 msdfUnit = float(4) / float4(1,1,1,1).zw; + float sigDist = median(samp.r, samp.g, samp.b) - 0.5; + sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1); + float opacity = clamp(sigDist + 0.5, 0, 1); + albedo.rgb = lerp(albedo.rgb, float4(1,0,1,1).rgb, opacity * float4(1,0,1,1).a); + globalTextEmission += float4(1,0,1,1).rgb * opacity * float(0); + } + + void ApplyFPSText(inout float4 albedo, float2 uv) + { + float smoothDeltaTime = clamp(unity_DeltaTime.w, 0, 999); + float totalCharacters = 7; + float fpsArray[7]; + fpsArray[0] = ASCII_F; + fpsArray[1] = ASCII_P; + fpsArray[2] = ASCII_S; + fpsArray[3] = ASCII_SEMICOLON; + fpsArray[4] = floor((smoothDeltaTime * .01) % 10) + 48; + fpsArray[5] = floor((smoothDeltaTime * .1) % 10) + 48; + fpsArray[6] = floor(smoothDeltaTime % 10) + 48; + + uv = TransformUV(float4(0,0,0,0), float(0), float4(1,1,1,1), uv); + + if(uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) + { + return; + } + + float currentCharacter = floor(uv.x * totalCharacters); + half2 glyphPos = getAsciiCoordinate(fpsArray[currentCharacter]); + // 0.1428571 = 1/7 = 1 / totalCharacters + float startUV = 1 / totalCharacters * currentCharacter; + float endUV = 1 / totalCharacters * (currentCharacter + 1); + + fixed4 textFPSPadding = float4(0,0,0,0); + textFPSPadding *= 1 / totalCharacters; + uv = remapClamped(uv, float2(startUV, 0), float2(endUV, 1), float2(glyphPos.x + textFPSPadding.x, glyphPos.y - glyphWidth + textFPSPadding.y), float2(glyphPos.x + glyphWidth - textFPSPadding.z, glyphPos.y - textFPSPadding.w)); + + if (uv.x > glyphPos.x + glyphWidth - textFPSPadding.z - .001 || uv.x < glyphPos.x + textFPSPadding.x + .001 || uv.y > glyphPos.y - textFPSPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textFPSPadding.y + .001) + { + return; + } + + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; + float2 msdfUnit = float(4) / float4(1,1,1,1).zw; + float sigDist = median(samp.r, samp.g, samp.b) - 0.5; + sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1); + float opacity = clamp(sigDist + 0.5, 0, 1); + albedo.rgb = lerp(albedo.rgb, float4(1,1,1,1).rgb, opacity * float4(1,1,1,1).a); + globalTextEmission += float4(1,1,1,1).rgb * opacity * float(0); + } + + void ApplyTextOverlayColor(inout float4 albedo, inout float3 textOverlayEmission) + { + globalTextEmission = 0; + half positionalOpacity = 0; + #ifdef EFFECT_BUMP + + if(float(0)) + { + ApplyFPSText(albedo, poiMesh.uv[float(0)]); + } + + if(float(0)) + { + ApplyPositionText(albedo, poiMesh.uv[float(0)]); + } + + if(float(0)) + { + ApplyTimeText(albedo, poiMesh.uv[float(0)]); + } + + textOverlayEmission = globalTextEmission; + #endif + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMSDF.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMSDF.cginc.meta new file mode 100644 index 00000000..33c81376 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMSDF.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 54d3f0dad897a4d4cabd3098f34bad23 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMacros.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMacros.cginc new file mode 100644 index 00000000..ecac0805 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMacros.cginc @@ -0,0 +1,33 @@ +#ifndef POI_MACROS + #define POI_MACROS + + #define POI_TEXTURE_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV + #define POI_TEXTURE(tex) UNITY_DECLARE_TEX2D(tex##); float4 tex##_ST; float2 tex##Pan; uint tex##UV + #define POI_NORMAL_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV; float tex##Scale + + #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex) + _Time.x * pan)) + #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex))) + #define POI2D_PAN(tex, uv, pan) (tex2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan)) + #define POI2D(tex, uv) (tex2D(tex, TRANSFORM_TEX(uv, tex))) + #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, TRANSFORM_TEX(uv, tex))) + #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan)) + + #ifdef POINT + # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \ + unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xyz; \ + fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \ + fixed destName = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r; + #endif + + #ifdef SPOT + #if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) + #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)) + #else + #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = input._LightCoord + #endif + # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \ + DECLARE_LIGHT_COORD(input, worldPos); \ + fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \ + fixed destName = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz); + #endif +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMacros.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMacros.cginc.meta new file mode 100644 index 00000000..70c6356a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMacros.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9233cbc231c420c47b585cd9c5bcc6c2 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMainTex.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMainTex.cginc new file mode 100644 index 00000000..270384af --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMainTex.cginc @@ -0,0 +1,147 @@ +#ifndef POI_MAINTEXTURE + #define POI_MAINTEXTURE + + + + POI_TEXTURE_NOSAMPLER(_AlphaMask); + POI_TEXTURE_NOSAMPLER(_MainFadeTexture); + float4 _Color; + float _MainVertexColoring; + float _MainUseVertexColorAlpha; + float _Saturation; + float2 _MainDistanceFade; + half _MainMinAlpha; + float _MainHueShift; + #ifdef COLOR_GRADING_HDR + POI_TEXTURE_NOSAMPLER(_MainHueShiftMask); + float _MainHueShiftToggle; + float _MainHueShiftSpeed; + float _MainHueShiftReplace; + #endif + + #ifdef FINALPASS + POI_TEXTURE_NOSAMPLER(_DetailTex); + half _DetailTexIntensity; + half3 _DetailTint; + float _DetailBrightness; + #endif + //globals + float alphaMask; + half3 diffColor; + + #include "CGI_PoiBackFace.cginc" + + float3 wireframeEmission; + + inline FragmentCommonData SpecularSetup(float4 i_tex, inout float4 albedo) + { + half4 specGloss = 0; + half3 specColor = specGloss.rgb; + half smoothness = specGloss.a; + + half oneMinusReflectivity; + diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specColor, /*out*/ oneMinusReflectivity); + + FragmentCommonData o = (FragmentCommonData)0; + o.diffColor = diffColor; + o.specColor = specColor; + o.oneMinusReflectivity = oneMinusReflectivity; + o.smoothness = smoothness; + return o; + } + + inline FragmentCommonData FragmentSetup(float4 i_tex, half3 i_viewDirForParallax, float3 i_posWorld, inout float4 albedo) + { + i_tex = i_tex; + + FragmentCommonData o = SpecularSetup(i_tex, albedo); + o.normalWorld = float4(0, 0, 0, 1); + o.eyeVec = poiCam.viewDir; + o.posWorld = i_posWorld; + + // NOTE: shader relies on pre-multiply alpha-blend (float(1) = One, float(0) = OneMinusSrcAlpha) + o.diffColor = PreMultiplyAlpha(o.diffColor, 1, o.oneMinusReflectivity, /*out*/ o.alpha); + return o; + } + + void initTextureData(inout float4 albedo, inout float4 mainTexture, inout float3 backFaceEmission, inout float3 dissolveEmission, in half3 detailMask) + { + dissolveEmission = 0; + + #if (defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS)) + #ifdef POI_MIRROR + applyMirrorTexture(mainTexture); + #endif + #endif + + alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + mainTexture.a *= alphaMask; + + #ifndef POI_SHADOW + albedo = float4(lerp(mainTexture.rgb, dot(mainTexture.rgb, float3(0.3, 0.59, 0.11)), -float(0)) * max(float4(1,1,1,1).rgb, float3(0.000000001, 0.000000001, 0.000000001)) * lerp(1, GammaToLinearSpace(poiMesh.vertexColor.rgb), float(0)), mainTexture.a * max(float4(1,1,1,1).a, 0.0000001)); + + #ifdef POI_LIGHTING + applyShadowTexture(albedo); + #endif + + albedo *= lerp(1, poiMesh.vertexColor.a, float(0)); + #ifdef POI_RGBMASK + albedo.rgb = calculateRGBMask(albedo.rgb); + #endif + + albedo.a = saturate(float(0) + albedo.a); + + wireframeEmission = 0; + #ifdef POI_WIREFRAME + applyWireframe(wireframeEmission, albedo); + #endif + float backFaceDetailIntensity = 1; + + float mixedHueShift = float(0); + applyBackFaceTexture(backFaceDetailIntensity, mixedHueShift, albedo, backFaceEmission); + + #ifdef POI_FUR + calculateFur(); + #endif + + #ifdef COLOR_GRADING_HDR + float hueShiftAlpha = POI2D_SAMPLER_PAN(_MainHueShiftMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + + if(float(1)) + { + albedo.rgb = lerp(albedo.rgb, hueShift(albedo.rgb, mixedHueShift + float(0) * _Time.x), hueShiftAlpha); + } + else + { + albedo.rgb = hueShift(albedo.rgb, frac((mixedHueShift - (1 - hueShiftAlpha) + float(0) * _Time.x))); + } + #endif + #ifdef FINALPASS + half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).rgb * float4(1,1,1,1).rgb; + albedo.rgb *= LerpWhiteTo(detailTexture * float(1) * unity_ColorSpaceDouble.rgb, detailMask.r * float(1) * backFaceDetailIntensity); + #endif + albedo.rgb = saturate(albedo.rgb); + + #ifdef POI_HOLOGRAM + ApplyHoloAlpha(albedo); + #endif + + s = FragmentSetup(float4(poiMesh.uv[0], 1, 1), poiCam.viewDir, poiMesh.worldPos, albedo); + #endif + + #ifdef DISTORT + calculateDissolve(albedo, dissolveEmission); + #endif + } + + void distanceFade(inout float4 albedo) + { + half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + if(fadeMap) + { + half fadeValue = max(smoothstep(float4(0,0,0,0).x, float4(0,0,0,0).y, poiCam.distanceToVert), float(0)); + albedo.a *= fadeValue; + } + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMainTex.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMainTex.cginc.meta new file mode 100644 index 00000000..26e010f1 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMainTex.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ace7f2b3ae99ce4478ca73fb708021e1 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMatcap.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMatcap.cginc new file mode 100644 index 00000000..d255ce79 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMatcap.cginc @@ -0,0 +1,115 @@ +#ifndef MATCAP + #define MATCAP + + UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap); float4 _Matcap_ST; + POI_TEXTURE_NOSAMPLER(_MatcapMask); + float _MatcapMaskInvert; + float _MatcapBorder; + float4 _MatcapColor; + float _MatcapIntensity; + float _MatcapReplace; + float _MatcapMultiply; + float _MatcapAdd; + float _MatcapEnable; + float _MatcapLightMask; + float _MatcapEmissionStrength; + float _MatcapNormal; + + UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2);float4 _Matcap2_ST; + POI_TEXTURE_NOSAMPLER(_Matcap2Mask); + float _Matcap2MaskInvert; + float _Matcap2Border; + float4 _Matcap2Color; + float _Matcap2Intensity; + float _Matcap2Replace; + float _Matcap2Multiply; + float _Matcap2Add; + float _Matcap2Enable; + float _Matcap2LightMask; + float _Matcap2EmissionStrength; + float _Matcap2Normal; + + void blendMatcap(inout float4 finalColor, float add, float multiply, float replace, float4 matcapColor, float matcapMask, inout float3 matcapEmission, float emissionStrength + #ifdef POI_LIGHTING + , float matcapLightMask + #endif + #ifdef POI_BLACKLIGHT + , uint blackLightMaskIndex + #endif + ) + { + #ifdef POI_LIGHTING + if (matcapLightMask) + { + matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask); + } + #endif + #ifdef POI_BLACKLIGHT + if(blackLightMaskIndex != 4) + { + matcapMask *= blackLightMask[blackLightMaskIndex]; + } + #endif + + finalColor.rgb = lerp(finalColor.rgb, matcapColor.rgb, replace * matcapMask * matcapColor.a); + finalColor.rgb *= lerp(1, matcapColor.rgb, multiply * matcapMask * matcapColor.a); + finalColor.rgb += matcapColor.rgb * add * matcapMask * matcapColor.a; + matcapEmission += matcapColor.rgb * emissionStrength * matcapMask * matcapColor.a; + } + + void applyMatcap(inout float4 finalColor, inout float3 matcapEmission) + { + float4 matcap = 0; + float matcapMask = 0; + float4 matcap2 = 0; + float matcap2Mask = 0; + + // Both matcaps use the same coordinates + half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0))); + half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp)); + + // Matcap 1 + half2 matcapUV = half2(dot(worldViewRight, poiMesh.normals[float(1)]), dot(worldViewUp, poiMesh.normals[float(1)])) * float(0.43) + 0.5; + + matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(1,1,1,1); + matcap.rgb *= float(1.63); + matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + if (float(0)) + { + matcapMask = 1 - matcapMask; + } + + blendMatcap(finalColor, float(0), float(1), float(0), matcap, matcapMask, matcapEmission, float(0.009) + #ifdef POI_LIGHTING + , float(0) + #endif + #ifdef POI_BLACKLIGHT + , _BlackLightMaskMatcap + #endif + ); + + // Matcap 2 + + if (float(0)) + { + half2 matcapUV2 = half2(dot(worldViewRight, poiMesh.normals[float(1)]), dot(worldViewUp, poiMesh.normals[float(1)])) * float(0.43) + 0.5; + matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV2, _Matcap2)) * float4(1,1,1,1); + matcap2.rgb *= float(1); + matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + if(float(0)) + { + matcap2Mask = 1 - matcap2Mask; + } + blendMatcap(finalColor, float(0), float(0), float(0), matcap2, matcap2Mask, matcapEmission, float(0) + #ifdef POI_LIGHTING + , float(0) + #endif + #ifdef POI_BLACKLIGHT + , _BlackLightMaskMatcap2 + #endif + ); + } + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMatcap.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMatcap.cginc.meta new file mode 100644 index 00000000..1d1d10ef --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMatcap.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 92431b7fd807cd241a608f7f9f69b05f +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMath.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMath.cginc new file mode 100644 index 00000000..b2d07a38 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMath.cginc @@ -0,0 +1,104 @@ +/* +MIT License + +Copyright (c) 2019 wraikny + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +VertexTransformShader is dependent on: +*/ + +#ifndef POI_MATH + #define POI_MATH + + #ifndef pi + #define pi float(3.14159265359) + #endif + + float4 quaternion_conjugate(float4 v) + { + return float4( + v.x, -v.yzw + ); + } + + float4 quaternion_mul(float4 v1, float4 v2) + { + float4 result1 = (v1.x * v2 + v1 * v2.x); + + float4 result2 = float4( + - dot(v1.yzw, v2.yzw), + cross(v1.yzw, v2.yzw) + ); + + return float4(result1 + result2); + } + + // angle : radians + float4 get_quaternion_from_angle(float3 axis, float angle) + { + return float4( + cos(angle / 2.0), + normalize(axis) * sin(angle / 2.0) + ); + } + + float4 quaternion_from_vector(float3 inVec) + { + return float4(0.0, inVec); + } + + float degree_to_radius(float degree) + { + return( + degree / 180.0 * pi + ); + } + + float3 rotate_with_quaternion(float3 inVec, float3 rotation) + { + float4 qx = get_quaternion_from_angle(float3(1, 0, 0), degree_to_radius(rotation.x)); + float4 qy = get_quaternion_from_angle(float3(0, 1, 0), degree_to_radius(rotation.y)); + float4 qz = get_quaternion_from_angle(float3(0, 0, 1), degree_to_radius(rotation.z)); + + #define MUL3(A, B, C) quaternion_mul(quaternion_mul((A), (B)), (C)) + float4 quaternion = normalize(MUL3(qx, qy, qz)); + float4 conjugate = quaternion_conjugate(quaternion); + + float4 inVecQ = quaternion_from_vector(inVec); + + float3 rotated = ( + MUL3(quaternion, inVecQ, conjugate) + ).yzw; + + return rotated; + } + + float4 transform(float4 input, float4 pos, float4 rotation, float4 scale) + { + input.rgb *= (scale.xyz * scale.w); + input = float4( + rotate_with_quaternion(input.xyz, rotation.xyz * rotation.w) + + (pos.xyz * pos.w), + input.w + ); + return input; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMath.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMath.cginc.meta new file mode 100644 index 00000000..7d3a939f --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMath.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 371585525030ace46a68c1100848b77b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMetal.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMetal.cginc new file mode 100644 index 00000000..910e1c51 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMetal.cginc @@ -0,0 +1,130 @@ +#ifndef POI_METAL + #define POI_METAL + + samplerCUBE _CubeMap; + float _SampleWorld; + POI_TEXTURE_NOSAMPLER(_MetallicMask); + POI_TEXTURE_NOSAMPLER(_SmoothnessMask); + float _Metallic; + float _InvertSmoothness; + float _Smoothness; + float _EnableMetallic; + float3 _MetalReflectionTint; + POI_TEXTURE_NOSAMPLER(_MetallicTintMap); + + float3 finalreflections; + float metalicMap; + float3 reflection; + float roughness; + float lighty_boy_uwu_var; + + bool shouldMetalHappenBeforeLighting() + { + float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS); + bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0); + return probeExists && !float(1); + } + + float3 fresnelRelflection(in float4 albedo) + { + half3 dotNV = 1 - abs(poiLight.nDotV); + half f = dotNV * dotNV * dotNV * dotNV; + //f *= i_sold.fresnel; + return lerp(lerp(DielectricSpec.rgb, albedo.rgb, metalicMap), saturate(1 - roughness + metalicMap), f); + } + + void calculateMetallicness() + { + metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float(1); + } + + void ApplyMetallics(inout float4 finalColor, in float4 albedo) + { + #ifdef FORWARD_BASE_PASS + float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0))); + + #ifdef POI_BLACKLIGHT + if (_BlackLightMaskMetallic != 4) + { + metalicMap *= blackLightMask[_BlackLightMaskMetallic]; + smoothnessMap *= blackLightMask[_BlackLightMaskMetallic]; + } + #endif + + if(float(1) == 1) + { + smoothnessMap = 1 - smoothnessMap; + } + smoothnessMap *= float(1); + roughness = 1 - smoothnessMap; + + + Unity_GlossyEnvironmentData envData; + envData.roughness = roughness; + envData.reflUVW = BoxProjection( + poiCam.reflectionDir, poiMesh.worldPos.xyz, + unity_SpecCube0_ProbePosition, + unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax + ); + float3 probe0 = Unity_GlossyEnvironment( + UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData + ); + envData.reflUVW = BoxProjection( + poiCam.reflectionDir, poiMesh.worldPos.xyz, + unity_SpecCube1_ProbePosition, + unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax + ); + + float interpolator = unity_SpecCube0_BoxMin.w; + + if(interpolator < 0.99999) + { + float3 probe1 = Unity_GlossyEnvironment( + UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), + unity_SpecCube0_HDR, envData + ); + reflection = lerp(probe1, probe0, interpolator); + } + else + { + reflection = probe0; + } + + float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0); + + half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + finalColor.rgb *= (1 - metalicMap * tintMap.a); + finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection(albedo) * float4(1,1,1,1) * tintMap.rgb * tintMap.a; + #endif + } + + void ApplyMetallicsFake(inout float4 finalColor, in float4 albedo) + { + #ifdef FORWARD_BASE_PASS + metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float(1); + float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0))); + + #ifdef POI_BLACKLIGHT + if(_BlackLightMaskMetallic != 4) + { + metalicMap *= blackLightMask[_BlackLightMaskMetallic]; + smoothnessMap *= blackLightMask[_BlackLightMaskMetallic]; + } + #endif + + if(float(1) == 1) + { + smoothnessMap = 1 - smoothnessMap; + } + smoothnessMap *= float(1); + roughness = 1 - smoothnessMap; + + reflection = texCUBElod(_CubeMap, float4(poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS)); + + float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0); + half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + finalColor.rgb *= (1 - metalicMap * tintMap.a); + finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection(albedo) * float4(1,1,1,1) * tintMap.rgb * tintMap.a; + #endif + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMetal.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMetal.cginc.meta new file mode 100644 index 00000000..6c58161b --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMetal.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 83216dd1feaeae74484c3ce8596c05e8 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMirror.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMirror.cginc new file mode 100644 index 00000000..8bb16398 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMirror.cginc @@ -0,0 +1,77 @@ +#ifndef POI_MIRROR + #define POI_MIRROR + + float _Mirror; + float _EnableMirrorTexture; + POI_TEXTURE_NOSAMPLER(_MirrorTexture); + + + void applyMirrorRenderVert(inout float4 vertex) + { + + if (float(0) != 0) + { + bool inMirror = IsInMirror(); + if(float(0) == 1 && inMirror) + { + return; + } + if(float(0) == 1 && !inMirror) + { + vertex = -1; + return; + } + if(float(0) == 2 && inMirror) + { + vertex = -1; + return; + } + if(float(0) == 2 && !inMirror) + { + return; + } + } + } + + void applyMirrorRenderFrag() + { + + if(float(0) != 0) + { + bool inMirror = IsInMirror(); + if(float(0) == 1 && inMirror) + { + return; + } + if(float(0) == 1 && !inMirror) + { + clip(-1); + return; + } + if(float(0) == 2 && inMirror) + { + clip(-1); + return; + } + if(float(0) == 2 && !inMirror) + { + return; + } + } + } + + #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS)) + void applyMirrorTexture(inout float4 mainTexture) + { + + if(float(0)) + { + if(IsInMirror()) + { + mainTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + } + } + } + #endif + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMirror.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMirror.cginc.meta new file mode 100644 index 00000000..0d6404e7 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiMirror.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3ef7e70997d7cd141a5d6e58f6e7aec6 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineFrag.cginc new file mode 100644 index 00000000..c518bf13 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineFrag.cginc @@ -0,0 +1,107 @@ +float _OutlineRimLightBlend; +float _OutlineLit; +float _OutlineTintMix; +float2 _MainTexPan; +float _MainTextureUV; + +float4 frag(v2f i, uint facing: SV_IsFrontFace): COLOR +{ + float4 finalColor = 1; + + if (float(0)) + { + UNITY_SETUP_INSTANCE_ID(i); + + float3 finalEmission = 0; + float4 albedo = 1; + + poiMesh.uv[0] = i.uv0.xy; + poiMesh.uv[1] = i.uv0.zw; + poiMesh.uv[2] = i.uv1.xy; + poiMesh.uv[3] = i.uv1.zw; + + calculateAttenuation(i); + InitializeMeshData(i, facing); + initializeCamera(i); + calculateTangentData(); + + float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _MainTex) + _Time.x * float4(0,0,0,0)); + half3 detailMask = 1; + calculateNormals(detailMask); + + #ifdef POI_DATA + calculateLightingData(i); + #endif + #ifdef POI_LIGHTING + calculateBasePassLightMaps(); + #endif + + float3 uselessData0; + float3 uselessData1; + initTextureData(albedo, mainTexture, uselessData0, uselessData1, detailMask); + + + fixed4 col = mainTexture; + float alphaMultiplier = smoothstep(float4(0,0,0,0).x, float4(0,0,0,0).y, distance(getCameraPosition(), i.worldPos)); + float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[float(0)], _OutlineMask) + _Time.x * float4(0,0,0,0)).r; + clip(OutlineMask * float(0) - 0.001); + + col = col * 0.00000000001 + tex2D(_OutlineTexture, TRANSFORM_TEX(poiMesh.uv[float(0)], _OutlineTexture) + _Time.x * float4(0,0,0,0) ); + col.a *= albedo.a; + col.a *= alphaMultiplier; + + #ifdef POI_RANDOM + col.a *= i.angleAlpha; + #endif + + poiCam.screenUV = calcScreenUVs(i.grabPos); + col.a *= float4(1,1,1,1).a; + + + if(float(1) == 1) + { + applyDithering(col); + } + + clip(col.a - float(0.5)); + + #ifdef POI_MIRROR + applyMirrorRenderFrag(); + #endif + + + if(float(0) == 1) + { + #ifdef POI_MIRROR + applyMirrorTexture(mainTexture); + #endif + col.rgb = mainTexture.rgb; + } + else if(float(0) == 2) + { + col.rgb = lerp(col.rgb, poiLight.color, float(0)); + } + col.rgb *= float4(1,1,1,1).rgb; + + if(float(0) == 1) + { + col.rgb = lerp(col.rgb, mainTexture.rgb, float(0)); + } + + finalColor = col; + + #ifdef POI_LIGHTING + + if(float(1)) + { + finalColor.rgb *= calculateFinalLighting(finalColor.rgb, finalColor); + } + #endif + finalColor.rgb += (col.rgb * float(0)); + } + else + { + clip(-1); + } + return finalColor; +} diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineFrag.cginc.meta new file mode 100644 index 00000000..68925b2f --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineFrag.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d2bb87d46e5d1534991c184a5030b173 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineVert.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineVert.cginc new file mode 100644 index 00000000..900e9e43 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineVert.cginc @@ -0,0 +1,105 @@ +#ifndef OutlineVert + #define OutlineVert + + #include "CGI_PoiV2F.cginc" + + float _OutlineMode; + float4 _OutlinePersonaDirection; + float4 _OutlineDropShadowOffset; + float _OutlineUseVertexColors; + float _OutlineFixedSize; + float _commentIfZero_EnableOutlinePass; + + sampler2D _OutlineMask; float4 _OutlineMask_ST; float2 _OutlineMaskPan; float _OutlineMaskUV; + v2f vert(appdata v) + { + + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f, o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.uv0.xy = v.uv0.xy; + o.uv0.zw = v.uv1.xy; + o.uv1.xy = v.uv2.xy; + o.uv1.zw = v.uv3.xy; + + float2 uvArray[4]; + uvArray[0] = o.uv0.xy; + uvArray[1] = o.uv0.zw; + uvArray[2] = o.uv1.xy; + uvArray[3] = o.uv1.zw; + + #ifdef POI_MIRROR + applyMirrorRenderVert(v.vertex); + #endif + + o.uv0.xy = v.uv0 + _OutlineGlobalPan.xy * _Time.y; + float outlineMask = 1; + + outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(TRANSFORM_TEX(uvArray[float(0)], _OutlineMask) + _Time.x * float4(0,0,0,0), 0, 0)).rgb); + + if (float(0) == 2) + { + outlineMask *= v.color.r; + } + + + if(float(0) != 1) + { + o.normal = UnityObjectToWorldNormal(v.normal); + } + else + { + o.normal = UnityObjectToWorldNormal(v.color); + } + + + half offsetMultiplier = 1; + half distanceOffset = 1; + + if(float(0)) + { + distanceOffset *= distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, v.vertex).xyz); + } + + float3 offset = o.normal * (float(0) * float(0) / 100) * outlineMask * distanceOffset; + + + if(float(0) == 2) + { + float3 lightDirection = poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz); + offsetMultiplier = saturate(dot(lightDirection, o.normal)); + offset *= offsetMultiplier; + offset *= distanceOffset; + } + else if(float(0) == 3) + { + half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, o.normal); + offsetMultiplier = saturate(dot(viewNormal.xy, normalize(float4(1,0,0,0).xy))); + + offset *= offsetMultiplier; + offset *= distanceOffset; + } + else if(float(0) == 4) + { + offset = mul((float3x3)transpose(UNITY_MATRIX_V), float4(1,0,0,0)); + offset *= distanceOffset; + } + + o.worldPos = mul(unity_ObjectToWorld, v.vertex) + float4(offset, 0); + o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)); + o.pos = UnityWorldToClipPos(o.worldPos); + o.grabPos = ComputeGrabScreenPos(o.pos); + o.angleAlpha = 1; + #ifdef POI_RANDOM + o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos); + #endif + + UNITY_TRANSFER_SHADOW(o, o.uv0); + UNITY_TRANSFER_FOG(o, o.pos); + return o; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineVert.cginc.meta new file mode 100644 index 00000000..585e465b --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiOutlineVert.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8842888752f570e4e97a0009015e9e7b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPanosphere.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPanosphere.cginc new file mode 100644 index 00000000..da64a89d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPanosphere.cginc @@ -0,0 +1,63 @@ +#ifndef PANOSPHERE + #define PANOSPHERE + + sampler2D _PanosphereTexture; float4 _PanosphereTexture_ST; + POI_TEXTURE_NOSAMPLER(_PanoMask); + float _PanoEmission; + float _PanoBlend; + float4 _PanosphereColor; + float3 _PanospherePan; + float _PanoToggle; + float _PanoCubeMapToggle; + float _PanoInfiniteStereoToggle; + samplerCUBE _PanoCubeMap; half4 _PanoCubeMap_HDR; + + float3 panoColor; + float panoMask; + + float2 projectIt(float3 coords) + { + float3 normalizedCoords = normalize(coords); + float latitude = acos(normalizedCoords.y); + float longitude = atan2(normalizedCoords.z, normalizedCoords.x); + float2 sphereCoords = float2(longitude + _Time.y * float4(0,0,0,0).x, latitude + _Time.y * float4(0,0,0,0).y) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI); + sphereCoords = float2(1.0, 1.0) - sphereCoords; + return(sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).zw; + } + + void applyPanosphereColor(inout float4 albedo, inout float3 panosphereEmission) + { + panoMask = POI2D_SAMPLER_PAN(_PanoMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + #ifdef POI_BLACKLIGHT + if (_BlackLightMaskPanosphere != 4) + { + panoMask *= blackLightMask[_BlackLightMaskPanosphere]; + } + #endif + + + if(float(0)) + { + float3 cubeUV = mul(poiRotationMatrixFromAngles(float4(0,0,0,0).xyz * _Time.y), float4(-poiCam.viewDir, 1)); + half4 cubemap = texCUBE(_PanoCubeMap, cubeUV); + panoColor = DecodeHDR(cubemap, _PanoCubeMap_HDR); + } + else + { + float2 uv = projectIt(normalize(lerp(getCameraPosition().xyz, poiCam.worldPos.xyz, float(0)) - poiMesh.worldPos.xyz) * - 1); + + float2 ddxuv = ddx(uv); + float2 ddyuv = ddy(uv); + if(any(fwidth(uv) > .5)) + { + ddxuv = ddyuv = 0.001; + } + panoColor = tex2D(_PanosphereTexture, TRANSFORM_TEX(uv, _PanosphereTexture), ddxuv, ddyuv).rgb * float4(1,1,1,1).rgb; + } + panosphereEmission = panoColor * float(0) * panoMask * float(0); + albedo.rgb = lerp(albedo.rgb, panoColor, float(0) * panoMask); + } + +#endif + diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPanosphere.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPanosphere.cginc.meta new file mode 100644 index 00000000..b565b250 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPanosphere.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8741f8f191a1f7c4c917ff3a2432bd50 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiParallax.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiParallax.cginc new file mode 100644 index 00000000..6cd94900 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiParallax.cginc @@ -0,0 +1,143 @@ +#ifndef POI_PARALLAX + #define POI_PARALLAX + + UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxHeightMap); float4 _ParallaxHeightMap_ST; + POI_TEXTURE_NOSAMPLER(_ParallaxHeightMapMask); + float2 _ParallaxHeightMapPan; + float _ParallaxStrength; + float _ParallaxHeightMapEnabled; + float _ParallaxUV; + + //Internal + float _ParallaxInternalMapEnabled; + UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxInternalMap); float4 _ParallaxInternalMap_ST; + POI_TEXTURE_NOSAMPLER(_ParallaxInternalMapMask); + float _ParallaxInternalIterations; + float _ParallaxInternalMinDepth; + float _ParallaxInternalMaxDepth; + float _ParallaxInternalMinFade; + float _ParallaxInternalMaxFade; + float4 _ParallaxInternalMinColor; + float4 _ParallaxInternalMaxColor; + float4 _ParallaxInternalPanSpeed; + float4 _ParallaxInternalPanDepthSpeed; + float _ParallaxInternalHeightmapMode; + float _ParallaxInternalHeightFromAlpha; + + float GetParallaxHeight(float2 uv) + { + return clamp(UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxHeightMap, _MainTex, TRANSFORM_TEX(uv, _ParallaxHeightMap) + _Time.x * float4(0,0,0,0)).g, 0, .99999); + } + /* + float2 ParallaxOffset(float2 viewDir) + { + float height = GetParallaxHeight(); + height -= 0.5; + height *= float(0); + return viewDir * height; + } + */ + float2 ParallaxRaymarching(float2 viewDir) + { + float2 uvOffset = 0; + float stepSize = 0.1; + float2 uvDelta = viewDir * (stepSize * float(0)); + + float stepHeight = 1; + float surfaceHeight = GetParallaxHeight(poiMesh.uv[float(0)]); + + + float2 prevUVOffset = uvOffset; + float prevStepHeight = stepHeight; + float prevSurfaceHeight = surfaceHeight; + + for (int i = 1; i < 10 && stepHeight > surfaceHeight; i ++) + { + prevUVOffset = uvOffset; + prevStepHeight = stepHeight; + prevSurfaceHeight = surfaceHeight; + + uvOffset -= uvDelta; + stepHeight -= stepSize; + surfaceHeight = GetParallaxHeight(poiMesh.uv[float(0)] + uvOffset); + } + + float prevDifference = prevStepHeight - prevSurfaceHeight; + float difference = surfaceHeight - stepHeight; + float t = prevDifference / (prevDifference + difference); + uvOffset = prevUVOffset -uvDelta * t; + + return uvOffset *= POI2D_SAMPLER_PAN(_ParallaxHeightMapMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + } + + void calculateandApplyParallax() + { + + if (float(0)) + { + float2 parallaxOffset = ParallaxRaymarching(poiCam.tangentViewDir.xy); + + if(float(0) == 0) + { + poiMesh.uv[0] += parallaxOffset; + } + + if(float(0) == 1) + { + poiMesh.uv[1] += parallaxOffset; + } + + if(float(0) == 2) + { + poiMesh.uv[2] += parallaxOffset; + } + + if(float(0) == 3) + { + poiMesh.uv[3] += parallaxOffset; + } + } + } + + void calculateAndApplyInternalParallax(inout float4 finalColor) + { + #if defined(_PARALLAXMAP) + + if(float(0)) + { + float3 parallax = 0; + + for (int j = float(1); j > 0; j --) + { + float ratio = (float)j / float(1); + float2 parallaxOffset = _Time.y * (float4(0,0,0,0) + (1 - ratio) * float4(0,0,0,0)); + float fade = lerp(float(0), float(1), ratio); + float4 parallaxColor = UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxInternalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _ParallaxInternalMap) + lerp(float(0), float(1), ratio) * - poiCam.tangentViewDir.xy + parallaxOffset); + float3 parallaxTint = lerp(float4(1,1,1,1), float4(1,1,1,1), ratio); + float parallaxHeight; + if(float(0)) + { + parallaxTint *= parallaxColor.rgb; + parallaxHeight = parallaxColor.a; + } + else + { + parallaxHeight = parallaxColor.r; + } + //float parallaxColor *= lerp(float4(1,1,1,1), float4(1,1,1,1), 1 - ratio); + + if (float(0) == 1) + { + parallax = lerp(parallax, parallaxTint * fade, parallaxHeight >= 1 - ratio); + } + else + { + parallax += parallaxTint * parallaxHeight * fade; + } + } + //parallax /= float(1); + finalColor.rgb += parallax * POI2D_SAMPLER_PAN(_ParallaxInternalMapMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + } + #endif + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiParallax.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiParallax.cginc.meta new file mode 100644 index 00000000..81759ee6 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiParallax.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d0372a8b4e482ad4c876285bdc645988 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPass.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPass.cginc new file mode 100644 index 00000000..81230e8d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPass.cginc @@ -0,0 +1,233 @@ +/* +USED--------------------------------------------- +"_PARALLAXMAP", +"_REQUIRE_UV2", +"_SUNDISK_NONE", +"_DETAIL_MULX2", +"_GLOSSYREFLECTIONS_OFF", +"_METALLICGLOSSMAP", +"_COLORADDSUBDIFF_ON", +"_SPECGLOSSMAP", +"_TERRAIN_NORMAL_MAP", +"_SUNDISK_SIMPLE", +"_EMISSION", +"_COLORCOLOR_ON", +"_COLOROVERLAY_ON", +"_ALPHAMODULATE_ON", +"_SUNDISK_HIGH_QUALITY", +"_MAPPING_6_FRAMES_LAYOUT", +"_NORMALMAP" +"EFFECT_BUMP", +"BLOOM", +"BLOOM_LOW", +"GRAIN", +"DEPTH_OF_FIELD", +"USER_LUT", +"CHROMATIC_ABERRATION_LOW", +"BLOOM_LENS_DIRT", +"_FADING_ON", +"CHROMATIC_ABERRATION", +"DISTORT", +"GEOM_TYPE_BRANCH", +"_SPECULARHIGHLIGHTS_OFF", +"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", +"EFFECT_HUE_VARIATION", +"GEOM_TYPE_LEAF", +"GEOM_TYPE_MESH", +"FINALPASS", +"AUTO_EXPOSURE" +"VIGNETTE", +"VIGNETTE_MASKED", +"COLOR_GRADING_HDR", + +UNUSED------------------------------------------- +"_ALPHABLEND_ON", +"_ALPHAPREMULTIPLY_ON", +"_ALPHATEST_ON", +"GEOM_TYPE_BRANCH_DETAIL", +"GEOM_TYPE_FROND", +"PIXELSNAP_ON", +"SOFTPARTICLES_ON", +"DITHERING", +"TONEMAPPING_NEUTRAL", +"TONEMAPPING_FILMIC", +"TONEMAPPING_ACES", +"TONEMAPPING_CUSTOM", +"DEPTH_OF_FIELD_COC_VIEW", +"COLOR_GRADING", +"COLOR_GRADING_LOG_VIEW", +"VIGNETTE_CLASSIC", +"COLOR_GRADING_HDR_3D", + +DO NOT USE ----------------------------------------- +"BILLBOARD_FACE_CAMERA_POS", +*/ + + +#ifndef POI_PASS + #define POI_PASS + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + #ifdef POI_META_PASS + #include "UnityMetaPass.cginc" + #endif + + #include "CGI_PoiMacros.cginc" + #include "CGI_PoiDefines.cginc" + + #include "CGI_Poicludes.cginc" + #include "CGI_PoiHelpers.cginc" + + #ifdef _SUNDISK_NONE + #include "CGI_PoiRandom.cginc" + #endif + + #ifdef _REQUIRE_UV2 + #include "CGI_PoiMirror.cginc" + #endif + #include "CGI_PoiVertexManipulations.cginc" + + #include "CGI_PoiSpawnInVert.cginc" + + #include "CGI_PoiV2F.cginc" + + #ifdef BLOOM_LOW + #include "CGI_PoiBulge.cginc" + #endif + + #include "CGI_PoiVert.cginc" + + #ifdef TESSELATION + #include "CGI_PoiTessellation.cginc" + #endif + + #include "CGI_PoiDithering.cginc" + + #ifdef _PARALLAXMAP + #include "CGI_PoiParallax.cginc" + #endif + + #ifdef USER_LUT + #include "CGI_PoiUVDistortion.cginc" + #endif + + #ifdef VIGNETTE + #include "CGI_PoiRGBMask.cginc" + #endif + + #include "CGI_PoiData.cginc" + + #ifdef _SPECULARHIGHLIGHTS_OFF + #include "CGI_PoiBlackLight.cginc" + #endif + + #include "CGI_PoiSpawnInFrag.cginc" + + #ifdef WIREFRAME + #include "CGI_PoiWireframe.cginc" + #endif + + #ifdef DISTORT + #include "CGI_PoiDissolve.cginc" + #endif + + #ifdef DEPTH_OF_FIELD + #include "CGI_PoiHologram.cginc" + #endif + + #ifdef BLOOM_LENS_DIRT + #include "CGI_PoiIridescence.cginc" + #endif + + + #ifdef FUR + #include "CGI_PoiFur.cginc" + #include "CGI_PoiGeomFur.cginc" + #endif + + #ifdef VIGNETTE_MASKED + #include "CGI_PoiLighting.cginc" + #endif + + #include "CGI_PoiMainTex.cginc" + + #ifdef GEOM_TYPE_BRANCH + #include "CGI_PoiDecal.cginc" + #endif + + #ifdef CHROMATIC_ABERRATION + #include "CGI_PoiVoronoi.cginc" + #endif + + #ifdef _DETAIL_MULX2 + #include "CGI_PoiPanosphere.cginc" + #endif + + #ifdef EFFECT_BUMP + #include "CGI_PoiMSDF.cginc" + #endif + + #ifdef GRAIN + #include "CGI_PoiDepthColor.cginc" + #endif + + + #ifdef _SUNDISK_HIGH_QUALITY + #include "CGI_PoiFlipbook.cginc" + #endif + + #ifdef _GLOSSYREFLECTIONS_OFF + #include "CGI_PoiRimLighting.cginc" + #endif + + #ifdef _MAPPING_6_FRAMES_LAYOUT + #include "CGI_PoiEnvironmentalRimLighting.cginc" + #endif + + #ifdef _METALLICGLOSSMAP + #include "CGI_PoiMetal.cginc" + #endif + + #ifdef _COLORADDSUBDIFF_ON + #include "CGI_PoiMatcap.cginc" + #endif + + #ifdef _SPECGLOSSMAP + #include "CGI_PoiSpecular.cginc" + #endif + + #ifdef BLOOM + #include "CGI_PoiVideo.cginc" + #endif + + #ifdef _TERRAIN_NORMAL_MAP + #include "CGI_PoiSubsurfaceScattering.cginc" + #endif + + #include "CGI_PoiBlending.cginc" + #include "CGI_PoiGrab.cginc" + + #ifdef _SUNDISK_SIMPLE + #include "CGI_PoiGlitter.cginc" + #endif + + #ifdef _EMISSION + #include "CGI_PoiEmission.cginc" + #endif + + #ifdef _COLORCOLOR_ON + #include "CGI_PoiClearCoat.cginc" + #endif + + #include "CGI_PoiAlphaToCoverage.cginc" + + #ifdef _COLOROVERLAY_ON + #include "CGI_PoiDebug.cginc" + #endif + #include "CGI_PoiFrag.cginc" + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPass.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPass.cginc.meta new file mode 100644 index 00000000..6636eb61 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPass.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fd4262da3a9f58c45837d92a3ae01cc3 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassOutline.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassOutline.cginc new file mode 100644 index 00000000..5e365972 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassOutline.cginc @@ -0,0 +1,26 @@ +#ifndef POI_PASS_OUTLINE + #define POI_PASS_OUTLINE + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #include "CGI_PoiMacros.cginc" + #include "CGI_Poicludes.cginc" + #include "CGI_PoiHelpers.cginc" + #include "CGI_PoiOutlineVert.cginc" + #ifdef TESSELATION + #include "CGI_PoiTessellation.cginc" + #endif + #ifdef _REQUIRE_UV2 + #include "CGI_PoiMirror.cginc" + #endif + #ifdef DISTORT + #include "CGI_PoiDissolve.cginc" + #endif + #include "CGI_PoiLighting.cginc" + #include "CGI_PoiMainTex.cginc" + #include "CGI_PoiData.cginc" + #include "CGI_PoiDithering.cginc" + #include "CGI_PoiOutlineFrag.cginc" +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassOutline.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassOutline.cginc.meta new file mode 100644 index 00000000..94f1a1e8 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassOutline.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: dc00503b6a6669e43b1d71c7c3e3997a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassShadow.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassShadow.cginc new file mode 100644 index 00000000..d21a5d4d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassShadow.cginc @@ -0,0 +1,44 @@ +#ifndef POI_PASS_SHADOW + #define POI_PASS_SHADOW + + #pragma multi_compile_shadowcaster + #include "UnityCG.cginc" + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + #include "CGI_PoiMacros.cginc" + #include "CGI_PoiDefines.cginc" + + #include "CGI_Poicludes.cginc" + #include "CGI_PoiShadowIncludes.cginc" + #include "CGI_PoiHelpers.cginc" + #include "CGI_PoiMirror.cginc" + #include "CGI_PoiSpawnInFrag.cginc" + + #include "CGI_PoiV2F.cginc" + #include "CGI_PoiData.cginc" + + #ifdef WIREFRAME + #include "CGI_PoiWireframe.cginc" + #endif + + #ifdef _SUNDISK_HIGH_QUALITY + #include "CGI_PoiFlipbook.cginc" + #endif + + #ifdef _SUNDISK_NONE + #include "CGI_PoiRandom.cginc" + #endif + #include "CGI_PoiDithering.cginc" + #ifdef DISTORT + #include "CGI_PoiDissolve.cginc" + #endif + #include "CGI_PoiVertexManipulations.cginc" + #include "CGI_PoiSpawnInVert.cginc" + #include "CGI_PoiShadowVert.cginc" + #include "CGI_PoiShadowFrag.cginc" + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassShadow.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassShadow.cginc.meta new file mode 100644 index 00000000..1a8a888a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiPassShadow.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: eb0a9b8a587ac6d44b7b7a02db6edb6e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRGBMask.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRGBMask.cginc new file mode 100644 index 00000000..d4cd1697 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRGBMask.cginc @@ -0,0 +1,131 @@ +#ifndef POI_RGBMASK + #define POI_RGBMASK + + UNITY_DECLARE_TEX2D_NOSAMPLER(_RGBMask); float4 _RGBMask_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_RedTexure); float4 _RedTexure_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_GreenTexture); float4 _GreenTexture_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_BlueTexture); float4 _BlueTexture_ST; + + #ifdef GEOM_TYPE_MESH + POI_NORMAL_NOSAMPLER(_RgbNormalR); + POI_NORMAL_NOSAMPLER(_RgbNormalG); + POI_NORMAL_NOSAMPLER(_RgbNormalB); + float _RgbNormalsEnabled; + #endif + + float4 _RedColor; + float4 _GreenColor; + float4 _BlueColor; + + float4 _RGBMaskPanning; + float4 _RGBRedPanning; + float4 _RGBGreenPanning; + float4 _RGBBluePanning; + + float _RGBBlendMultiplicative; + + float _RGBMaskUV; + float _RGBRed_UV; + float _RGBGreen_UV; + float _RGBBlue_UV; + float _RGBUseVertexColors; + float _RGBNormalBlend; + + static float3 rgbMask; + + void calculateRGBNormals(inout half3 mainTangentSpaceNormal) + { + #ifdef GEOM_TYPE_MESH + #ifndef RGB_MASK_TEXTURE + #define RGB_MASK_TEXTURE + + if (float(0)) + { + rgbMask = poiMesh.vertexColor.rgb; + } + else + { + rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).rgb; + } + #endif + + + if(float(0)) + { + + if(float(0) == 0) + { + + if(float(0) > 0) + { + half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0)); + mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.r); + } + + if(float(0) > 0) + { + half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0)); + mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.g); + } + + if(float(0) > 0) + { + half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0)); + mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.b); + } + return; + } + else + { + half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0) * rgbMask.r); + half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0)); + newNormal = lerp(newNormal, normalToBlendWith, rgbMask.g); + normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)), float(0)); + newNormal = lerp(newNormal, normalToBlendWith, rgbMask.b); + mainTangentSpaceNormal = BlendNormals(newNormal, mainTangentSpaceNormal); + return; + } + } + #endif + } + + float3 calculateRGBMask(float3 baseColor) + { + //If RGB normals are in use this data will already exist + #ifndef RGB_MASK_TEXTURE + #define RGB_MASK_TEXTURE + + if (float(0)) + { + rgbMask = poiMesh.vertexColor.rgb; + } + else + { + rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).rgb; + } + #endif + + float4 red = POI2D_SAMPLER_PAN(_RedTexure, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + + if(float(0)) + { + float3 RGBColor = 1; + RGBColor = lerp(RGBColor, red.rgb * float4(1,1,1,1).rgb, rgbMask.r * red.a * float4(1,1,1,1).a); + RGBColor = lerp(RGBColor, green.rgb * float4(1,1,1,1).rgb, rgbMask.g * green.a * float4(1,1,1,1).a); + RGBColor = lerp(RGBColor, blue.rgb * float4(1,1,1,1).rgb, rgbMask.b * blue.a * float4(1,1,1,1).a); + baseColor *= RGBColor; + } + else + { + baseColor = lerp(baseColor, red.rgb * float4(1,1,1,1).rgb, rgbMask.r * red.a * float4(1,1,1,1).a); + baseColor = lerp(baseColor, green.rgb * float4(1,1,1,1).rgb, rgbMask.g * green.a * float4(1,1,1,1).a); + baseColor = lerp(baseColor, blue.rgb * float4(1,1,1,1).rgb, rgbMask.b * blue.a * float4(1,1,1,1).a); + } + + return baseColor; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRGBMask.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRGBMask.cginc.meta new file mode 100644 index 00000000..39436cdc --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRGBMask.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e37b1cf49668b06478303d11661f8249 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRNG.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRNG.cginc new file mode 100644 index 00000000..137ef6de --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRNG.cginc @@ -0,0 +1,4 @@ +#ifndef POI_RNG + #define POI_RNG + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRNG.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRNG.cginc.meta new file mode 100644 index 00000000..19f2fdff --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRNG.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f9e9a6138ea9de14bba06ba98a1f1184 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRandom.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRandom.cginc new file mode 100644 index 00000000..11f3eea2 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRandom.cginc @@ -0,0 +1,41 @@ +#ifndef POI_RANDOM + #define POI_RANDOM + + float _EnableRandom; + float m_start_Angle; + float _AngleType; + float3 _AngleForwardDirection; + float _CameraAngleMin; + float _CameraAngleMax; + float _ModelAngleMin; + float _ModelAngleMax; + float _AngleMinAlpha; + float _AngleCompareTo; + + float ApplyAngleBasedRendering(float3 modelPos, float3 worldPos) + { + half cameraAngleMin = float(45) / 180; + half cameraAngleMax = float(90) / 180; + half modelAngleMin = float(45) / 180; + half modelAngleMax = float(90) / 180; + float3 pos = float(0) == 0 ? modelPos : worldPos; + half3 cameraToModelDirection = normalize(pos - getCameraPosition()); + half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(float4(0,0,1,0)))); + half cameraLookAtModel = remapClamped(.5 * dot(cameraToModelDirection, getCameraForward()) + .5, cameraAngleMax, cameraAngleMin, 0, 1); + half modelLookAtCamera = remapClamped(.5 * dot(-cameraToModelDirection, modelForwardDirection) + .5, modelAngleMax, modelAngleMin, 0, 1); + if (float(0) == 0) + { + return max(cameraLookAtModel, float(0)); + } + else if(float(0) == 1) + { + return max(modelLookAtCamera, float(0)); + } + else if(float(0) == 2) + { + return max(cameraLookAtModel * modelLookAtCamera, float(0)); + } + return 1; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRandom.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRandom.cginc.meta new file mode 100644 index 00000000..f556915e --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRandom.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6636a5017db00dc4aaef5a2b71565970 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRimLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRimLighting.cginc new file mode 100644 index 00000000..0ca8b72c --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRimLighting.cginc @@ -0,0 +1,47 @@ +#ifndef POI_RIM + #define POI_RIM + + float4 _RimLightColor; + float _RimLightingInvert; + float _RimWidth; + float _RimStrength; + float _RimSharpness; + float _RimLightColorBias; + float _ShadowMix; + float _ShadowMixThreshold; + float _ShadowMixWidthMod; + float _EnableRimLighting; + float _RimBrighten; + float _RimLightNormal; + + POI_TEXTURE_NOSAMPLER(_RimTex); + POI_TEXTURE_NOSAMPLER(_RimMask); + POI_TEXTURE_NOSAMPLER(_RimWidthNoiseTexture); + + float _RimWidthNoiseStrength; + + float4 rimColor = float4(0, 0, 0, 0); + float rim = 0; + + void applyRimLighting(inout float4 albedo, inout float3 rimLightEmission) + { + float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + rimNoise = (rimNoise - .5) * float(0.1); + + float viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[float(1)])); + + if (float(0)) + { + viewDotNormal = 1 - abs(dot(poiCam.viewDir, poiMesh.normals[float(1)])); + } + float rimWidth = float(0.8); + rimWidth -= rimNoise; + float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)) * float4(0.5007474,0.5007474,0.5007474,1); + rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - float(0.5)) * float(0.5), float(0)),0); + rim = 1 - smoothstep(min(float(0.008), rimWidth), rimWidth, viewDotNormal); + rim *= float4(0.5007474,0.5007474,0.5007474,1).a * rimColor.a * rimMask; + rimLightEmission = rim * lerp(albedo, rimColor, float(0.007)) * float(0); + albedo.rgb = lerp(albedo.rgb, lerp(albedo.rgb, rimColor, float(0.007)) + lerp(albedo.rgb, rimColor, float(0.007)) * float(0.06), rim); + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRimLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRimLighting.cginc.meta new file mode 100644 index 00000000..e787cfbf --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiRimLighting.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f376e25cfef29bc489e1848f6d4aba84 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowFrag.cginc new file mode 100644 index 00000000..ccfc9ba4 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowFrag.cginc @@ -0,0 +1,116 @@ +#ifndef SHADOW_FRAG + #define SHADOW_FRAG + + float2 _MainDistanceFade; + float _ForceOpaque; + float _MainShadowClipMod; + float2 _AlphaMaskPan; + float _AlphaMaskUV; + sampler3D _DitherMaskLOD; + float2 _MainTexPan; + float _MainTextureUV; + + half4 fragShadowCaster( + #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS) + V2FShadow i, uint facing: SV_IsFrontFace + #endif + ): SV_Target + { + poiMesh.uv[0] = i.uv; + poiMesh.uv[1] = i.uv1; + poiMesh.uv[2] = i.uv2; + poiMesh.uv[3] = i.uv3; + + // Basically every texture relies on the maintex sampler to function and that's why this is here. + float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _MainTex) + _Time.x * float4(0,0,0,0)); + + + //Possible Bug with clip + float clipValue = clamp(float(0.5) + float(0), - .001, 1.001); + + poiMesh.vertexColor = saturate(i.vertexColor); + poiMesh.worldPos = i.worldPos; + poiMesh.localPos = i.localPos; + + #ifdef POI_MIRROR + applyMirrorRenderFrag(); + #endif + + #if defined(UNITY_STANDARD_USE_SHADOW_UVS) + + half4 alpha = mainTexture; + + + if (float(0)) + { + if(IsInMirror()) + { + alpha.a = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(i.uv, _MirrorTexture)).a; + } + } + + + alpha.a *= smoothstep(float4(0,0,0,0).x, float4(0,0,0,0).y, distance(i.modelPos, _WorldSpaceCameraPos)); + half alphaMask = POI2D_PAN(_AlphaMask, poiMesh.uv[float(0)], float4(0,0,0,0)); + alpha.a *= alphaMask; + alpha.a *= float4(1,1,1,1).a + .0001; + alpha.a += float(0); + alpha.a = saturate(alpha.a); + + + if(float(1) == 0) + { + alpha.a = 1; + } + + + if(float(1) == 1) + { + applyShadowDithering(alpha.a, calcScreenUVs(i.grabPos).xy); + } + + #ifdef POI_DISSOLVE + float3 fakeEmission = 1; + calculateDissolve(alpha, fakeEmission); + #endif + + if(float(1) == 1) + { + clip(alpha.a - 0.001); + } + + /* + return poiMesh.vertexColor.g; + + #ifdef POI_RANDOM + alpha.a *= i.angleAlpha; + #endif + + + if(float(1) >= 1) + { + applySpawnInShadow(uv[0], i.localPos); + + #if defined(POI_FLIPBOOK) + alpha.a *= applyFlipbookAlphaToShadow(uv[float(0)]); + #endif + } + */ + + if (float(1) == 1) + { + clip(alpha.a - clipValue); + } + + + if(float(1) > 1) + { + float dither = tex3D(_DitherMaskLOD, float3(i.pos.xy * .25, alpha.a * 0.9375)).a; + clip(dither - 0.01); + } + + #endif + SHADOW_CASTER_FRAGMENT(i) + } + + #endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowFrag.cginc.meta new file mode 100644 index 00000000..3be8d89d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowFrag.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f6e0e83e60fd31345a8bb093bd54a319 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowIncludes.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowIncludes.cginc new file mode 100644 index 00000000..fd8f19a1 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowIncludes.cginc @@ -0,0 +1,41 @@ +#ifndef SHADOW_INCLUDES + #define SHADOW_INCLUDES + + #define UNITY_STANDARD_USE_SHADOW_UVS 1 + + float4 _Color; + sampler2D _AlphaMask; float4 _AlphaMask_ST; + + struct VertexInputShadow + { + float4 vertex: POSITION; + float3 normal: NORMAL; + float4 color: COLOR; + float2 uv0: TEXCOORD0; + float2 uv1: TEXCOORD1; + float2 uv2: TEXCOORD2; + float2 uv3: TEXCOORD3; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS) + struct V2FShadow + { + V2F_SHADOW_CASTER_NOPOS + float4 pos: SV_POSITION; + float2 uv: TEXCOORD1; + float2 uv1: TEXCOORD2; + float2 uv2: TEXCOORD3; + float2 uv3: TEXCOORD4; + float3 modelPos: TEXCOORD5; + float4 worldPos: TEXCOORD6; + float4 localPos: TEXCOORD7; + float3 angleAlpha: TEXCOORD8; + float4 grabPos: TEXCOORD9; + fixed3 barycentricCoordinates: TEXCOORD10; + float4 vertexColor: TEXCOORD11; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + #endif + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowIncludes.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowIncludes.cginc.meta new file mode 100644 index 00000000..1f8efd61 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowIncludes.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1d71fb5b32b383543a0074c53cf50b5a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowVert.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowVert.cginc new file mode 100644 index 00000000..f0b7184a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowVert.cginc @@ -0,0 +1,80 @@ +float _EnableTouchGlow; +float _EnableBulge; +float _VertexManipulationHeightUV; + +V2FShadow vertShadowCaster(VertexInputShadow v) +{ + V2FShadow o; + UNITY_SETUP_INSTANCE_ID(v); + + #ifdef AUTO_EXPOSURE + applyLocalVertexTransformation(v.normal, v.vertex); + #endif + + UNITY_INITIALIZE_OUTPUT(V2FShadow, o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.localPos = v.vertex; + o.worldPos = mul(unity_ObjectToWorld, o.localPos); + + o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)); + o.uv = v.uv0; + o.uv1 = v.uv1; + o.uv2 = v.uv2; + o.uv3 = v.uv3; + + + float2 uvToUse = 0; + + if (float(0) == 0) + { + uvToUse = v.uv0.xy; + } + + if(float(0) == 1) + { + uvToUse = v.uv1.xy; + } + + if(float(0) == 2) + { + uvToUse = v.uv2.xy; + } + + if(float(0) == 3) + { + uvToUse = v.uv3.xy; + } + #ifdef AUTO_EXPOSURE + applyWorldVertexTransformation(o.worldPos, o.localPos, v.normal, uvToUse); + #endif + applyVertexGlitching(o.worldPos, o.localPos); + applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy); + #ifdef AUTO_EXPOSURE + applyVertexRounding(o.worldPos, o.localPos); + #endif + o.pos = UnityObjectToClipPos(o.localPos); + o.grabPos = ComputeGrabScreenPos(o.pos); + o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)); + o.vertexColor = v.color; + + + if(_EnableTouchGlow || _EnableBulge) + { + o.pos = UnityObjectToClipPos(float3(0, 0, -5)); + o.localPos.xyz = float3(0, 0, -5); + o.worldPos = mul(unity_ObjectToWorld, o.localPos); + } + + o.angleAlpha = 1; + #ifdef POI_RANDOM + o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos); + #endif + + + o.pos = UnityClipSpaceShadowCasterPos(o.localPos, v.normal); + o.pos = UnityApplyLinearShadowBias(o.pos); + + return o; +} diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowVert.cginc.meta new file mode 100644 index 00000000..3ad880a3 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiShadowVert.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e1846d5d64a0c354ea4ff3a0492f3030 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInFrag.cginc new file mode 100644 index 00000000..2455b603 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInFrag.cginc @@ -0,0 +1,58 @@ +#ifndef POI_SPAWN_IN_FRAG + #define POI_SPAWN_FRAG + + #ifndef SPAWN_IN_VARIABLES + #define SPAWN_IN_VARIABLES + + float3 _SpawnInGradientStart; + float3 _SpawnInGradientFinish; + fixed _SpawnInAlpha; + fixed _SpawnInNoiseIntensity; + float3 _SpawnInEmissionColor; + float _SpawnInEmissionOffset; + float _SpawnInVertOffset; + float _SpawnInVertOffsetOffset; + float _EnableScifiSpawnIn; + #endif + + UNITY_DECLARE_TEX2D_NOSAMPLER(_SpawnInNoise); float4 _SpawnInNoise_ST; + + float calculateGradientValueFrag(float3 start, float3 finish, float3 localPos) + { + return inverseLerp3(start, finish, localPos); + } + + void applySpawnIn(inout float4 finalColor, inout float3 spawnInEmission, float2 uv, float3 localPos) + { + + if (_EnableScifiSpawnIn) + { + float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity; + float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos); + float inverseGradient = 1 - gradient; + float alpha = gradient - _SpawnInAlpha - noise; + spawnInEmission = saturate(inverseGradient + _SpawnInAlpha + _SpawnInEmissionOffset +noise - 1) * _SpawnInEmissionColor; + + if(float(1) >= 1) + { + clip(ceil(alpha) - 0.001); + } + } + } + + void applySpawnInShadow(float2 uv, float3 localPos) + { + + if(_EnableScifiSpawnIn) + { + float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity; + float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos); + float alpha = gradient - _SpawnInAlpha - noise + length(_SpawnInVertOffset); + + if(float(1) >= 1) + { + clip(ceil(alpha) - 0.001); + } + } + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInFrag.cginc.meta new file mode 100644 index 00000000..1e7b2098 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInFrag.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6dcb68a3d30a24e478e801843ba6afa5 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInVert.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInVert.cginc new file mode 100644 index 00000000..fdcc457f --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInVert.cginc @@ -0,0 +1,40 @@ +#ifndef POI_SPAWN_IN_FRAG + #define POI_SPAWN_FRAG + + #ifndef SPAWN_IN_VARIABLES + #define SPAWN_IN_VARIABLES + + float3 _SpawnInGradientStart; + float3 _SpawnInGradientFinish; + fixed _SpawnInAlpha; + fixed _SpawnInNoiseIntensity; + float3 _SpawnInEmissionColor; + float _SpawnInEmissionOffset; + float _SpawnInVertOffset; + float _SpawnInVertOffsetOffset; + float _EnableScifiSpawnIn; + + #endif + //sampler2D _SpawnInNoiseVert; float4 _SpawnInNoiseVert_ST; + + float calculateGradientValueVert(float3 start, float3 finish, float3 localPos) + { + return inverseLerp3(start, finish, localPos); + } + + void applySpawnInVert(inout float4 worldPos, inout float4 localPos, float2 uv) + { + + if (_EnableScifiSpawnIn) + { + float noise = 0; + float gradient = calculateGradientValueVert(_SpawnInGradientStart, _SpawnInGradientFinish, localPos); + float inverseGradient = 1 - gradient; + float alpha = gradient - _SpawnInAlpha - noise; + worldPos.xyz += saturate(inverseGradient + _SpawnInAlpha + _SpawnInVertOffsetOffset -1) * float3(0, _SpawnInVertOffset, 0); + localPos.xyz = mul(unity_WorldToObject, worldPos); + } + //float noise = tex2Dlod(_SpawnInNoise, float4(TRANSFORM_TEX(uv, _SpawnInNoise))).r * _SpawnInAlpha * _SpawnInNoiseIntensity; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInVert.cginc.meta new file mode 100644 index 00000000..9d0747ed --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpawnInVert.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5b430c44c6e814d47b3f50934aac5ba1 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpecular.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpecular.cginc new file mode 100644 index 00000000..ae94cf1a --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpecular.cginc @@ -0,0 +1,488 @@ +#ifndef POI_SPECULAR + #define POI_SPECULAR + float _SpecWhatTangent; + float _SpecularType; + float _SmoothnessFrom; + POI_TEXTURE_NOSAMPLER(_SpecularMetallicMap); + POI_TEXTURE_NOSAMPLER(_SpecularMap); + fixed _CenterOutSpecColor; + POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro); + float _SpecularAnisoJitterMirrored; + POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro); + POI_TEXTURE_NOSAMPLER(_SpecularAnisoFakeUV); + POI_TEXTURE_NOSAMPLER(_AnisoTangentMap); + POI_TEXTURE_NOSAMPLER(_SpecularMask); + float _SpecularAnisoJitterMicroMultiplier; + float _SpecularAnisoJitterMacroMultiplier; + float4 _SpecularTint; + float _SpecularSmoothness; + float _Spec1Offset; + float _Spec1JitterStrength; + float _Spec2Smoothness; + float _Spec2Offset; + float _Spec2JitterStrength; + float _AnisoUseTangentMap; + float _AnisoSpec1Alpha; + float _AnisoSpec2Alpha; + float _SpecularInvertSmoothness; + half _SpecularMetallic; + float _SpecularNormal; + float _SpecularNormal1; + // Toon + fixed _SpecularToonStart; + fixed _SpecularToonEnd; + half4 _SpecularToonInnerOuter; + + float _EnableSpecular1; + float _SpecWhatTangent1; + float _SpecularType1; + float _SmoothnessFrom1; + POI_TEXTURE_NOSAMPLER(_SpecularMetallicMap1); + POI_TEXTURE_NOSAMPLER(_SpecularMap1); + POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro1); + POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro1); + float _SpecularAnisoJitterMirrored1; + POI_TEXTURE_NOSAMPLER(_AnisoTangentMap1); + POI_TEXTURE_NOSAMPLER(_SpecularMask1); + float _SpecularAnisoJitterMicroMultiplier1; + float _SpecularAnisoJitterMacroMultiplier1; + float4 _SpecularTint1; + float _SpecularSmoothness1; + float _Spec1Offset1; + float _Spec1JitterStrength1; + float _Spec2Smoothness1; + float _Spec2Offset1; + float _Spec2JitterStrength1; + float _AnisoUseTangentMap1; + float _AnisoSpec1Alpha1; + float _AnisoSpec2Alpha1; + float _SpecularInvertSmoothness1; + half _SpecularMetallic1; + // Toon + half4 _SpecularToonInnerOuter1; + fixed _SpecularToonStart1; + fixed _SpecularToonEnd1; + + UnityIndirect ZeroIndirect() + { + UnityIndirect ind; + ind.diffuse = 0; + ind.specular = 0; + return ind; + } + + // From unity just putting it here in case I want to mod it + half4 poiRealisticSpecular(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness, + float3 normal, float3 halfDir, + UnityLight light, UnityIndirect gi) + { + float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness); + #define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0 + + #if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV + half shiftAmount = dot(normal, poiCam.viewDir); + normal = shiftAmount < 0.0f ? normal + poiCam.viewDir * (-shiftAmount + 1e-5f): normal; + float nv = saturate(dot(normal, poiCam.viewDir)); + #else + half nv = abs(dot(normal, poiCam.viewDir)); + #endif + + float nl = saturate(dot(normal, light.dir)); + float nh = saturate(dot(normal, halfDir)); + + half lv = saturate(dot(light.dir, poiCam.viewDir)); + half lh = saturate(dot(light.dir, halfDir)); + + half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl; + + float roughness = PerceptualRoughnessToRoughness(perceptualRoughness); + + roughness = max(roughness, 0.002); + float V = SmithJointGGXVisibilityTerm(nl, nv, roughness); + float D = GGXTerm(nh, roughness); + + float specularTerm = V * D * UNITY_PI; + + #ifdef UNITY_COLORSPACE_GAMMA + specularTerm = sqrt(max(1e-4h, specularTerm)); + #endif + + specularTerm = max(0, specularTerm * nl); + #if defined(_POI_SPECULARHIGHLIGHTS_OFF) + specularTerm = 0.0; + #endif + + half surfaceReduction; + #ifdef UNITY_COLORSPACE_GAMMA + surfaceReduction = 1.0 - 0.28 * roughness * perceptualRoughness; + #else + surfaceReduction = 1.0 / (roughness * roughness + 1.0); + #endif + + specularTerm *= any(specColor) ? 1.0: 0.0; + + half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity)); + half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm) + + specularTerm * light.color * FresnelTerm(specColor, lh) + + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv); + + return half4(color, 1); + } + + half3 calculateRealisticSpecular(float4 albedo, float2 uv, float4 specularTint, float specularSmoothness, float invertSmoothness, float mixAlbedoWithTint, float4 specularMap, float3 specularLight, float3 normal, float attenuation, float3 lightDirection, float nDotL, float3 halfDir) + { + half oneMinusReflectivity; + half3 finalSpecular; + UnityLight unityLight; + unityLight.color = specularLight; + unityLight.dir = lightDirection; + unityLight.ndotl = nDotL; + + + if (float(1) == 0) + { + half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularMap.rgb * specularTint.rgb, /*out*/ oneMinusReflectivity); + finalSpecular = poiRealisticSpecular(diffColor, specularMap.rgb, oneMinusReflectivity, specularMap.a * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect()); + } + else + { + half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularTint.rgb, /*out*/ oneMinusReflectivity); + float smoothness = max(max(specularMap.r, specularMap.g), specularMap.b); + finalSpecular = poiRealisticSpecular(diffColor, 1, oneMinusReflectivity, smoothness * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect()); + } + finalSpecular *= lerp(1, albedo.rgb, mixAlbedoWithTint); + return finalSpecular; + } + + half3 calculateToonSpecular(float4 albedo, float2 uv, float2 specularToonInnerOuter, float specularMixAlbedoIntoTint, float smoothnessFrom, float4 specularMap, float3 specularLight, float3 normal, float3 halfDir, float attenuation) + { + half3 finalSpecular = smoothstep(1 - specularToonInnerOuter.y, 1 - specularToonInnerOuter.x, dot(halfDir, normal)) * specularLight; + + if (smoothnessFrom == 0) + { + finalSpecular.rgb *= specularMap.rgb * lerp(1, albedo.rgb, specularMixAlbedoIntoTint); + finalSpecular *= specularMap.a; + } + else + { + finalSpecular *= specularMap.r * lerp(1, albedo.rgb, specularMixAlbedoIntoTint); + } + return finalSpecular; + } + + float3 strandSpecular(float TdotL, float TdotV, float specPower, float nDotL) + { + #ifdef FORWARD_ADD_PASS + nDotL *= poiLight.attenuation * poiLight.additiveShadow; + #endif + float Specular = saturate(nDotL) * pow(saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV), specPower); + half normalization = sqrt((specPower + 1) * ((specPower) + 1)) / (8 * pi); + Specular *= normalization; + return Specular; + } + + half3 AnisotropicSpecular( + float specWhatTangent, float anisoUseTangentMap, float specularSmoothness, float spec2Smoothness, + float anisoSpec1Alpha, float anisoSpec2Alpha, float4 specularTint, float specularMixAlbedoIntoTint, float4 specularMap, float3 specularLight, float3 lightDirection, float3 halfDir, float nDotL, float jitter, float4 packedTangentMap, in float4 albedo) + { + float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal; + + + float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap); + normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal); + //float3 normalDirection = normalize(mul(poiMesh.normals[float(1)], poiTData.tangentTransform)); + float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform)); + float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz; + float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation + float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz; + tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap)); + + tangentDirectionMap += float(0) +jitter; + + float TdotL = dot(lightDirection, tangentDirectionMap); + float TdotV = dot(poiCam.viewDir, tangentDirectionMap); + float TdotH = dot(halfDir, tangentDirectionMap); + half specPower = RoughnessToSpecPower(1.0 - specularSmoothness * specularMap.a); + half spec2Power = RoughnessToSpecPower(1.0 - spec2Smoothness * specularMap.a); + half Specular = 0; + + float3 spec = strandSpecular(TdotL, TdotV, specPower, nDotL) * anisoSpec1Alpha; + float3 spec2 = strandSpecular(TdotL, TdotV, spec2Power, nDotL) * anisoSpec2Alpha; + + return max(spec, spec2) * specularMap.rgb * specularTint.a * specularLight * lerp(1, albedo.rgb, specularMixAlbedoIntoTint); + } + + inline float3 toonAnisoSpecular(float specWhatTangent, float anisoUseTangentMap, float3 lightDirection, float halfDir, float4 specularMap, float nDotL, fixed gradientStart, fixed gradientEnd, float4 specColor, float4 finalColor, fixed metallic, float jitter, float mirrored, float4 packedTangentMap) + { + float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal; + + float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap); + normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal); + //float3 normalDirection = normalize(mul(poiMesh.normals[float(1)], poiTData.tangentTransform)); + float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform)); + float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz; + float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation + float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz; + tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap)); + + if (!mirrored) + { + tangentDirectionMap += jitter; + } + + float TdotL = dot(lightDirection, tangentDirectionMap); + float TdotV = dot(poiCam.viewDir, tangentDirectionMap); + float TdotH = dot(halfDir, tangentDirectionMap); + + float specular = saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV); + + fixed smoothAlpha = specular; + if(mirrored) + { + smoothAlpha = max(specular - jitter, 0); + } + + specular = smoothstep(gradientStart, gradientEnd, smoothAlpha); + + /* + + if(_CenterOutSpecColor) + { + specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, clamp(float2(specular, specular), 0.01, .99), float4(0,0,0,0)); + } + */ + + #ifdef FORWARD_ADD_PASS + nDotL *= poiLight.attenuation * poiLight.additiveShadow; + #endif + + return saturate(nDotL) * specular * poiLight.color * specColor * specularMap.rgb * lerp(1, finalColor, metallic) * specularMap.a; + } + + inline float SpecularHQ(half roughness, half dotNH, half dotLH) + { + roughness = saturate(roughness); + roughness = max((roughness * roughness), 0.002); + half roughnessX2 = roughness * roughness; + + half denom = dotNH * dotNH * (roughnessX2 - 1.0) + 1.0f; + half D = roughnessX2 / (3.14159 * denom * denom); + + half k = roughness / 2.0f; + half k2 = k * k; + half invK2 = 1.0f - k2; + + half vis = rcp(dotLH * dotLH * invK2 + k2); + + float specTerm = vis * D; + + return specTerm; + } + + float3 calculateNewSpecular(in float3 specularMap, uint colorFrom, in float4 albedo, in float3 specularTint, in float specularMetallic, in float specularSmoothness, in half dotNH, in half dotLH, in float3 lightColor, in float attenuation) + { + float3 specColor = specularTint; + float metallic = specularMetallic; + float roughness = 1 - specularSmoothness; + float perceptualRoughness = roughness; + //float reflectInverse = DielectricSpec.a - metallic * DielectricSpec.a; + //float reflectivity = 1.0h - reflectInverse; + float3 specMapColor = lerp(specularMap, 1, colorFrom); + float3 specularColor = lerp(DielectricSpec.rgb * specMapColor, lerp(specularMap, albedo.rgb, colorFrom), metallic); + //albedo.rgb *= reflectInverse; + return clamp(specularColor * lightColor * attenuation * specularTint * SpecularHQ(perceptualRoughness, dotNH, dotLH), 0, lightColor * specularTint); + } + + float3 calculateSpecular(in float4 albedo) + { + half3 finalSpecular = 0; + half3 finalSpecular1 = 0; + float4 realisticAlbedo = albedo; + float4 realisticAlbedo1 = albedo; + float4 specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + half metallic = POI2D_SAMPLER_PAN(_SpecularMetallicMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r * float(1); + half specularMask = POI2D_SAMPLER_PAN(_SpecularMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + float attenuation = saturate(poiLight.nDotL); + #ifdef POI_LIGHTING + + if (float(0) && float(0) == 0 && float(0) == 1) + { + attenuation = poiLight.rampedLightMap; + } + #endif + + + if(float(1) == 1) // Realistic + { + if (float(1) == 1) + { + specularMap.a = specularMap.r; + specularMap.rgb = 1; + } + + if(float(1)) + { + specularMap.a = 1 - specularMap.a; + } + + #ifdef FORWARD_BASE_PASS + finalSpecular += calculateNewSpecular(specularMap.rgb, float(1), realisticAlbedo, float4(1,1,1,1), metallic, float(1) * specularMap.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, attenuation); + #else + finalSpecular += calculateNewSpecular(specularMap.rgb, float(1), realisticAlbedo, float4(1,1,1,1), metallic, float(1) * specularMap.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, poiLight.attenuation); + #endif + } + + + if(float(1) == 4) + { + float jitter = 0; + float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r; + fixed jitterOffset = (1 - float(0)) * .5; + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += float(0); + + float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + finalSpecular += toonAnisoSpecular(float(0), float(0), poiLight.direction, poiLight.halfDir, specularMap, poiLight.nDotL, float(0.95), float(1), float4(1,1,1,1), albedo, metallic, jitter, float(0), packedTangentMap); + finalSpecular *= attenuation; + } + + #ifdef FORWARD_BASE_PASS + + if(float(1) == 2) // Toon + { + finalSpecular += calculateToonSpecular(albedo, poiMesh.uv[0], float4(0.25,0.3,0,1), metallic, float(1), specularMap, poiLight.color, poiMesh.normals[float(1)], poiLight.halfDir, poiLight.attenuation); + finalSpecular *= float4(1,1,1,1); + } + + if (float(1) == 3) // anisotropic + { + float jitter = 0; + float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r; + fixed jitterOffset = (1 - float(0)) * .5; + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += float(0); + + float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + finalSpecular += AnisotropicSpecular(float(0), float(0), float(1), float(0), float(1), float(1), float4(1,1,1,1), metallic, specularMap, poiLight.color, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap, albedo); + finalSpecular *= float4(1,1,1,1); + finalSpecular *= attenuation; + } + #endif + + #ifdef VERTEXLIGHT_ON + // Non Important Lights + for (int index = 0; index < 4; index ++) + { + attenuation = poiLight.vAttenuationDotNL[index]; + + if (float(1) == 1) // Realistic + { + finalSpecular += calculateNewSpecular(specularMap.rgb, float(1), realisticAlbedo, float4(1,1,1,1), metallic, float(1) * specularMap.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]); + } + } + #endif + + finalSpecular *= float4(1,1,1,1).a; + finalSpecular = finalSpecular.rgb; + finalSpecular *= specularMask; + + + if (float(0)) + { + float4 specularMap1 = POI2D_SAMPLER_PAN(_SpecularMap1, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + half specularMask1 = POI2D_SAMPLER_PAN(_SpecularMask1, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + half metallic1 = POI2D_SAMPLER_PAN(_SpecularMetallicMap1, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r * float(0); + float attenuation = poiLight.attenuation; + + if(float(1) == 1) // Realistic + { + + if (float(1) == 1) + { + specularMap1.a = specularMap1.r; + specularMap1.rgb = 1; + } + else + { + realisticAlbedo1.rgb = specularMap1.rgb; + } + + + if(float(0)) + { + specularMap1.a = 1 - specularMap1.a; + } + + #ifdef FORWARD_BASE_PASS + finalSpecular1 = calculateNewSpecular(specularMap1.rgb, float(1), realisticAlbedo1, float4(1,1,1,1), metallic1, float(0.75) * specularMap1.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, saturate(poiLight.nDotL)); + #else + finalSpecular1 = calculateNewSpecular(specularMap1.rgb, float(1), realisticAlbedo1, float4(1,1,1,1), metallic1, float(0.75) * specularMap1.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, poiLight.attenuation); + #endif + } + + + if(float(1) == 4) + { + float jitter = 0; + float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r; + fixed jitterOffset = (1 - float(0)) * .5; + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += float(0); + + float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + finalSpecular1 += toonAnisoSpecular(float(0), float(0), poiLight.direction, poiLight.halfDir, specularMap1, poiLight.nDotL, float(0.95), float(1), float4(1,1,1,1), albedo, metallic1, jitter, float(0), packedTangentMap); + finalSpecular1 *= poiLight.attenuation; + } + + + if(float(1) == 2) // Toon + { + finalSpecular1 = calculateToonSpecular(albedo, poiMesh.uv[0], float4(0.25,0.3,0,1), metallic1, float(1), specularMap1, poiLight.color, poiMesh.normals[float(1)], poiLight.halfDir, poiLight.attenuation); + finalSpecular1 *= float4(1,1,1,1); + } + + if (float(1) == 3) // anisotropic + { + float jitter = 0; + float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r; + fixed jitterOffset = (1 - float(0)) * .5; + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[float(0)]), float4(0,0,0,0)).r - jitterOffset) * float(0); + jitter += float(0); + + float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + finalSpecular1 = AnisotropicSpecular(float(0), float(0), float(0.75), float(0), float(1), float(1), float4(1,1,1,1), metallic1, specularMap1, poiLight.color, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap, albedo); + finalSpecular1 *= float4(1,1,1,1); + finalSpecular1 *= poiLight.attenuation; + } + + #ifdef FORWARD_BASE_PASS + // Non Important Lights + #ifdef VERTEXLIGHT_ON + for (int index = 0; index < 4; index ++) + { + attenuation = poiLight.vAttenuationDotNL[index]; + + if (float(1) == 1) // Realistic + { + finalSpecular1 += calculateNewSpecular(specularMap1.rgb, float(1), realisticAlbedo1, float4(1,1,1,1), metallic1, float(0.75) * specularMap1.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]); + } + } + #endif + #endif + + finalSpecular1 *= float4(1,1,1,1).a; + finalSpecular1 = finalSpecular1.rgb; + finalSpecular1 *= specularMask1; + } + return finalSpecular + finalSpecular1; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpecular.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpecular.cginc.meta new file mode 100644 index 00000000..df18d2f2 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSpecular.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b8b018769d36880408af56fa5dd9b32b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSubsurfaceScattering.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSubsurfaceScattering.cginc new file mode 100644 index 00000000..b7c21c01 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSubsurfaceScattering.cginc @@ -0,0 +1,28 @@ +#ifndef SUBSURFACE + #define SUBSURFACE + + float _SSSThicknessMod; + float _SSSSCale; + float _SSSPower; + float _SSSDistortion; + float4 _SSSColor; + float _EnableSSS; + + POI_TEXTURE_NOSAMPLER(_SSSThicknessMap); + + float3 calculateSubsurfaceScattering() + { + float SSS = 1 - POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)); + + half3 vLTLight = poiLight.direction + poiMesh.normals[0] * float(1); + half flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), float(5)) * float(0.25); + #ifdef FORWARD_BASE_PASS + half3 fLT = (flTDot) * saturate(SSS + - 1 * float(0)); + #else + half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + - 1 * float(0)); + #endif + + return fLT * poiLight.color * float4(1,0,0,1); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSubsurfaceScattering.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSubsurfaceScattering.cginc.meta new file mode 100644 index 00000000..cd87a1ed --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiSubsurfaceScattering.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fafc27a7d567e364aa659cbeacad8a00 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiTessellation.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiTessellation.cginc new file mode 100644 index 00000000..4912473d --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiTessellation.cginc @@ -0,0 +1,117 @@ +#ifndef POI_TESSELLATION + #define POI_TESSELLATION + + float _TessellationPhongStrength; + float _TessellationEdgeLength; + float _TessellationExtrusionAmount; + float _TessellationUniform; + + struct TessellationControlPoint + { + float4 vertex: INTERNALTESSPOS; + float3 normal: NORMAL; + float4 tangent: TANGENT; + float4 color: COLOR; + float2 uv0: TEXCOORD0; + float2 uv1: TEXCOORD1; + float2 uv2: TEXCOORD2; + float2 uv3: TEXCOORD3; + }; + + struct TessellationFactors + { + float edge[3]: SV_TessFactor; + float inside: SV_InsideTessFactor; + }; + + TessellationControlPoint poiTessellationVert(appdata v) + { + TessellationControlPoint p; + p.vertex = v.vertex; + p.normal = v.normal; + p.tangent = v.tangent; + p.color = v.color; + p.uv0 = v.uv0; + p.uv1 = v.uv1; + p.uv2 = v.uv2; + p.uv3 = v.uv3; + return p; + } + + float TessellationEdgeFactor(float3 p0, float3 p1) + { + #ifndef _FADING_ON + float edgeLength = distance(p0, p1); + + float3 edgeCenter = (p0 + p1) * 0.5; + float viewDistance = distance(edgeCenter, _WorldSpaceCameraPos); + + return edgeLength * _ScreenParams.y / + (_TessellationEdgeLength * viewDistance); + #else + return _TessellationUniform; + #endif + } + + TessellationFactors poiPatchConst( + InputPatch < TessellationControlPoint, 3 > patch + ) + { + + TessellationFactors f; + float3 p0 = mul(unity_ObjectToWorld, patch[0].vertex).xyz; + float3 p1 = mul(unity_ObjectToWorld, patch[1].vertex).xyz; + float3 p2 = mul(unity_ObjectToWorld, patch[2].vertex).xyz; + f.edge[0] = TessellationEdgeFactor(p1, p2); + f.edge[1] = TessellationEdgeFactor(p2, p0); + f.edge[2] = TessellationEdgeFactor(p0, p1); + f.inside = (TessellationEdgeFactor(p1, p2) + + TessellationEdgeFactor(p2, p0) + + TessellationEdgeFactor(p0, p1)) * (1 / 3.0); + return f; + } + + [UNITY_domain("tri")] + [UNITY_outputcontrolpoints(3)] + [UNITY_outputtopology("triangle_cw")] + [UNITY_partitioning("fractional_odd")] + [UNITY_patchconstantfunc("poiPatchConst")] + TessellationControlPoint poiHull( + InputPatch < TessellationControlPoint, 3 > patch, + uint id: SV_OutputControlPointID + ) + { + return patch[id]; + } + + [UNITY_domain("tri")] + v2f poiDomain( + TessellationFactors factors, + OutputPatch < TessellationControlPoint, 3 > patch, + float3 barycentricCoordinates: SV_DomainLocation + ) + { + appdata data; + + #define MY_DOMAIN_PROGRAM_INTERPOLATE(fieldName) data.fieldName = patch[0].fieldName * barycentricCoordinates.x + patch[1].fieldName * barycentricCoordinates.y + patch[2].fieldName * barycentricCoordinates.z; + + MY_DOMAIN_PROGRAM_INTERPOLATE(vertex) + float3 pp[3]; + for (int i = 0; i < 3; ++ i) + { + pp[i] = data.vertex.xyz - patch[i].normal * (dot(data.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + } + data.vertex.xyz = _TessellationPhongStrength * (pp[0] * barycentricCoordinates.x + pp[1] * barycentricCoordinates.y + pp[2] * barycentricCoordinates.z) + (1.0f - _TessellationPhongStrength) * data.vertex.xyz; + MY_DOMAIN_PROGRAM_INTERPOLATE(normal) + data.vertex.xyz += data.normal.xyz * _TessellationExtrusionAmount; + MY_DOMAIN_PROGRAM_INTERPOLATE(tangent) + MY_DOMAIN_PROGRAM_INTERPOLATE(color) + MY_DOMAIN_PROGRAM_INTERPOLATE(uv0) + MY_DOMAIN_PROGRAM_INTERPOLATE(uv1) + MY_DOMAIN_PROGRAM_INTERPOLATE(uv2) + MY_DOMAIN_PROGRAM_INTERPOLATE(uv3) + + return vert(data); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiTessellation.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiTessellation.cginc.meta new file mode 100644 index 00000000..f574bf06 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiTessellation.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e9c51d2233628d74caf84b1b067ea2ba +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiUVDistortion.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiUVDistortion.cginc new file mode 100644 index 00000000..38d5fd75 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiUVDistortion.cginc @@ -0,0 +1,34 @@ +#ifndef POI_UV_DISTORTION + #define POI_UV_DISTORTION + + UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture); float4 _DistortionFlowTexture_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture1); float4 _DistortionFlowTexture1_ST; + POI_TEXTURE_NOSAMPLER(_DistortionMask); + + float _DistortionStrength; + float _DistortionStrength1; + float2 _DistortionSpeed; + float2 _DistortionSpeed1; + + float2 getTorusUv(float2 uv) + { + // translated to hlsl from https://www.shadertoy.com/view/Md3Bz7 + // http://web.cs.ucdavis.edu/~amenta/s12/findnorm.pdf + float phi = 6.28318530718f * uv.x; + float theta = 6.28318530718f * uv.y; + float3 c = cos(float3(phi, phi + 1.57079632679f, theta)); + float2 result = float2(c.x * c.z, -c.y * c.z); + return result * 0.5 + 0.5; + } + + float2 calculateDistortionUV(float2 uv) + { + half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[float(0)], float4(0,0,0,0)).r; + float4 flowVector = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture) + _Time.x * float4(0.5,0.5,0,0)) * 2 - 1; + float4 flowVector1 = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture1, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture1) + _Time.x * float4(0.5,0.5,0,0)) * 2 - 1; + flowVector *= float(0.5); + flowVector1 *= float(0.5); + return uv + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiUVDistortion.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiUVDistortion.cginc.meta new file mode 100644 index 00000000..2a7bebeb --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiUVDistortion.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cf6bfbcb005c7614f8c5c1cf0e069682 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiV2F.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiV2F.cginc new file mode 100644 index 00000000..0e29a179 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiV2F.cginc @@ -0,0 +1,34 @@ +#ifndef POI_V2F + #define POI_V2F + + struct v2f + { + float4 pos: SV_POSITION; + float4 uv0: TEXCOORD0; + float4 uv1: TEXCOORD1; + float3 normal: TEXCOORD2; + float3 tangentViewDir: TEXCOORD3; + float4 tangent: TEXCOORD4; + float4 worldPos: TEXCOORD5; + float4 localPos: TEXCOORD6; + float4 grabPos: TEXCOORD7; + float3 barycentricCoordinates: TEXCOORD8; + #if defined(GRAIN) + float4 worldDirection: TEXCOORD9; + #endif + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + float4 lightmapUV: TEXCOORD10; + #endif + float3 modelPos: TEXCOORD11; + float angleAlpha: TEXCOORD12; + float4 vertexColor: TEXCOORD14; + #ifdef FUR + float furAlpha: TEXCOORD15; + #endif + UNITY_SHADOW_COORDS(16) + UNITY_FOG_COORDS(17) + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiV2F.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiV2F.cginc.meta new file mode 100644 index 00000000..6f0eb4a4 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiV2F.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bafa45c21b46b7e489abecc1e9ffa8e0 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVert.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVert.cginc new file mode 100644 index 00000000..1558e937 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVert.cginc @@ -0,0 +1,126 @@ +#ifndef POI_VERT + #define POI_VERT + + float _VertexManipulationHeightUV; + float _VertexUnwrap; + + #define PM UNITY_MATRIX_P + + inline float4 CalculateFrustumCorrection() + { + float x1 = -PM._31 / (PM._11 * PM._34); + float x2 = -PM._32 / (PM._22 * PM._34); + return float4(x1, x2, 0, PM._33 / PM._34 + x1 * PM._13 + x2 * PM._23); + } + + v2f vert(appdata v) + { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + #ifdef _COLOROVERLAY_ON + v.vertex.xyz = lerp(v.vertex.xyz, float3(v.uv0.x - .5, v.uv0.y - .5, 0), float(0)); + #endif + #ifdef AUTO_EXPOSURE + applyLocalVertexTransformation(v.normal, v.tangent, v.vertex); + #endif + + UNITY_INITIALIZE_OUTPUT(v2f, o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #ifdef _REQUIRE_UV2 //POI_MIRROR + applyMirrorRenderVert(v.vertex); + #endif + + TANGENT_SPACE_ROTATION; + o.localPos = v.vertex; + o.worldPos = mul(unity_ObjectToWorld, o.localPos); + o.normal = UnityObjectToWorldNormal(v.normal); + //o.localPos.x *= -1; + //o.localPos.xz += sin(o.localPos.y * 100 + _Time.y * 5) * .0025; + + float2 uvToUse = 0; + + if (float(0) == 0) + { + uvToUse = v.uv0.xy; + } + + if(float(0) == 1) + { + uvToUse = v.uv1.xy; + } + + if(float(0) == 2) + { + uvToUse = v.uv2.xy; + } + + if(float(0) == 3) + { + uvToUse = v.uv3.xy; + } + #ifdef AUTO_EXPOSURE + applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse); + #endif + applyVertexGlitching(o.worldPos, o.localPos); + applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy); + #ifdef AUTO_EXPOSURE + applyVertexRounding(o.worldPos, o.localPos); + #endif + o.pos = UnityObjectToClipPos(o.localPos); + o.grabPos = ComputeGrabScreenPos(o.pos); + o.uv0.xy = v.uv0.xy; + o.uv0.zw = v.uv1.xy; + o.uv1.xy = v.uv2.xy; + o.uv1.zw = v.uv3.xy; + o.vertexColor = v.color; + o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)); + o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + #ifdef POI_BULGE + bulgyWolgy(o); + #endif + + + o.angleAlpha = 1; + #ifdef _SUNDISK_NONE //POI_RANDOM + o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos); + #endif + + #if defined(LIGHTMAP_ON) + o.lightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + UNITY_TRANSFER_SHADOW(o, o.uv0.xy); + UNITY_TRANSFER_FOG(o, o.pos); + + #if defined(_PARALLAXMAP) // POI_PARALLAX + v.tangent.xyz = normalize(v.tangent.xyz); + v.normal = normalize(v.normal); + float3x3 objectToTangent = float3x3( + v.tangent.xyz, + cross(v.normal, v.tangent.xyz) * v.tangent.w, + v.normal + ); + o.tangentViewDir = mul(objectToTangent, ObjSpaceViewDir(v.vertex)); + #endif + + #ifdef POI_META_PASS + o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); + #endif + + #if defined(GRAIN) + float4 worldDirection; + + worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos; + worldDirection.w = dot(o.pos, CalculateFrustumCorrection()); + o.worldDirection = worldDirection; + #endif + + return o; + } +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVert.cginc.meta new file mode 100644 index 00000000..650f62fc --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVert.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d694b379b6a3963488da42f18b42ba78 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVertexManipulations.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVertexManipulations.cginc new file mode 100644 index 00000000..b1984175 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVertexManipulations.cginc @@ -0,0 +1,93 @@ +#ifndef POI_VERTEX_MANIPULATION + #define POI_VERTEX_MANIPULATION + + #include "CGI_PoiMath.cginc" + + float4 _VertexManipulationLocalTranslation; + float4 _VertexManipulationLocalRotation; + float4 _VertexManipulationLocalScale; + float4 _VertexManipulationWorldTranslation; + + float _VertexManipulationHeight; + float _VertexManipulationHeightBias; + sampler2D _VertexManipulationHeightMask; float4 _VertexManipulationHeightMask_ST; + float2 _VertexManipulationHeightPan; + + + //Vertex Glitching + float _EnableVertexGlitch; + sampler2D _VertexGlitchMap; float4 _VertexGlitchMap_ST; + float _VertexGlitchThreshold; + float _VertexGlitchFrequency; + float _VertexGlitchStrength; + // Rounding + float _VertexRoundingDivision; + float _VertexRoundingEnabled; + + void applyLocalVertexTransformation(inout float3 normal, inout float4 tangent, inout float4 vertex) + { + normal = rotate_with_quaternion(normal, float4(0,0,0,1)); + tangent.xyz = rotate_with_quaternion(tangent.xyz, float4(0,0,0,1)); + vertex = transform(vertex, float4(0,0,0,1), float4(0,0,0,1), float4(1,1,1,1)); + + //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1); + } + + void applyLocalVertexTransformation(inout float3 normal, inout float4 vertex) + { + normal = rotate_with_quaternion(normal, float4(0,0,0,1)); + vertex = transform(vertex, float4(0,0,0,1), float4(0,0,0,1), float4(1,1,1,1)); + + //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1); + } + + void applyWorldVertexTransformation(inout float4 worldPos, inout float4 localPos, inout float3 worldNormal, float2 uv) + { + float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + float4(0,0,0,0) * _Time.x, 0, 0)).r - float(1)) * float(0) * worldNormal; + worldPos.rgb += float4(0,0,0,1).xyz * float4(0,0,0,1).w + heightOffset; + localPos.xyz = mul(unity_WorldToObject, worldPos); + } + + void applyWorldVertexTransformationShadow(inout float4 worldPos, inout float4 localPos, float3 worldNormal, float2 uv) + { + float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + float4(0,0,0,0) * _Time.x, 0, 0)).r - float(1)) * float(0) * worldNormal; + worldPos.rgb += float4(0,0,0,1).xyz * float4(0,0,0,1).w + heightOffset; + localPos.xyz = mul(unity_WorldToObject, worldPos); + } + + void applyVertexRounding(inout float4 worldPos, inout float4 localPos) + { + + if (float(0)) + { + worldPos.xyz = (ceil(worldPos * float(500)) / float(500)) - 1 / float(500) * .5; + localPos = mul(unity_WorldToObject, worldPos); + } + } + + void applyVertexGlitching(inout float4 worldPos, inout float4 localPos) + { + + if(_EnableVertexGlitch) + { + float3 forward = getCameraPosition() - mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz; + forward.y = 0; + forward = normalize(forward); + float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward)); + float glitchAmount = frac(sin(dot(_Time.xy + worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1; + /* + float uvl = worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed; + float uvr = worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed; + float glitchAmountLeft = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).r; + float glitchAmountRight = -tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).r; + float glitchAmount = glitchAmountLeft + glitchAmountRight; + */ + float time = _Time.y * _VertexGlitchFrequency; + float randomGlitch = (sin(time) + sin(2.2 * time + 5.52) + sin(2.9 * time + 0.93) + sin(4.6 * time + 8.94)) / 4; + worldPos.xyz += glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch); + localPos = mul(unity_WorldToObject, worldPos); + } + } + +#endif +// diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVertexManipulations.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVertexManipulations.cginc.meta new file mode 100644 index 00000000..2f17c176 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVertexManipulations.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 05a814509566c7f4490cb802a2cd7469 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVideo.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVideo.cginc new file mode 100644 index 00000000..ec2d37e4 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVideo.cginc @@ -0,0 +1,266 @@ +#ifndef POI_VIDEO + #define POI_VIDEO + + UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoPixelTexture); float4 _VideoPixelTexture_ST; + UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoMaskTexture); float4 _VideoMaskTexture_ST; + + float _VideoUVNumber; + float _VideoType; + float3 pixels; + float2 _VideoResolution; + sampler2D _VideoGameboyRamp; + half _VideoBacklight; + half _VideoCRTRefreshRate; + half _VideoCRTPixelEnergizedTime; + half _VideoEnableVideoPlayer; + half _VideoRepeatVideoTexture; + half _VideoPixelateToResolution; + float2 _VideoMaskPanning; + // Video Settings + half _VideoSaturation; + half _VideoContrast; + float2 _VideoTiling; + float2 _VideoOffset; + float2 _VideoPanning; + //Debug + half _VideoEnableDebug; + + UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoDebugTexture); float4 _VideoDebugTexture_ST; + + + sampler2D _VRChat_VideoPlayer; + float4 _VRChat_VideoPlayer_TexelSize; + + float4 globalVideoPlayerColor; + float3 globalColorToDisplayOnScreen; + float globalVideoOn; + + float3 applyBacklight(float3 albedo, half backlightStrength) + { + return max(backlightStrength, albedo.rgb); + } + + float3 applyViewAngleTN(float3 albedo) + { + float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb)); + float upwardShift = dot(reflectionVector, poiMesh.binormal); + upwardShift = pow(upwardShift, 1); + float sideShift = dot(reflectionVector, poiMesh.tangent); + sideShift *= pow(sideShift, 3); + #if !UNITY_COLORSPACE_GAMMA + albedo = LinearToGammaSpace(albedo); + #endif + albedo = saturate(lerp(half3(0.5, 0.5, 0.5), albedo, upwardShift + 1)); + #if !UNITY_COLORSPACE_GAMMA + albedo = GammaToLinearSpace(albedo); + #endif + albedo = (lerp(albedo, albedo.gbr, sideShift)); + return albedo; + } + + float calculateCRTPixelBrightness() + { + float totalPixels = _VideoResolution.x * _VideoResolution.y; + float2 uvPixel = float2((floor((1 - poiMesh.uv[_VideoUVNumber].y) * _VideoResolution.y)) / _VideoResolution.y, (floor(poiMesh.uv[_VideoUVNumber].x * _VideoResolution.x)) / _VideoResolution.x); + float currentPixelNumber = _VideoResolution.x * (_VideoResolution.y * uvPixel.x) + _VideoResolution.y * uvPixel.y; + float currentPixelAlpha = currentPixelNumber / totalPixels; + half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate); + float electronBeamPixelNumber = totalPixels * electronBeamAlpha; + + float DistanceInPixelsFromCurrentElectronBeamPixel = 0; + if (electronBeamPixelNumber >= currentPixelNumber) + { + DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber - currentPixelNumber; + } + else + { + DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber + (totalPixels - currentPixelNumber); + } + float CRTFrameTime = 1 / _VideoCRTRefreshRate; + float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels); + + return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam); + } + + void applyContrastSettings(inout float3 pixel) + { + #if !UNITY_COLORSPACE_GAMMA + pixel = LinearToGammaSpace(pixel); + #endif + pixel = saturate(lerp(half3(0.5, 0.5, 0.5), pixel, _VideoContrast + 1)); + #if !UNITY_COLORSPACE_GAMMA + pixel = GammaToLinearSpace(pixel); + #endif + } + + void applySaturationSettings(inout float3 pixel) + { + pixel = lerp(pixel.rgb, dot(pixel.rgb, float3(0.3, 0.59, 0.11)), -_VideoSaturation); + } + + void applyVideoSettings(inout float3 pixel) + { + applySaturationSettings(pixel); + applyContrastSettings(pixel); + } + + void calculateLCD(inout float4 albedo) + { + + if(_VideoEnableVideoPlayer == 0) + { + globalColorToDisplayOnScreen = albedo; + } + globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01); + applyVideoSettings(globalColorToDisplayOnScreen); + albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight; + } + void calculateTN(inout float4 albedo) + { + if(_VideoEnableVideoPlayer == 0) + { + globalColorToDisplayOnScreen = albedo; + } + globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01); + globalColorToDisplayOnScreen = applyViewAngleTN(globalColorToDisplayOnScreen); + applyVideoSettings(globalColorToDisplayOnScreen); + albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight; + } + void calculateCRT(inout float4 albedo) + { + + if(_VideoEnableVideoPlayer == 0) + { + globalColorToDisplayOnScreen = albedo; + } + float brightness = calculateCRTPixelBrightness(); + applyVideoSettings(globalColorToDisplayOnScreen); + albedo.rgb = globalColorToDisplayOnScreen * pixels * brightness * _VideoBacklight; + } + void calculateOLED(inout float4 albedo) + { + + if(_VideoEnableVideoPlayer == 0) + { + globalColorToDisplayOnScreen = albedo; + } + applyVideoSettings(globalColorToDisplayOnScreen); + albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight; + } + void calculateGameboy(inout float4 albedo) + { + + if(_VideoEnableVideoPlayer == 0) + { + globalColorToDisplayOnScreen = albedo; + } + applyVideoSettings(globalColorToDisplayOnScreen); + half brightness = saturate((globalColorToDisplayOnScreen.r + globalColorToDisplayOnScreen.g + globalColorToDisplayOnScreen.b) * .3333333); + albedo.rgb = tex2D(_VideoGameboyRamp, brightness); + } + void calculateProjector(inout float4 albedo) + { + + if(_VideoEnableVideoPlayer == 0) + { + globalColorToDisplayOnScreen = albedo; + } + applyVideoSettings(globalColorToDisplayOnScreen); + + float3 projectorColor = albedo * globalColorToDisplayOnScreen * _VideoBacklight; + albedo.r = clamp(projectorColor.r, albedo.r, 1000); + albedo.g = clamp(projectorColor.g, albedo.g, 1000); + albedo.b = clamp(projectorColor.b, albedo.b, 1000); + } + + void applyScreenEffect(inout float4 albedo, inout float3 videoEmission) + { + float4 albedoBeforeScreen = albedo; + + pixels = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoPixelTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoPixelTexture) * _VideoResolution); + globalVideoOn = 0; + + if(_VideoEnableVideoPlayer == 1) + { + float4 videoTexture = 0; + + if(_VideoPixelateToResolution) + { + + if(_VideoEnableDebug) + { + videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, round(TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoResolution + .5) / _VideoResolution); + } + else + { + videoTexture = tex2D(_VRChat_VideoPlayer, round(poiMesh.uv[_VideoUVNumber] * _VideoResolution + .5) / _VideoResolution); + } + } + else + { + + if(_VideoEnableDebug) + { + videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoTiling + _VideoOffset); + } + else + { + videoTexture = tex2D(_VRChat_VideoPlayer, ((poiMesh.uv[_VideoUVNumber] + _Time.x * _VideoPanning) * _VideoTiling) + _VideoOffset); + } + } + if(videoTexture.a == 1) + { + globalColorToDisplayOnScreen = videoTexture.rgb; + globalVideoOn = 1; + } + } + + + if(_VideoRepeatVideoTexture == 1) + { + if(poiMesh.uv[_VideoUVNumber].x > 1 || poiMesh.uv[_VideoUVNumber].x < 0 || poiMesh.uv[_VideoUVNumber].y > 1 || poiMesh.uv[_VideoUVNumber].y < 0) + { + return; + } + } + + switch(_VideoType) + { + case 0: // LCD + { + calculateLCD(albedo); + break; + } + case 1: // TN + { + calculateTN(albedo); + break; + } + case 2: // CRT + { + calculateCRT(albedo); + break; + } + case 3: // OLED + { + calculateOLED(albedo); + break; + } + case 4: // Gameboy + { + calculateGameboy(albedo); + break; + } + case 5: // Projector + { + calculateProjector(albedo); + break; + } + } + + float screenMask = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoMaskTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoMaskTexture) + _Time.x * _VideoMaskPanning); + albedo = lerp(albedoBeforeScreen, albedo, screenMask); + videoEmission = max(albedo.rgb * screenMask - 1, 0); + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVideo.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVideo.cginc.meta new file mode 100644 index 00000000..d7b5b734 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVideo.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cb5c661968ae23f428a67b5e5a4b6924 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVoronoi.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVoronoi.cginc new file mode 100644 index 00000000..db3d3130 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVoronoi.cginc @@ -0,0 +1,304 @@ +#ifndef POI_VORONOI + #define POI_VORONOI + + #include "CGI_PoiRNG.cginc" + + float _VoronoiSpace; + float _VoronoiBlend; + float _VoronoiType; + float4 _VoronoiColor0; + float _VoronoiEmission0; + float4 _VoronoiColor1; + float _VoronoiEmission1; + float2 _VoronoiGradient; + float _VoronoiScale; + float3 _VoronoiSpeed; + float _VoronoiEnableRandomCellColor; + float2 _VoronoiRandomMinMaxSaturation; + float2 _VoronoiRandomMinMaxBrightness; + float3 randomPoint; + float _VoronoiEffectsMaterialAlpha; + + POI_TEXTURE_NOSAMPLER(_VoronoiMask); + POI_TEXTURE_NOSAMPLER(_VoronoiNoise); + float _VoronoiNoiseIntensity; + + float2 inoise(float3 P, float jitter) + { + float3 Pi = mod(floor(P), 289.0); + float3 Pf = frac(P); + float3 oi = float3(-1.0, 0.0, 1.0); + float3 of = float3(-0.5, 0.5, 1.5); + float3 px = Permutation(Pi.x + oi); + float3 py = Permutation(Pi.y + oi); + + float3 p, ox, oy, oz, dx, dy, dz; + float2 F = 1e6; + + for (int i = 0; i < 3; i ++) + { + for (int j = 0; j < 3; j ++) + { + p = Permutation(px[i] + py[j] + Pi.z + oi); // pij1, pij2, pij3 + + ox = frac(p * K) - Ko; + oy = mod(floor(p * K), 7.0) * K - Ko; + + p = Permutation(p); + + oz = frac(p * K) - Ko; + + dx = Pf.x - of[i] + jitter * ox; + dy = Pf.y - of[j] + jitter * oy; + dz = Pf.z - of + jitter * oz; + + float3 d = dx * dx + dy * dy + dz * dz; // dij1, dij2 and dij3, squared + + //Find lowest and second lowest distances + for (int n = 0; n < 3; n ++) + { + if (d[n] < F[0]) + { + F[1] = F[0]; + F[0] = d[n]; + randomPoint = p; + } + else if(d[n] < F[1]) + { + F[1] = d[n]; + } + } + } + } + + return F; + } + + float voronoi2D(in float2 x, float scale, float2 speed) + { + x *= scale; + x += speed * _Time.x; + float2 n = floor(x); + float2 f = frac(x); + + // first pass: regular voronoi + float2 mg, mr; + float md = 8.0; + for (int j = -1; j <= 1; j ++) + { + for (int i = -1; i <= 1; i ++) + { + float2 g = float2(float(i), float(j)); + float2 o = random2(n + g); + float2 currentPoint = o; + + float2 r = g + o - f; + float d = dot(r, r); + + if (d < md) + { + md = d; + mr = r; + mg = g; + randomPoint.xy = currentPoint; + } + } + } + + // second pass: distance to borders + md = 8.0; + for (int r = -2; r <= 2; r ++) + { + for (int q = -2; q <= 2; q ++) + { + float2 g = mg + float2(float(q), float(r)); + float2 o = random2(n + g); + + float2 r = g + o - f; + + if (dot(mr - r, mr - r) > 0.00001) + { + md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); + } + } + } + return md; + } + + float voronoi3D(in float3 x, float scale, float3 speed) + { + x *= scale; + x += speed * _Time.x; + float3 n = floor(x); + float3 f = frac(x); + + // first pass: regular voronoi + float3 mg, mr; + float md = 8.0; + for (int j = -1; j <= 1; j ++) + { + for (int i = -1; i <= 1; i ++) + { + for (int h = -1; h <= 1; h ++) + { + float3 g = float3(float(h), float(i), float(j)); + float3 o = random3(n + g); + float3 currentPoint = o; + + float3 r = g + o - f; + float d = dot(r, r); + + if (d < md) + { + md = d; + mr = r; + mg = g; + randomPoint = currentPoint; + } + } + } + } + + // second pass: distance to borders + md = 8.0; + for (int r = -2; r <= 2; r ++) + { + for (int q = -2; q <= 2; q ++) + { + for (int p = -2; p <= 2; p ++) + { + float3 g = mg + float3(float(p), float(q), float(r)); + float3 o = random3(n + g); + + float3 r = g + o - f; + + if (dot(mr - r, mr - r) > 0.00001) + { + md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); + } + } + } + } + return md; + } + + + + // fracal sum, range -1.0 - 1.0 + float VoronoiNoise_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time) + { + float freq = scale; + float weight = 1.0f; + float sum = 0; + for (int i = 0; i < octaveNumber; i ++) + { + float2 F = inoise(p * freq + time * speed, jitter) * weight; + + sum += sqrt(F[0]); + + freq *= octaveScale; + weight *= 1.0f - octaveAttenuation; + } + return sum; + } + + float VoronoiNoiseDiff_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time) + { + float freq = scale; + float weight = 1.0f; + float sum = 0; + for (int i = 0; i < octaveNumber; i ++) + { + float2 F = inoise(p * freq + time * speed, jitter) * weight; + + sum += sqrt(F[1]) - sqrt(F[0]); + + freq *= octaveScale; + weight *= 1.0f - octaveAttenuation; + } + return sum; + } + + void applyVoronoi(inout float4 finalColor, inout float3 VoronoiEmission) + { + float voronoiOctaveNumber = 1; + float voronoiOctaveScale = 1; + float voronoiOctaveAttenuation = 1; + randomPoint = 0; + float4 voronoiColor1 = _VoronoiColor1; + + float voronoi = 0; + + float3 position = 0; + + + if (_VoronoiSpace == 0) + { + position = poiMesh.localPos; + } + + if(_VoronoiSpace == 1) + { + position = poiMesh.worldPos; + } + + if(_VoronoiSpace == 2) + { + position = float3(poiMesh.uv[0].x, poiMesh.uv[0].y, 0); + } + + float mask = POI2D_SAMPLER_PAN(_VoronoiMask, _MainTex, poiMesh.uv[_VoronoiMaskUV], _VoronoiMaskPan).r; + float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoisePan).r * _VoronoiNoiseIntensity; + + + if(_VoronoiType == 0) // Basic + { + voronoi = voronoi2D(position.xy, _VoronoiScale, _VoronoiSpeed); + } + + if (_VoronoiType == 1) // Diff + { + voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, _VoronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x); + } + + if (_VoronoiType == 2) // Fixed Border + { + voronoi = voronoi3D(position, _VoronoiScale, _VoronoiSpeed); + // isolines + //color = c.x * (0.5 + 0.5 * sin(64.0 * c.x)) * 1.0; + } + + if (_VoronoiEnableRandomCellColor == 1) + { + float3 rando = random3(randomPoint); + fixed hue = rando.x; + fixed saturation = lerp(_VoronoiRandomMinMaxSaturation.x, _VoronoiRandomMinMaxSaturation.y, rando.y); + fixed value = lerp(_VoronoiRandomMinMaxBrightness.x, _VoronoiRandomMinMaxBrightness.y, rando.z); + float3 hsv = float3(hue, saturation, value); + + voronoiColor1.rgb = HSVtoRGB(hsv); + } + + float2 voronoiGradient = _VoronoiGradient; + voronoiGradient.xy += edgeNoise; + float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi); + + + if(_VoronoiBlend == 0) + { + float4 voronoiColor = lerp(_VoronoiColor0, voronoiColor1, ramp); + + if(_VoronoiEffectsMaterialAlpha) + { + finalColor.rgba = lerp(finalColor, voronoiColor, mask); + } + else + { + finalColor.rgb = lerp(finalColor.rgb, voronoiColor.rgb, mask * voronoiColor.a); + } + } + float4 voronoiEmissionColor = lerp(_VoronoiColor0 * _VoronoiEmission0, voronoiColor1 * _VoronoiEmission1, ramp); + VoronoiEmission = voronoiEmissionColor.rgb * mask * voronoiEmissionColor.a; + } + +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVoronoi.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVoronoi.cginc.meta new file mode 100644 index 00000000..9b2ca887 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiVoronoi.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e519ed7db0421e146b182977d4161cc4 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiWireframe.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiWireframe.cginc new file mode 100644 index 00000000..49c602c0 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiWireframe.cginc @@ -0,0 +1,111 @@ +#ifndef POI_WIREFRAME + #define POI_WIREFRAME + + UNITY_DECLARE_TEX2D_NOSAMPLER(_WireframeTexture); float4 _WireframeTexture_ST; + float2 _WireframeTexturePan; + float _WireframeSmoothing; + float _WireframeThickness; + float4 _WireframeColor; + float _WireframeAlpha; + float _WireframeEnable; + float _WireframeWaveEnabled; + float _WireframeWaveDensity; + float _WireframeWaveSpeed; + float _WireframeEdgeOpacity; + float _WireframeFaceOpacity; + half _WireframeEmissionAlpha; + float _WireframeEmissionStrength; + float _WireframeQuad; + float _WireframeUV; + + #ifndef POI_SHADOW + void applyWireframe(inout float3 wireframeEmission, inout float4 albedo) + { + + if (_WireframeEnable) + { + float4 colorMap = UNITY_SAMPLE_TEX2D_SAMPLER(_WireframeTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_WireframeUV], _WireframeTexture) + _Time.x * _WireframeTexturePan); + float size = _WireframeThickness; + half3 width = abs(ddx(poiMesh.barycentricCoordinates)) + abs(ddy(poiMesh.barycentricCoordinates)); + half3 eF = smoothstep(0, width * size, poiMesh.barycentricCoordinates); + half minBary = size > 0 ? min(min(eF.x, eF.y), eF.z): 1; + + float4 wireframeColor = _WireframeColor * colorMap; + + albedo.a *= lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary); + albedo.rgb = lerp(lerp(albedo.rgb, wireframeColor.rgb, wireframeColor.a), albedo.rgb, minBary); + wireframeEmission = wireframeColor.rgb * _WireframeEmissionStrength * (1 - minBary) * _WireframeColor.a; + } + } + + [maxvertexcount(3)] + void wireframeGeom(triangle v2f IN[3], inout TriangleStream < v2f > tristream) + { + + if(_WireframeQuad) + { + float e1 = length(IN[0].localPos - IN[1].localPos); + float e2 = length(IN[1].localPos - IN[2].localPos); + float e3 = length(IN[2].localPos - IN[0].localPos); + + float3 quad = 0; + if(e1 > e2 && e1 > e3) + quad.y = 1.; + else if(e2 > e3 && e2 > e1) + quad.x = 1; + else + quad.z = 1; + + IN[0].barycentricCoordinates = fixed3(1, 0, 0) + quad; + IN[1].barycentricCoordinates = fixed3(0, 0, 1) + quad; + IN[2].barycentricCoordinates = fixed3(0, 1, 0) + quad; + } + else + { + IN[0].barycentricCoordinates = fixed3(1, 0, 0); + IN[1].barycentricCoordinates = fixed3(0, 1, 0); + IN[2].barycentricCoordinates = fixed3(0, 0, 1); + } + + + + tristream.Append(IN[0]); + tristream.Append(IN[1]); + tristream.Append(IN[2]); + } + #else + + float applyShadowWireframe(float2 uv, float3 barycentricCoordinates, float3 normal, float3 worldPos) + { + + if(_WireframeEnable) + { + float wireframeFadeAlpha = _WireframeAlpha; + float3 finalWireframeColor = 0; + + float3 barys; + barys.xy = barycentricCoordinates; + barys.z = 1 - barys.x - barys.y; + float3 deltas = fwidth(barys); + float3 smoothing = deltas * _WireframeSmoothing; + float wireframeThickness = _WireframeThickness; + float3 thickness = deltas * wireframeThickness; + barys = smoothstep(thickness, thickness + smoothing, barys); + float minBary = min(barys.x, min(barys.y, barys.z)); + + return lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary); + } + } + + [maxvertexcount(3)] + void wireframeGeom(triangle V2FShadow IN[3], inout TriangleStream < V2FShadow > tristream) + { + IN[0].barycentricCoordinates = fixed3(1, 0, 0); + IN[1].barycentricCoordinates = fixed3(0, 1, 0); + IN[2].barycentricCoordinates = fixed3(0, 0, 1); + tristream.Append(IN[0]); + tristream.Append(IN[1]); + tristream.Append(IN[2]); + } + #endif +#endif diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiWireframe.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiWireframe.cginc.meta new file mode 100644 index 00000000..0b5ed3f0 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_PoiWireframe.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d9f398363f4556147a27f2268a3f6769 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_Poicludes.cginc b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_Poicludes.cginc new file mode 100644 index 00000000..319de57c --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_Poicludes.cginc @@ -0,0 +1,171 @@ +#ifndef POICLUDES + #define POICLUDES + + UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST; float4 _MainTex_TexelSize; + sampler2D _PoiGrab; + sampler2D _CameraDepthTexture; + float _Cutoff; + float _AlphaMod; + + //Structs + struct appdata + { + float4 vertex: POSITION; + float3 normal: NORMAL; + float4 tangent: TANGENT; + float4 color: COLOR; + float2 uv0: TEXCOORD0; + float2 uv1: TEXCOORD1; + float2 uv2: TEXCOORD2; + float2 uv3: TEXCOORD3; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + #ifdef OUTLINE + float _LineWidth; + float _OutlineEmission; + float4 _LineColor; + sampler2D _OutlineTexture; float4 _OutlineTexture_ST; float2 _OutlineTexturePan; float _OutlineTextureUV; + float4 _OutlineFadeDistance; + float4 _OutlineGlobalPan; + #endif + + struct PoiLighting + { + half3 direction; + half3 color; + fixed attenuation; + #ifdef FORWARD_ADD_PASS + fixed additiveShadow; + #endif + half3 directLighting; + half3 indirectLighting; + half lightMap; + half3 rampedLightMap; + half3 finalLighting; + half3 halfDir; + half nDotL; + half nDotH; + half lDotv; + half lDotH; + half nDotV; + half N0DotV; + half diffuseTerm; + + // World normal dot half direction + #ifdef POI_VAR_DOTNH + half dotNH; + #endif + + // Light direction dot half direction + #ifdef POI_VAR_DOTLH + half dotLH; + #endif + + #ifdef VERTEXLIGHT_ON + // Non Important Lights + float4 vDotNL; + float3 vColor[4]; + float4 vCorrectedDotNL; + float4 vAttenuation; + float4 vAttenuationDotNL; + float3 vPosition[4]; + float3 vDirection[4]; + float3 vFinalLighting; + float3 vHalfDir[4]; + + #ifdef POI_VAR_DOTLH + half4 vDotLH; + #endif + + #ifdef POI_VAR_DOTNH + half4 vDotNH; + #endif + + #endif + }; + + struct PoiCamera + { + half3 viewDir; + half3 tangentViewDir; + half3 forwardDir; + half3 worldPos; + float viewDotNormal; + float distanceToModel; + float distanceToVert; + float3 reflectionDir; + float3 vertexReflectionDir; + float2 screenUV; + float4 clipPos; + #if defined(GRAIN) + float4 worldDirection; + #endif + float4 grabPos; + }; + + struct PoiMesh + { + float3 normals[2]; + float3 tangent; + float3 binormal; + float3 localPos; + float3 worldPos; + float3 modelPos; + float3 tangentSpaceNormal; + float2 uv[5]; + float4 vertexColor; + fixed3 barycentricCoordinates; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + float4 lightmapUV; + #endif + float isFrontFace; + #ifdef FUR + float furAlpha; + #endif + }; + + struct PoiTangentData + { + float3x3 tangentTransform; + float3x3 tangentToWorld; + }; + + struct FragmentCommonData + { + half3 diffColor, specColor; + // Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level. + // Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots. + half oneMinusReflectivity, smoothness; + float3 normalWorld; + float3 eyeVec; + half alpha; + float3 posWorld; + + #if UNITY_STANDARD_SIMPLE + half3 reflUVW; + #endif + + #if UNITY_STANDARD_SIMPLE + half3 tangentSpaceNormal; + #endif + }; + + struct Debug + { + float debug1; + float2 debug2; + float3 debug3; + float4 debug4; + }; + + static Debug debug; + static PoiLighting poiLight; + static PoiCamera poiCam; + static PoiMesh poiMesh; + static UnityGI gi; + static FragmentCommonData s; + static PoiTangentData poiTData; + +#endif + diff --git a/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_Poicludes.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_Poicludes.cginc.meta new file mode 100644 index 00000000..ff2ef3c8 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/Avatars/Naro/Materials/OptimizedShaders/BWPants-395ccf06/Assets/Resources/Poyomi/Shaders/Toon/Includes/CGI_Poicludes.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 806a2de5442625c43a17091ea90405ac +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: |