summaryrefslogtreecommitdiff
path: root/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes
diff options
context:
space:
mode:
Diffstat (limited to 'VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes')
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc345
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc29
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc29
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc53
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc37
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc38
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc108
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc180
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc188
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc102
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc45
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc21
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc43
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc216
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc34
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc198
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc43
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc155
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc360
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc40
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc200
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc10
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc37
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc229
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc109
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc294
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc36
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc61
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc409
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc235
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc29
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc159
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc105
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc78
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc126
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc77
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc76
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc90
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc70
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc142
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc263
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc26
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc31
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc51
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc4
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc39
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc53
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc95
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc41
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc73
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc54
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc40
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc478
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc28
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc117
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc22
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc34
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc107
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc97
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc267
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc294
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc111
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc176
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc.meta9
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt7
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt.meta7
128 files changed, 7918 insertions, 0 deletions
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc
new file mode 100644
index 00000000..c5f2dd06
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc
@@ -0,0 +1,345 @@
+
+#ifndef POI_LIGHTING
+ #define POI_LIGHTING
+
+ int _LightingType;
+ float _AdditiveSoftness;
+ float _AdditiveOffset;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _LightingIndirectContribution;
+ float _AttenuationMultiplier;
+ float _EnableLighting;
+ float _LightingControlledUseLightColor;
+ uint _LightingAOTexUV;
+ fixed _LightingStandardSmoothness;
+ fixed _LightingStandardControlsToon;
+ fixed _LightingMinLightBrightness;
+ fixed _LightingAdditiveIntensity;
+ fixed _AoIndirectStrength;
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+
+ sampler2D _LightingAOTex; float4 _LightingAOTex_ST;
+ sampler2D _LightingShadowMask; float4 _LightingShadowMask_ST;
+ float _AOStrength;
+
+ float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+ {
+ #if UNITY_SPECCUBE_BOX_PROJECTION
+ UNITY_BRANCH
+ 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;
+ }
+
+ /*
+ * Standard stuff Start
+ */
+ UnityLight CreateLight(half3 lightDirection, half attenuation, half ndotl)
+ {
+ UnityLight light;
+ light.dir = lightDirection;
+ light.color = saturate(_LightColor0.rgb * lerp(1, attenuation, _AttenuationMultiplier));
+ light.ndotl = ndotl;
+ 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, attenuation, _AttenuationMultiplier);
+ #endif
+
+ float viewZ = dot(_WorldSpaceCameraPos - worldPos, UNITY_MATRIX_V[2].xyz);
+ float shadowFadeDistance = UnityComputeShadowFadeDistance(worldPos, viewZ);
+ float shadowFade = UnityComputeShadowFade(shadowFadeDistance);
+ float bakedAttenuation = UnitySampleBakedOcclusion(lightmapUV.xy, worldPos);
+ attenuation = UnityMixRealtimeAndBakedShadows(
+ attenuation, bakedAttenuation, shadowFade
+ );
+ #endif
+
+ return attenuation;
+ }
+
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ attenuation = FadeShadows(lerp(1, attenuation, _AttenuationMultiplier));
+
+ float nDotL = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = nDotL * (1 - 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
+ }
+
+ UnityIndirect CreateIndirectLight(float3 normal, float3 worldPos, half3 viewDir, float2 uv)
+ {
+ 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, lightmapUV.xy));
+
+ #if defined(DIRLIGHTMAP_COMBINED)
+ float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(
+ unity_LightmapInd, unity_Lightmap, 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, lightmapUV.zw)
+ );
+
+ #if defined(DIRLIGHTMAP_COMBINED)
+ float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(
+ unity_DynamicDirectionality, unity_DynamicLightmap,
+ 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), 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(-viewDir, normal);
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = 1 - _LightingStandardSmoothness;
+ envData.reflUVW = BoxProjection(
+ reflectionDir, 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, worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+ #if UNITY_SPECCUBE_BLENDING
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ 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 = lerp(1, tex2D(_LightingAOTex, TRANSFORM_TEX(uv, _LightingAOTex)), _AOStrength);
+
+ indirectLight.diffuse *= occlusion;
+ indirectLight.diffuse = max(indirectLight.diffuse, _LightingMinLightBrightness);
+ indirectLight.specular *= occlusion;
+ #endif
+
+ return indirectLight;
+ }
+
+ /*
+ * Standard stuff End
+ */
+
+ 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, float3 normal, float3 viewDir, half3 lightDirection, half attenuation, half ndotl, float3 worldPos, float2 uv)
+ {
+ return UNITY_BRDF_PBS(colorToLight, 0, 0, _LightingStandardSmoothness,
+ normal, viewDir, CreateLight(lightDirection, attenuation, ndotl), CreateIndirectLight(normal, worldPos, viewDir, uv));
+ }
+
+ half3 calculateBasePassLighting(float2 uv, float3 lightColor, half nDotL, half attenuation, half3 normal, half3 viewDir, half3 lightDirection, float3 worldPos)
+ {
+ half3 finalLighting = 0;
+ UNITY_BRANCH
+ if (_LightingType == 0 || _LightingType == 1)
+ {
+ float AOMap = 1;
+ float DirectAO = 1;
+ float IndirectAO = 1;
+ #ifndef OUTLINE
+ AOMap = tex2D(_LightingAOTex, TRANSFORM_TEX(uv, _LightingAOTex));
+ DirectAO = lerp(1, AOMap, _AOStrength);
+ IndirectAO = lerp(1, AOMap, _AoIndirectStrength);
+ #endif
+
+ half3 grayscale_vector = float3(.33333, .33333, .33333);
+ half3 ShadeSH9Plus = GetSHLength();
+ half3 ShadeSH9Minus = ShadeSH9(float4(0, 0, 0, 1));
+ half3 directLighting = saturate(lerp(ShadeSH9Plus, lightColor, 1 - _LightingIndirectContribution));
+ half3 indirectLighting = saturate(ShadeSH9Minus) * IndirectAO;
+
+ half4 shadowStrength = 1;
+ #ifndef OUTLINE
+ shadowStrength = tex2D(_LightingShadowMask, TRANSFORM_TEX(uv, _LightingShadowMask));
+ shadowStrength *= _ShadowStrength;
+ #else
+ shadowStrength = _OutlineShadowStrength;
+ #endif
+
+ float bw_lightColor = dot(lightColor, grayscale_vector);
+ float bw_directLighting = (((nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(normal), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+ float lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting) * DirectAO;
+ float3 rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, lightMap + _ShadowOffset), shadowStrength.r);
+
+ UNITY_BRANCH
+ if(_LightingType == 0)
+ {
+ finalLighting = lerp(indirectLighting, directLighting, rampedLightMap);
+ }
+ UNITY_BRANCH
+ if(_LightingType == 1)
+ {
+ finalLighting = rampedLightMap * directLighting;
+ }
+ }
+ return finalLighting;
+ }
+
+ void applyFurLighting(inout float4 finalColor, float2 uv, half attenuation, half3 normal, half3 viewDir, float3 worldPos)
+ {
+ float3 finalLighting = 0;
+ float3 lightColor = 0;
+ float3 lightDirection = 0;
+
+ #ifdef FORWARD_BASE_PASS
+ //lightColor = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ lightColor = saturate(magic + normalLight);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ lightColor = _LightColor0.rgb;
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ lightDirection = normalize(_WorldSpaceLightPos0.xyz - i.worldPos);
+ #endif
+ #endif
+
+ half nDotL = dot(normal, lightDirection);
+
+ #ifdef FORWARD_BASE_PASS
+ finalLighting = calculateBasePassLighting(uv, lightColor, nDotL, attenuation, normal, viewDir, lightDirection, worldPos);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ finalLighting = lightColor * attenuation * smoothstep(.5 - _AdditiveSoftness + _AdditiveOffset, .5 + _AdditiveSoftness + _AdditiveOffset, .5 * nDotL + .5);
+ finalLighting *= _LightingAdditiveIntensity;
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_LightingType == 2)
+ {
+ finalColor.rgb = calculateRealisticLighting(finalColor, normal, viewDir, lightDirection, attenuation, nDotL, worldPos, uv);
+ }
+ else
+ {
+ finalColor.rgb *= max(finalLighting, _LightingMinLightBrightness);
+ }
+ #else
+ finalColor.rgb *= max(finalLighting, _LightingMinLightBrightness);
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc.meta
new file mode 100644
index 00000000..5e047b15
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_FurLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7a386c7b6529ea741a7b4b91edd52894
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc
new file mode 100644
index 00000000..ac378228
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc
@@ -0,0 +1,29 @@
+#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
+
+ UNITY_BRANCH
+ if (_MainAlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ finalColor.a *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _MainMipScale;
+ // rescale alpha by partial derivative
+ finalColor.a = (finalColor.a - _Clip) / max(fwidth(finalColor.a), 0.0001) + _Clip;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc.meta
new file mode 100644
index 00000000..058d9cc3
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiAlphaToCoverage.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6748073008081154589fb6cc65f5fa4f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc
new file mode 100644
index 00000000..3744bda4
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc
@@ -0,0 +1,29 @@
+#ifndef POI_BACKFACE
+ #define POI_BACKFACE
+
+ float _BackFaceEnabled;
+ uint _BackFaceTextureUV;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float _BackFaceHueShift;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BackFaceTexture); float4 _BackFaceTexture_ST;
+
+ float3 BackFaceColor;
+ void applyBackFaceTexture()
+ {
+ BackFaceColor = 0;
+ UNITY_BRANCH
+ if (_BackFaceEnabled)
+ {
+ if(!poiMesh.isFrontFace)
+ {
+ albedo = POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiMesh.uv[_BackFaceTextureUV], _BackFacePanning);
+ _DetailTexIntensity = _BackFaceDetailIntensity;
+ BackFaceColor = albedo.rgb;
+ _MainHueShift = _BackFaceHueShift;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc.meta
new file mode 100644
index 00000000..a13087e7
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBackFace.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4f4a418d4b464c64ca33221f2e6e8cbb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc
new file mode 100644
index 00000000..db553208
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc
@@ -0,0 +1,53 @@
+#ifndef POI_BLACKLIGHT
+ #define POI_BLACKLIGHT
+
+ float4 _BlackLightMaskStart;
+ float4 _BlackLightMaskEnd;
+ float4 _BlackLightMaskKeys;
+ float _BlackLightMaskDebug;
+ uint _BlackLightMaskDissolve;
+ uint _BlackLightMaskMetallic;
+ uint _BlackLightMaskClearCoat;
+ uint _BlackLightMaskMatcap;
+ uint _BlackLightMaskMatcap2;
+ uint _BlackLightMaskEmission;
+ uint _BlackLightMaskEmission2;
+ uint _BlackLightMaskFlipbook;
+ uint _BlackLightMaskPanosphere;
+ uint _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 ++)
+ {
+ if(unity_LightColor[lightIndex].a == _BlackLightMaskKeys[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
+*/ \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc.meta
new file mode 100644
index 00000000..ec1be4e2
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b026a041cbf89ab41885a9800b6fae01
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc
new file mode 100644
index 00000000..c6457025
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc
@@ -0,0 +1,37 @@
+#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 uint sourceFactor, const float4 sourceColor, const uint destinationFactor, const float4 destinationColor)
+ {
+ 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,
+ sourceColor.aaaa,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ destinationColor.aaaa,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor.aaaa,
+ saturate(sourceColor.aaaa),
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor,sourceColor, sourceColor.a);
+ }
+
+#endif
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc.meta
new file mode 100644
index 00000000..7a36482e
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlending.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4b77204a0028f804a873d6c111a13453
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc
new file mode 100644
index 00000000..21f0c00c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc
@@ -0,0 +1,38 @@
+#ifndef POI_BULGE
+ #define POI_BULGE
+
+ #ifndef POI_CAMERA_DEPTH
+ #define POI_CAMERA_DEPTH
+ sampler2D _CameraDepthTexture;
+ #endif
+
+ 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc.meta
new file mode 100644
index 00000000..aecc98bd
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBulge.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 375d769e3421a0c46a1c07b480cb90ce
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc
new file mode 100644
index 00000000..aef58a06
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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;
+ uint _ClearCoatNormalToUse;
+ float _ClearCoatForceLighting;
+ float lighty_clear_boy_uwu_var;
+
+
+ float3 CalculateClearCoatEnvironmentalReflections()
+ {
+ float3 reflectionColor;
+
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_ClearCoatSmoothnessMap, _MainTex, poiMesh.uv[_ClearCoatSmoothnessMapUV], _ClearCoatSmoothnessMapPan));
+ if (_ClearCoatInvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _ClearCoatSmoothness;
+ float roughness = 1 - smoothnessMap;
+
+ lighty_clear_boy_uwu_var = 0;
+
+ float3 reflectedDir = _ClearCoatNormalToUse == 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;
+
+ UNITY_BRANCH
+ if(_ClearCoatSampleWorld == 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;
+ UNITY_BRANCH
+ 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(_ClearCoatForceLighting)
+ {
+ lighty_clear_boy_uwu_var = 1;
+ }
+
+ return reflectionColor * _ClearCoatTint;
+ }
+
+ void calculateAndApplyClearCoat(inout float4 finalColor)
+ {
+ half clearCoatMap = POI2D_SAMPLER_PAN(_ClearCoatMask, _MainTex, poiMesh.uv[_ClearCoatMaskUV], _ClearCoatMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskClearCoat != 4)
+ {
+ clearCoatMap *= blackLightMask[_BlackLightMaskClearCoat];
+ }
+ #endif
+
+ half3 reflectionColor = CalculateClearCoatEnvironmentalReflections();
+
+ float NormalDotView = abs(dot(_ClearCoat, _ClearCoatNormalToUse == 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 * _ClearCoat * clamp(FresnelTerm(_ClearCoat, 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
+ lerp(finalColor.rgb, reflectionColor, clearCoatMap * _ClearCoat * clamp(FresnelTerm(_ClearCoat, NormalDotView), 0, 1));
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc.meta
new file mode 100644
index 00000000..c9d5a892
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiClearCoat.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 89c507fdc5104cd4cbab3429d080eae5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc
new file mode 100644
index 00000000..f701b5c5
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc
@@ -0,0 +1,180 @@
+#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
+
+ 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;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc.meta
new file mode 100644
index 00000000..07bfcf17
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiColors.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f798bf99177b0494b91b6e2c134d1ecf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc
new file mode 100644
index 00000000..be2138b5
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc
@@ -0,0 +1,188 @@
+#ifndef POI_DATA
+ #define POI_DATA
+
+ float _ParallaxBias;
+
+ void calculateAttenuation(v2f i)
+ {
+ #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)
+ #endif
+ poiLight.attenuation = attenuation;
+ }
+
+ 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 = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ poiLight.color = saturate(magic + normalLight);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.color = _LightColor0.rgb;
+ #endif
+ #endif
+
+ #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;
+ 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
+
+ #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);
+ #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.normals[0] = normalize(i.normal);
+ poiMesh.binormal = CreateBinormal(i.normal, i.tangent.xyz, i.tangent.w);
+ poiMesh.tangent = i.tangent.xyz;
+
+ #ifndef OUTLINE
+ if (!facing)
+ {
+ 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.screenPos = i.screenPos;
+ #endif
+
+ poiCam.tangentViewDir = normalize(i.tangentViewDir);
+ poiCam.tangentViewDir.xy /= (poiCam.tangentViewDir.z + _ParallaxBias);
+ }
+
+ void calculateTangentData()
+ {
+ poiTData.tangentTransform = float3x3(poiMesh.tangent, poiMesh.binormal, poiMesh.normals[0]);
+ poiTData.tangentToWorld = transpose(float3x3(poiMesh.tangent, poiMesh.binormal, poiMesh.normals[0]));
+ }
+
+ void InitData(inout v2f i, uint facing)
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ calculateAttenuation(i);
+
+ InitializeMeshData(i, facing);
+ initializeCamera(i);
+ calculateTangentData();
+ }
+
+ 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
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc.meta
new file mode 100644
index 00000000..b03f1b67
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiData.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9f6b6296870edcb45aa0a77fffaeec5c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc
new file mode 100644
index 00000000..4792487c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc
@@ -0,0 +1,102 @@
+#ifndef POI_DEBUG
+ #define POI_DEBUG
+
+ float _DebugEnabled;
+ uint _DebugMeshData;
+ uint _DebugLightingData;
+ uint _DebugCameraData;
+
+ void displayDebugInfo(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DebugEnabled != 0)
+ {
+ //Mesh Data
+ if (_DebugMeshData == 1)
+ {
+ finalColor.rgb = poiMesh.normals[0];
+ return;
+ }
+ else if(_DebugMeshData == 2)
+ {
+ finalColor.rgb = poiMesh.normals[1];
+ return;
+ }
+ else if(_DebugMeshData == 3)
+ {
+ finalColor.rgb = poiMesh.tangent;
+ return;
+ }
+ else if(_DebugMeshData == 4)
+ {
+ finalColor.rgb = poiMesh.binormal;
+ return;
+ }
+
+ #ifdef POI_LIGHTING
+ if (_DebugLightingData == 1)
+ {
+ finalColor.rgb = poiLight.attenuation;
+ return;
+ }
+ else if(_DebugLightingData == 2)
+ {
+ finalColor.rgb = poiLight.directLighting;
+ return;
+ }
+ else if(_DebugLightingData == 3)
+ {
+ finalColor.rgb = poiLight.indirectLighting;
+ return;
+ }
+ else if(_DebugLightingData == 4)
+ {
+ finalColor.rgb = poiLight.lightMap;
+ return;
+ }
+ else if(_DebugLightingData == 5)
+ {
+ finalColor.rgb = poiLight.rampedLightMap;
+ return;
+ }
+ else if(_DebugLightingData == 6)
+ {
+ finalColor.rgb = poiLight.finalLighting;
+ return;
+ }
+ else if(_DebugLightingData == 7)
+ {
+ finalColor.rgb = poiLight.nDotL;
+ return;
+ }
+ #endif
+
+ if(_DebugCameraData == 1)
+ {
+ finalColor.rgb = poiCam.viewDir;
+ return;
+ }
+ else if(_DebugCameraData == 2)
+ {
+ finalColor.rgb = poiCam.tangentViewDir;
+ return;
+ }
+ else if(_DebugCameraData == 3)
+ {
+ finalColor.rgb = poiCam.forwardDir;
+ return;
+ }
+ else if(_DebugCameraData == 4)
+ {
+ finalColor.rgb = poiCam.worldPos;
+ return;
+ }
+ else if(_DebugCameraData == 5)
+ {
+ finalColor.rgb = poiCam.viewDotNormal;
+ return;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc.meta
new file mode 100644
index 00000000..1f65a768
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDebug.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: dbc4ce40ad3fd4b4697163e382488ce1
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc
new file mode 100644
index 00000000..3a8ac67c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc
@@ -0,0 +1,45 @@
+#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;
+
+ void applyDecal(inout float4 albedo)
+ {
+ float2 uv = poiMesh.uv[_DecalTextureUV];
+ float2 decalCenter = _DecalPosition;
+ float theta = radians(_DecalRotation + _Time.z * _DecalRotationSpeed);
+ 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) - _DecalScale / 2 + _DecalPosition, _DecalScale / 2 + _DecalPosition, float2(0, 0), float2(1, 1));
+
+ half decalAlpha = 1;
+ //float2 uv = TRANSFORM_TEX(poiMesh.uv[_DecalTextureUV], _DecalTexture) + _Time.x * _DecalTexturePan;
+ float4 decalColor = POI2D_SAMPLER_PAN(_DecalTexture, _MainTex, uv, _DecalTexturePan);
+ decalAlpha *= POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiMesh.uv[_DecalMaskUV], _DecalMaskPan).r;
+ UNITY_BRANCH
+ if (!_DecalTiled)
+ {
+ if(uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ decalAlpha = 0;
+ }
+ }
+
+ albedo.rgb = lerp(albedo.rgb, decalColor.rgb, decalColor.a * decalAlpha * _DecalBlendReplace);
+ albedo.rgb *= lerp(1, decalColor.rgb, decalColor.a * decalAlpha * _DecalBlendMultiply);
+ albedo.rgb += decalColor.rgb * decalColor.a * decalAlpha * _DecalBlendAdd;
+ albedo = saturate(albedo);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc.meta
new file mode 100644
index 00000000..7155e4f3
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDecal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 76df50f2fe87f904a8eec955c0c499ff
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc
new file mode 100644
index 00000000..44465e2c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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 LOD_FADE_CROSSFADE // Lighting
+ #ifndef POI_VAR_DOTNL
+ #define POI_VAR_DOTNL
+ #endif
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc.meta
new file mode 100644
index 00000000..0e2813cb
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDefines.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c82aec380114d0a4198a00053c3028dd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc
new file mode 100644
index 00000000..1c746bac
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc
@@ -0,0 +1,43 @@
+#ifndef POI_DEPTH_COLOR
+ #define POI_DEPTH_COLOR
+
+
+ #ifndef POI_CAMERA_DEPTH
+ #define POI_CAMERA_DEPTH
+ sampler2D _CameraDepthTexture;
+ #endif
+
+ float4 _DepthGlowColor;
+ float _DepthGlowEmission;
+ float _FadeLength;
+ float _DepthAlphaMin;
+ float _DepthAlphaMax;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DepthGradient); float4 _DepthGradient_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DepthMask); float4 _DepthMask_ST;
+
+ void applyDepthColor(inout float4 finalColor, inout float3 finalEmission, float4 screenPos, float4 clipPos)
+ {
+ if (!IsInMirror())
+ {
+ _FadeLength *= 0.01;
+ float depth = DecodeFloatRG(tex2Dproj(_CameraDepthTexture, screenPos));
+ 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;
+ finalEmission += depthColor * _DepthGlowEmission * intersect * depthMask;
+ finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask);
+ finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect);
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc.meta
new file mode 100644
index 00000000..ad52a9f2
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDepthColor.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d3087941009844f4a8175b049e249e1b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc
new file mode 100644
index 00000000..b30cfbd0
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc
@@ -0,0 +1,216 @@
+#ifndef POI_DISSOLVE
+ #define POI_DISSOLVE
+
+ uint _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
+ uint _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ // Masking
+ uint _DissolveEmissionSide;
+ uint _DissolveEmission1Side;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+ //Globals
+ #ifndef POI_SHADOW
+ void calculateDissolve()
+ {
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiMesh.uv[_DissolveMaskUV], _DissolveMaskPan).r;
+ dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiMesh.uv[_DissolveToTextureUV], _DissolveToTexturePan) * _DissolveTextureColor;
+ float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexturePan);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if(_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoisePan);
+
+ if(_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if(_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if(_ContinuousDissolve != 0)
+ {
+ _DissolveAlpha = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ _DissolveAlpha *= dissolveMask;
+ dissolveAlpha = _DissolveAlpha;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if(_DissolveType == 1) // Basic
+ {
+ _DissolveAlpha = remap(_DissolveAlpha, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = _DissolveAlpha;
+ //Adjust detail strength to avoid artifacts
+ _DissolveDetailStrength *= smoothstep(1, .99, _DissolveAlpha);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * _DissolveDetailStrength);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, _DissolveAlpha + _DissolveEdgeWidth, _DissolveAlpha, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 2) // Point to Point
+ {
+ float3 direction;
+ float3 currentPos;
+ float distanceTo = 0;
+ direction = normalize(_DissolveEndPoint - _DissolveStartPoint);
+ currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha);
+ if (_DissolveP2PWorldLocal == 0)
+ {
+ distanceTo = dot(poiMesh.localPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ albedo = lerp(albedo, dissolveToTexture, dissolveAlpha);
+
+ if(_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, TRANSFORM_TEX(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient)) * _DissolveEdgeColor;
+ albedo.rgb = lerp(albedo.rgb, edgeColor.rgb, remapClamped(edgeAlpha, 0, 1 - _DissolveEdgeHardness, 0, 1));
+ }
+
+
+
+
+ /*
+ UNITY_BRANCH
+ if (_Blend != 0)
+ {
+ float blendNoise = tex2D(_BlendNoiseTexture, TRANSFORM_TEX(uv, _BlendNoiseTexture));
+ blendAlpha = _BlendAlpha;
+ if(_AutoBlend > 0)
+ {
+ blendAlpha = (clamp(sin(_Time.y * _AutoBlendSpeed / _AutoBlendDelay) * (_AutoBlendDelay + 1), -1, 1) + 1) / 2;
+ }
+ blendAlpha = lerp(saturate((blendNoise - 1) + blendAlpha * 2), step((1-blendAlpha) * 1.001, blendNoise), _Blend - 1);
+
+ float4 blendCol = tex2D(_BlendTexture, TRANSFORM_TEX(uv, _BlendTexture)) * _BlendTextureColor;
+ diffuse = lerp(diffuse, blendCol, blendAlpha);
+ mainTexture.a = lerp(mainTexture.a, blendCol.a, blendAlpha);
+ }
+ */
+ }
+
+ void applyDissolveEmission(inout float3 finalEmission)
+ {
+ finalEmission += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha);
+ finalEmission += lerp(0, edgeColor.rgb * _DissolveEdgeEmission, remapClamped(edgeAlpha, 0, 1 - _DissolveEdgeHardness, 0, 1));
+ }
+
+ #endif
+
+ float calculateShadowDissolveAlpha(float3 worldPos, float3 localPos, float2 uv)
+ {
+ float dissolveMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveMask, _MainTex, TRANSFORM_TEX(uv, _DissolveMask)).r;
+ dissolveToTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveToTexture, _MainTex, TRANSFORM_TEX(uv, _DissolveToTexture) + _Time.y * _DissolveToTexturePan) * _DissolveTextureColor;
+ float dissolveNoiseTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveNoiseTexture, _MainTex, TRANSFORM_TEX(uv, _DissolveNoiseTexture) + _Time.y * _DissolveNoiseTexturePan);
+ float dissolveDetailNoise = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveDetailNoise, _MainTex, TRANSFORM_TEX(uv, _DissolveDetailNoise) + _Time.y * _DissolveDetailNoisePan);
+
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if(_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if(_ContinuousDissolve != 0)
+ {
+ _DissolveAlpha = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ _DissolveAlpha *= dissolveMask;
+ dissolveAlpha = _DissolveAlpha;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if(_DissolveType == 1) // Basic
+ {
+ _DissolveAlpha = remap(_DissolveAlpha, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = _DissolveAlpha;
+ //Adjust detail strength to avoid artifacts
+ _DissolveDetailStrength *= smoothstep(1, .99, _DissolveAlpha);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * _DissolveDetailStrength);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, _DissolveAlpha + _DissolveEdgeWidth, _DissolveAlpha, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 2) // Point to Point
+ {
+ float3 direction;
+ float3 currentPos;
+ float distanceTo = 0;
+ direction = normalize(_DissolveEndPoint - _DissolveStartPoint);
+ currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha);
+ if (_DissolveP2PWorldLocal == 0)
+ {
+ distanceTo = dot(localPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ dissolveAlpha = step(distanceTo, 0);
+ }
+ else
+ {
+ distanceTo = dot(worldPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ dissolveAlpha = step(distanceTo, 0);
+ }
+ }
+
+ return lerp(1, dissolveToTexture, dissolveAlpha).a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc.meta
new file mode 100644
index 00000000..a4893c72
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDissolve.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d7299b35e8e79f9478287dfeb6ee98ca
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc
new file mode 100644
index 00000000..1540b5eb
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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)
+ {
+ UNITY_BRANCH
+ if (_DitheringEnabled)
+ {
+ half dither = calcDither(poiCam.screenUV.xy);
+ finalColor.a = finalColor.a - (dither * (1 - finalColor.a) * _DitherGradient);
+ }
+ }
+ #else
+ void applyShadowDithering(inout float alpha, float2 screenUV)
+ {
+ UNITY_BRANCH
+ if(_DitheringEnabled)
+ {
+ half dither = calcDither(screenUV);
+ alpha = alpha - (dither * (1 - alpha) * _DitherGradient);
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc.meta
new file mode 100644
index 00000000..004bc81b
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiDithering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: de22a513128b5d440aa4777e879e5288
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc
new file mode 100644
index 00000000..12d20eb7
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc
@@ -0,0 +1,198 @@
+#ifndef POI_EMISSION
+ #define POI_EMISSION
+
+ float4 _EmissionColor;
+ POI_TEXTURE_NOSAMPLER(_EmissionMap);
+ POI_TEXTURE_NOSAMPLER(_EmissionMask);
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EnableEmission;
+ float _EmissionHueShift;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _ScrollingEmission;
+ float _EnableGITDEmission;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ uint _GITDEWorldOrMesh;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EmissionHueShiftEnabled;
+ float _EmissionBlinkingOffset;
+ float _EmissionScrollingOffset;
+
+ float4 _EmissionColor1;
+ POI_TEXTURE_NOSAMPLER(_EmissionMap1);
+ POI_TEXTURE_NOSAMPLER(_EmissionMask1);
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ uint _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+
+ float _EmissionReplace;
+
+ float _EmissionScrollingUseCurve;
+ float _EmissionScrollingUseCurve1;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve); float4 _EmissionScrollingCurve_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve1); float4 _EmissionScrollingCurve1_ST;
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled)
+ {
+ float glowInTheDarkMultiplier = 1;
+
+ #ifdef POI_LIGHTING
+ float3 lightValue = _GITDEWorldOrMesh ? poiLight.finalLighting.rgb: poiLight.directLighting.rgb;
+ float gitdeAlpha = (clamp(poiMax(lightValue), minLight, maxLight) - minLight) / (maxLight - minLight);
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ glowInTheDarkMultiplier = lerp(1, glowInTheDarkMultiplier, enabled);
+ #endif
+
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, in float enabled, float offset)
+ {
+ float phase = 0;
+ phase = dot(poiMesh.localPos, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ float width = scrollWidth;
+ phase = (pow(phase, width) + pow(1 - phase, width * 4)) * 0.5;
+ return lerp(1, phase, enabled);
+ }
+
+ 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 = _EmissionStrength;
+ float3 emissionColor0 = 0;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission);
+
+ UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiMesh.uv[_EmissionMapUV], _EmissionMapPan) * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed) * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+
+ UNITY_BRANCH
+ if(_EmissionScrollingUseCurve)
+ {
+ emissionStrength0 *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve) + (dot(poiMesh.localPos, _EmissiveScroll_Direction) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity), _ScrollingEmission);
+ }
+ else
+ {
+ emissionStrength0 *= calculateScrollingEmission(_EmissiveScroll_Direction, _EmissiveScroll_Velocity, _EmissiveScroll_Interval, _EmissiveScroll_Width, _ScrollingEmission, _EmissionScrollingOffset);
+ }
+
+ emissionStrength0 *= calculateBlinkingEmission(_EmissiveBlink_Min, _EmissiveBlink_Max, _EmissiveBlink_Velocity, _EmissionBlinkingOffset);
+ emissionColor0 = hueShift(emissionColor0, _EmissionHueShift * _EmissionHueShiftEnabled);
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMaskUV], _EmissionMask) + _Time.x * _EmissionMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = emissionStrength0 * emissionColor0;
+
+ #ifdef POI_DISSOLVE
+ emission0 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmissionSide);
+ #endif
+
+ // Second Emission
+ float3 emission1 = 0;
+ float emissionStrength1 = 0;
+ float3 emissionColor1 = 0;
+
+ UNITY_BRANCH
+ if (_EnableEmission1)
+ {
+ emissionStrength1 = _EmissionStrength1;
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1);
+
+ UNITY_BRANCH
+ if(!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiMesh.uv[_EmissionMap1UV], _EmissionMap1Pan) * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+
+ UNITY_BRANCH
+ if(_EmissionScrollingUseCurve1)
+ {
+ emissionStrength1 *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1) + (dot(poiMesh.localPos, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1), _ScrollingEmission1);
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _ScrollingEmission1, _EmissionScrollingOffset1);
+ }
+
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ emissionColor1 = hueShift(emissionColor1, _EmissionHueShift1 * _EmissionHueShiftEnabled1);
+ float emissionMask1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMask1UV], _EmissionMask1) + _Time.x * _EmissionMask1Pan);
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = emissionStrength1 * emissionColor1;
+
+ #ifdef POI_DISSOLVE
+ emission1 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmission1Side);
+ #endif
+ }
+
+ finalColor.rgb = lerp(finalColor.rgb, saturate(emissionColor0 + emissionColor1), saturate(emissionStrength0 + emissionStrength1) * _EmissionReplace * poiMax(emission0 + emission1));
+
+ return emission0 + emission1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc.meta
new file mode 100644
index 00000000..2e723a79
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEmission.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 699176517ebc7e948b54546d060b7052
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc
new file mode 100644
index 00000000..5c3b42ee
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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()
+ {
+ float enviroRimAlpha = saturate(1 - smoothstep(min(_RimEnviroSharpness, _RimEnviroWidth), _RimEnviroWidth, poiCam.viewDotNormal));
+ _RimEnviroBlur *= 1.7 - 0.7 * _RimEnviroBlur;
+
+ float3 enviroRimColor = 0;
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ //Probe 1
+ float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * 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], _RimEnviroBlur * 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], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS);
+ enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+ half enviroMask = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ return lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * albedo.rgb), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
new file mode 100644
index 00000000..e8960afe
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2648515d85a969d4ca1ae5850fd8ee57
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc
new file mode 100644
index 00000000..0d76d918
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc
@@ -0,0 +1,155 @@
+#ifndef POI_FLIPBOOK
+ #define POI_FLIPBOOK
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST;
+ float4 _FlipbookColor;
+ float _FlipbookFPS;
+ uint _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float _FlipbookTiled;
+ int _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ uint _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+ POI_TEXTURE_NOSAMPLER(_FlipbookMask);
+
+ // anim
+ uint _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Global
+ float4 flipBookPixel;
+ float4 flipBookPixelMultiply;
+ float flipBookMask;
+
+ #ifndef POI_SHADOW
+
+ void calculateFlipbook()
+ {
+ flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ _FlipbookScaleOffset.xy = 1 - _FlipbookScaleOffset.xy;
+ float2 uv = frac(poiMesh.uv[_FlipbookTexArrayUV]);
+ float theta = radians(_FlipbookRotation + _Time.z * _FlipbookRotationSpeed);
+ 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));
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipBookPixel = 0;
+ return;
+ }
+ }
+
+ uint currentFrame = floor(_FlipbookCurrentFrame) % _FlipbookTotalFrames;
+ if(_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, currentFrame));
+ UNITY_BRANCH
+ if(_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if(_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = _FlipbookColor.rgb;
+ }
+ else
+ {
+ flipBookPixel.rgb *= _FlipbookColor.rgb;
+ }
+ }
+ void applyFlipbook(inout float4 finalColor)
+ {
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if(_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ finalColor.rgb = lerp(finalColor, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask);
+ finalColor.rgb = finalColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask;
+ finalColor.rgb = finalColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply);
+
+ UNITY_BRANCH
+ if(_FlipbookAlphaControlsFinalAlpha)
+ {
+ finalColor.a = lerp(finalColor.a, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+ void applyFlipbookEmission(inout float3 finalEmission)
+ {
+ finalEmission += lerp(0, flipBookPixel.rgb * _FlipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask);
+ }
+
+ #else
+
+ float applyFlipbookAlphaToShadow(float2 uv)
+ {
+ UNITY_BRANCH
+ if(_FlipbookAlphaControlsFinalAlpha)
+ {
+ float flipbookShadowAlpha = 0;
+
+ _FlipbookScaleOffset.xy = 1 - _FlipbookScaleOffset.xy;
+ float theta = radians(_FlipbookRotation);
+
+ 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(_FlipbookCurrentFrame) % _FlipbookTotalFrames;
+ if(_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ half4 flipbookColor = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, currentFrame));
+
+ if(_FlipbookIntensityControlsAlpha)
+ {
+ flipbookColor.a = poiMax(flipbookColor.rgb);
+ }
+
+ UNITY_BRANCH
+ if(_FlipbookTiled == 0)
+ {
+ if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipbookColor.a = 0;
+ }
+ }
+ return flipbookColor.a * _FlipbookColor.a;
+ }
+ return 1;
+ }
+
+ #endif
+#endif
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc.meta
new file mode 100644
index 00000000..4357b7d3
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFlipbook.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b020bec52b785534c98a1865ceff33c4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc
new file mode 100644
index 00000000..83f44ecf
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc
@@ -0,0 +1,360 @@
+#ifndef POIFRAG
+ #define POIFRAG
+
+ float _MainEmissionStrength;
+ float _IgnoreFog;
+ half _GIEmissionMultiplier;
+ uint _IridescenceTime;
+ uint _AlphaToMask;
+ float _ForceOpaque;
+
+ // Built-in uniforms for "vertex lights"
+ //uniform float4 unity_LightColor[4];
+ // array of the colors of the 4 light sources
+ //uniform float4 unity_4LightPosX0;
+ // x coordinates of the 4 light sources in world space
+ //uniform float4 unity_4LightPosY0;
+ // y coordinates of the 4 light sources in world space
+ //uniform float4 unity_4LightPosZ0;
+ // z coordinates of the 4 light sources in world space
+ //uniform float4 unity_4LightAtten0;
+ // scale factors for attenuation with squared distance
+ // uniform vec4 unity_LightPosition[4] is apparently not
+ // always correctly set in Unity 3.4
+ // uniform vec4 unity_LightAtten[4] is apparently not
+ // always correctly set in Unity 3.4
+
+ float4 frag(v2f i, uint facing: SV_IsFrontFace): SV_Target
+ {
+ #ifndef POI_LIGHTING
+ #ifdef FORWARD_ADD_PASS
+ return 0;
+ #endif
+ #endif
+
+ float3 finalLighting = 1;
+ float3 finalSpecular0 = 0;
+ float3 finalSpecular1 = 0;
+ float3 finalEnvironmentalRim = 0;
+ float3 finalSSS = 0;
+ fixed lightingAlpha = 1;
+ float3 IridescenceEmission = 0;
+ float bakedCubemap = 0; // Whether or not metallic should run before or after lighting multiplication
+ float3 spawnInEmission = 0;
+ float3 voronoiEmission = 0;
+ float3 matcapEmission = 0;
+ finalEmission = 0;
+ poiMesh.isFrontFace = facing;
+ //This has to be first because it modifies the UVs for the rest of the functions
+
+ #ifdef POI_DATA
+ InitData(i, facing);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ createBlackLightMask();
+
+ UNITY_BRANCH
+ if (_BlackLightMaskDebug)
+ {
+ return float4(blackLightMask.rgb, 1);
+ }
+ #endif
+
+ // This has to happen in init because it alters UV data globally
+ #ifdef POI_PARALLAX
+ calculateandApplyParallax();
+ #endif
+
+ #ifdef POI_MAINTEXTURE
+ initTextureData();
+ #endif
+
+ #ifdef POI_DECAL
+ applyDecal(albedo);
+ #endif
+
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if (_IridescenceTime == 0)
+ {
+ IridescenceEmission = applyIridescence(albedo);
+ }
+ #endif
+
+ #ifdef POI_VORONOI
+ applyVoronoi(albedo, voronoiEmission);
+ #endif
+
+ #ifdef POI_MSDF
+ ApplyTextOverlayColor(albedo);
+ #endif
+
+ #ifdef POI_LIGHTING
+ finalLighting = calculateLighting(albedo.rgb);
+ #endif
+
+ #ifdef POI_ENVIRONMENTAL_RIM
+ finalEnvironmentalRim = calculateEnvironmentalRimLighting();
+ #endif
+
+ #if defined(POI_METAL) || defined(POI_CLEARCOAT)
+ CalculateReflectionData();
+ #endif
+
+ #ifdef POI_DATA
+ distanceFade();
+ #endif
+
+ #ifdef POI_RANDOM
+ albedo.a *= i.angleAlpha;
+ #endif
+
+ #ifdef CUTOUT
+ UNITY_BRANCH
+ if(_AlphaToMask == 0)
+ {
+ applyDithering(albedo);
+ }
+ #endif
+
+ albedo.a = max(_ForceOpaque, albedo.a);
+
+ #ifdef POI_FLIPBOOK
+ calculateFlipbook();
+ #endif
+
+ #ifdef POI_LIGHTING
+ #ifdef SUBSURFACE
+ finalSSS = calculateSubsurfaceScattering();
+ #endif
+ #endif
+
+ #ifdef POI_RIM
+ calculateRimLighting();
+ #endif
+
+ #ifdef PANOSPHERE
+ calculatePanosphere();
+ #endif
+
+ finalColor = albedo;
+
+
+
+ applySpawnIn(finalColor, spawnInEmission, poiMesh.uv[0], poiMesh.localPos);
+
+ #ifdef MATCAP
+ matcapEmission = applyMatcap(finalColor);
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereColor(finalColor);
+ #endif
+
+ #ifdef POI_FLIPBOOK
+ applyFlipbook(finalColor);
+ #endif
+
+ #ifndef OPAQUE
+ clip(finalColor.a - _Clip);
+ #endif
+
+ #ifdef POI_RIM
+ applyRimColor(finalColor);
+ #endif
+
+ #ifdef POI_DEPTH_COLOR
+ applyDepthColor(finalColor, finalEmission, poiCam.screenPos, poiCam.clipPos);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if(_IridescenceTime == 1)
+ {
+ IridescenceEmission = applyIridescence(finalColor);
+ }
+ #endif
+
+ float4 finalColorBeforeLighting = finalColor;
+
+ #ifdef POI_SPECULAR
+ finalSpecular0 = calculateSpecular(finalColorBeforeLighting);
+
+ //return float4(finalSpecular0, 1);
+ #endif
+
+ #ifdef POI_PARALLAX
+ calculateAndApplyInternalParallax(finalColor);
+ #endif
+
+ #if defined(FORWARD_BASE_PASS)
+ #ifdef POI_LIGHTING
+ #ifdef POI_SPECULAR
+ //applyLightingToSpecular();
+ //applySpecular(finalColor);
+ #endif
+ #endif
+ #endif
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ finalEmission += finalColorBeforeLighting.rgb * _MainEmissionStrength * albedo.a;
+ finalEmission += wireframeEmission;
+ finalEmission += IridescenceEmission;
+ finalEmission += spawnInEmission;
+ finalEmission += voronoiEmission;
+ finalEmission += matcapEmission;
+ UNITY_BRANCH
+ if (_BackFaceEnabled)
+ {
+ finalEmission += BackFaceColor * _BackFaceEmissionStrength;
+ }
+
+ #ifdef PANOSPHERE
+ applyPanosphereEmission(finalEmission);
+ #endif
+
+ #ifdef POI_EMISSION
+ finalEmission += calculateEmissionNew(finalColorBeforeLighting, finalColor);
+ #endif
+
+ #ifdef POI_DISSOLVE
+ applyDissolveEmission(finalEmission);
+ #endif
+
+ #ifdef POI_RIM
+ ApplyRimEmission(finalEmission);
+ #endif
+
+ #ifdef POI_FLIPBOOK
+ applyFlipbookEmission(finalEmission);
+ #endif
+
+ #ifdef POI_GLITTER
+ applyGlitter(finalEmission, finalColor);
+ #endif
+
+ #ifdef POI_MSDF
+ {
+ ApplyTextOverlayEmission(finalEmission);
+ }
+ #endif
+ #endif
+
+ #ifdef POI_LIGHTING
+ #if(defined(POINT) || defined(SPOT))
+ #ifdef POI_METAL
+ //ApplyMetallics(finalColor, true);
+ #endif
+ #endif
+ #endif
+
+ #if defined(TRANSPARENT) && defined(FORWARD_ADD_PASS)
+ finalColor.rgb *= finalColor.a;
+ #endif
+
+ #ifdef POI_VIDEO
+ applyScreenEffect(finalColor, finalColorBeforeLighting);
+ finalEmission += globalVideoEmission;
+ #endif
+
+ #ifdef POI_ALPHA_TO_COVERAGE
+ ApplyAlphaToCoverage(finalColor);
+ #endif
+
+ #ifdef CUTOUT
+ UNITY_BRANCH
+ if (_AlphaToMask == 1)
+ {
+ applyDithering(finalColor);
+ }
+ #endif
+
+ #ifdef POI_METAL
+ bool probeExists = shouldMetalHappenBeforeLighting();
+ UNITY_BRANCH
+ if(!probeExists)
+ {
+ ApplyMetallicsFake(finalColor);
+ }
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ finalColor.rgb *= finalLighting + poiLight.vFinalLighting;
+ #else
+ finalColor.rgb *= finalLighting;
+ #endif
+
+ #ifdef POI_METAL
+ UNITY_BRANCH
+ if(probeExists)
+ {
+ ApplyMetallics(finalColor);
+ }
+ #endif
+
+ finalColor.rgb += finalSpecular0 + finalEnvironmentalRim + finalSSS;
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef POI_CLEARCOAT
+ calculateAndApplyClearCoat(finalColor);
+ #endif
+ #endif
+
+ #ifdef POI_DEBUG
+ displayDebugInfo(finalColor);
+ #endif
+
+ finalColor.a = saturate(finalColor.a);
+
+
+ #if defined(TRANSPARENT) || defined(CUTOUT)
+ //finalEmission *= finalColor.a;
+ #endif
+
+ #ifdef POI_META_PASS
+ UnityMetaInput meta;
+ UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta);
+ meta.Emission = finalEmission * _GIEmissionMultiplier;
+ meta.Albedo = saturate(finalColor.rgb);
+ #ifdef POI_SPECULAR
+ meta.SpecularColor = poiLight.color.rgb * _SpecularTint.rgb * lerp(1, albedo.rgb, _SpecularMetallic) * _SpecularTint.a;
+ #else
+ meta.SpecularColor = poiLight.color.rgb * albedo.rgb;
+ #endif
+ return UnityMetaFragment(meta);
+ #endif
+
+ finalColor.rgb += finalEmission;
+
+ #ifdef POI_GRAB
+ applyGrabEffects(finalColor);
+ #endif
+
+ #ifdef POI_BLUR
+ ApplyBlurToGrabPass(finalColor);
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, finalColor);
+ }
+ #endif
+
+ #ifdef OPAQUE
+ finalColor.a = 1;
+ #endif
+
+ #ifdef FORWARD_ADD_PASS
+ finalColor.rgb *= finalColor.a;
+ #endif
+
+ return finalColor;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc.meta
new file mode 100644
index 00000000..6851b7f2
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f382ccade80ef23478e1bfc2033b3558
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc
new file mode 100644
index 00000000..7f65d729
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc
@@ -0,0 +1,40 @@
+#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));
+ albedo.rgb *= lerp(1, smoothstep(_AoRampMin, _AoRampMax, furHeightMap), _FurAO * furMask);
+
+ albedo.a *= smoothstep(1.01, _FurTipAlpha, remapClamped(poiMesh.furAlpha, _FurFadeStart, 1, 0, 1)) + _AlphaMod;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc.meta
new file mode 100644
index 00000000..8fd18928
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 97ee25df78398024f8529628e7b83f9d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc
new file mode 100644
index 00000000..d7600752
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc
@@ -0,0 +1,200 @@
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+#include "UnityPBSLighting.cginc"
+#include "AutoLight.cginc"
+
+struct appdata
+{
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float2 uv0: TEXCOORD0;
+ uint id: SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+};
+
+struct v2g
+{
+ float4 pos: SV_POSITION;
+ float2 uv0: TEXCOORD0;
+ float3 normal: TEXCOORD4;
+ float3 tangent: TEXCOORD5;
+ uint vid: TEXCOORD6;
+ float3 worldPos: TEXCOORD7;
+ float3 binormal: TEXCOORD8;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+};
+
+struct g2f
+{
+ float4 pos: SV_POSITION;
+ float4 uv: TEXCOORD0;
+ float3 worldPos: TEXCOORD1;
+ float3 normal: TEXCOORD4;
+ float3 tangent: TEXCOORD5;
+ float startToEndGradient: TEXCOORD6;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+};
+
+float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign)
+{
+ return cross(normal, tangent.xyz) *
+ (binormalSign * unity_WorldTransformParams.w);
+}
+
+v2g furVert(appdata v)
+{
+ v2g o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex);
+ o.pos = UnityObjectToClipPos(v.vertex);
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent.xyz);
+ o.binormal = CreateBinormal(o.normal, o.tangent, v.tangent.w);
+ o.uv0 = v.uv0.xy;
+ o.vid = v.id;
+ return o;
+}
+
+float random(float2 vids)
+{
+ return frac(sin(dot(vids, float2(12.9898, 78.2383))) * 43758.5453123);
+}
+
+sampler2D _FurCombMap; float4 _FurCombMap_ST;
+float _FurWidth;
+float _FurCardLength;
+float _FurRaised;
+
+#include "PoiMath.cginc"
+
+[maxvertexcount(6)]
+void furGeom(triangle v2g IN[3], inout TriangleStream < g2f > tristream)
+{
+ float randomValueA = random(float2(IN[0].vid + IN[2].vid, IN[2].vid + IN[0].vid));
+ float randomValueB = random(float2(IN[1].vid + IN[2].vid, IN[1].vid + IN[0].vid));
+ float randomValueC = random(float2(IN[2].vid + IN[2].vid, IN[0].vid + IN[0].vid));
+
+ float3 polySideA = IN[1].worldPos.xyz - IN[0].worldPos.xyz;
+ float3 polySideB = IN[2].worldPos.xyz - IN[0].worldPos.xyz;
+ float3 c = cross(polySideA, polySideB);
+ float3 outDir = normalize(c);
+ float3 furRootPos = float4(IN[0].worldPos.xyz + (polySideA * randomValueA) + (polySideB * randomValueB), 1);
+
+ float3 rootTangent = normalize((IN[0].tangent + IN[1].tangent + IN[2].tangent) * .3333333);
+ float3 rootNormal = normalize((IN[0].normal + IN[1].normal + IN[2].normal) * .3333333);
+ float3 rootBinormal = normalize((IN[0].binormal + IN[1].binormal + IN[2].binormal) * .3333333);
+ float3 furRight = normalize(cross(IN[0].binormal, outDir));
+ float2 rootUV = (IN[0].uv0 + IN[1].uv0 + IN[2].uv0) * .333333;
+ half3 tangentSpaceNormal = UnpackNormal(tex2Dlod(_FurCombMap, float4(TRANSFORM_TEX(rootUV, _FurCombMap), 0, 0)));
+ float3 furForward = normalize(
+ tangentSpaceNormal.x * rootTangent +
+ tangentSpaceNormal.y * rootBinormal +
+ tangentSpaceNormal.z * rootNormal
+ );
+
+ furForward = (lerp(furForward, outDir, _FurRaised));
+ //furForward = rotate_with_quaternion(furForward, float3(_FurRaised,0,0));
+
+ g2f o;
+ float4 worldPos[4];
+ float4 pos[4];
+ float4 uv[4];
+ uv[0] = float4(0, 0, rootUV);
+ uv[1] = float4(0, 1, rootUV);
+ uv[2] = float4(1, 1, rootUV);
+ uv[3] = float4(1, 0, rootUV);
+
+ _FurWidth *= .01;
+ _FurCardLength *= .01;
+
+ worldPos[3] = mul(unity_WorldToObject, float4(furRootPos + (furRight * _FurWidth) + (furForward * _FurCardLength), 1));
+ worldPos[2] = mul(unity_WorldToObject, float4(furRootPos + (furRight * _FurWidth), 1));
+ worldPos[1] = mul(unity_WorldToObject, float4(furRootPos + (-furRight * _FurWidth), 1));
+ worldPos[0] = mul(unity_WorldToObject, float4(furRootPos + (-furRight * _FurWidth) + (furForward * _FurCardLength), 1));
+
+ pos[3] = UnityObjectToClipPos(worldPos[3]);
+ pos[2] = UnityObjectToClipPos(worldPos[2]);
+ pos[1] = UnityObjectToClipPos(worldPos[1]);
+ pos[0] = UnityObjectToClipPos(worldPos[0]);
+
+ o.normal = rootNormal;
+ o.tangent = furForward;
+ o.worldPos = worldPos[0];
+ o.pos = pos[0];
+ o.uv = uv[0];
+ o.startToEndGradient = 1;
+ tristream.Append(o);
+ o.worldPos = worldPos[1];
+ o.pos = pos[1];
+ o.uv = uv[1];
+ o.startToEndGradient = 0;
+ tristream.Append(o);
+ o.worldPos = worldPos[2];
+ o.pos = pos[2];
+ o.uv = uv[2];
+ o.startToEndGradient = 0;
+ tristream.Append(o);
+
+ tristream.RestartStrip();
+ o.worldPos = worldPos[2];
+ o.pos = pos[2];
+ o.uv = uv[2];
+ o.startToEndGradient = 0;
+ tristream.Append(o);
+ o.worldPos = worldPos[3];
+ o.pos = pos[3];
+ o.uv = uv[3];
+ o.startToEndGradient = 1;
+ tristream.Append(o);
+ o.worldPos = worldPos[0];
+ o.pos = pos[0];
+ o.uv = uv[0];
+ o.startToEndGradient = 1;
+ tristream.Append(o);
+
+ tristream.RestartStrip();
+}
+
+sampler2D _FurCardTexture; float4 _FurCardTexture_ST; float4 _FurCardTexture_TexelSize;
+sampler2D _FurCardAlphaTexture; float4 _FurCardAlphaTexture_ST; float4 _FurCardAlphaTexture_TexelSize;
+sampler2D _FurPattern; float4 _FurPattern_ST;
+float _FurClip;
+fixed _FurAoStrength;
+float CalcMipLevel(float2 uv)
+{
+ float2 dx = ddx(uv * _FurCardTexture_TexelSize.zw);
+ float2 dy = ddy(uv * _FurCardTexture_TexelSize.zw);
+ float delta_max_sqr = max(dot(dx, dx), dot(dy, dy));
+
+ return max(0.0, 0.5 * log2(delta_max_sqr));
+}
+
+#include "CGI_FurLighting.cginc"
+
+void ApplyAlphaToCoverage(inout float4 finalColor, float2 uv)
+{
+ // rescale alpha by mip level (if not using preserved coverage mip maps)
+ finalColor.a *= 1 + max(0, CalcMipLevel(uv)) * .25;
+ // rescale alpha by partial derivative
+ finalColor.a = (finalColor.a - _FurClip) / fwidth(finalColor.a) + 0.5;
+}
+
+fixed4 FurFag(g2f i): SV_Target
+{
+ float3 viewDir = normalize(_WorldSpaceCameraPos - i.worldPos);
+
+ UNITY_SETUP_INSTANCE_ID(i);
+ float4 finalColor = 1;
+ finalColor.rgb = tex2D(_FurPattern, TRANSFORM_TEX(i.uv.zw, _FurPattern)).rgb;
+ finalColor.rgb *= tex2D(_FurCardTexture, TRANSFORM_TEX(i.uv.xy, _FurCardTexture)).rgb;
+ finalColor.a = tex2D(_FurCardAlphaTexture, TRANSFORM_TEX(i.uv.xy, _FurCardAlphaTexture)).r;
+ ApplyAlphaToCoverage(finalColor, i.uv.xy);
+ applyFurLighting(finalColor, i.uv, 1 /*attenuation*/, i.normal, viewDir, i.worldPos);
+ finalColor.rgb *= lerp(1, i.startToEndGradient, _FurAoStrength);
+ return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc.meta
new file mode 100644
index 00000000..8e74c656
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFurCardPass.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7f984191e3c28b34c8331de0fa2698fc
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc
new file mode 100644
index 00000000..a1d2e5d5
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc
@@ -0,0 +1,10 @@
+[maxvertexcount(3)]
+void geom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+{
+ for (int i = 0; i < 3; i ++)
+ {
+ IN[i].uv = uv;
+ tristream.Append(IN[i]);
+ }
+ tristream.RestartStrip();
+} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc.meta
new file mode 100644
index 00000000..696fb314
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeom.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8448c818130ccad43935a0a3d6186fdb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc
new file mode 100644
index 00000000..30e9fe8f
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc
@@ -0,0 +1,37 @@
+float _FurLength;
+float _FurGravityStrength;
+
+[instance(4)]
+[maxvertexcount(16)]
+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) *_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+1) / (Total_FurLayers+1);
+ 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();
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc.meta
new file mode 100644
index 00000000..579f213c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGeomFur.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7fae1ecaf77bab941a2b3fd30d68e1cd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc
new file mode 100644
index 00000000..b6d72b0c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc
@@ -0,0 +1,229 @@
+#ifndef POI_GLITTER
+ #define POI_GLITTER
+
+ half3 _GlitterColor;
+ POI_TEXTURE_NOSAMPLER(_GlitterMask);
+ float2 _GlitterPan;
+ POI_TEXTURE_NOSAMPLER(_GlitterColorMap);
+ 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;
+ uint _GlitterBlendType;
+
+ 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 + _GlitterSpeed;
+ 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(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ float3 hsv = float3(hue, saturation, value);
+ return HSVtoRGB(hsv);
+ }
+
+ void applyGlitter(inout float3 finalEmission, inout float4 finalColor)
+ {
+
+
+ // Scale
+ float2 st = poiMesh.uv[0] * _GlitterFrequency;
+
+ // 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;
+ 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(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ // 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. - step(_GlitterSize, m_dist));
+ float3 randomRotation = 0;
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+ float3 norm = poiMesh.normals[0];
+
+ float3 glitterReflectionDirection = normalize(lerp(-poiCam.viewDir, mul(poiRotationMatrixFromAngles(randomRotation), norm), glitterAlpha));
+ float3 finalGlitter = lerp(0, _GlitterMinBrightness, glitterAlpha) + max(pow(dot(lerp(glitterReflectionDirection, poiCam.viewDir, _GlitterBias), poiCam.viewDir), _GlitterContrast) * _GlitterBrightness, 0);
+ _GlitterColor *= lerp(1, finalColor, _GlitterUseSurfaceColor);
+ _GlitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiMesh.uv[_GlitterColorMapUV], _GlitterColorMapPan);
+
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiMesh.uv[_GlitterMaskUV], _GlitterMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ _GlitterColor *= glitterMask;
+
+ if(_GlitterRandomColors)
+ {
+ _GlitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if(_GlitterBlendType == 0)
+ {
+ finalEmission += finalGlitter * _GlitterColor;
+ }
+ else
+ {
+ finalColor.rgb = lerp(finalColor.rgb, finalGlitter * _GlitterColor, finalGlitter);
+ }
+ // Draw grid
+ //color.r += step(.98, f_st.x) + step(.98, f_st.y);
+ }
+
+#endif
+
+
+/*
+float2 F = inoise(poiMesh.uv[0] * _GlitterFrequency, _GlitterJitter) * .7;
+float HeightMap = (F.y - F.x) * _GlitterSpeed;
+float3 normal = UnityObjectToWorldNormal(float3(0, 0, 1));
+normal = HeightToNormal(HeightMap, normal, poiMesh.worldPos);
+normal = WorldToTangentNormalfloattor(normal);
+
+//Unity_NormalFromHeight_World((HeightMap), test);
+//poiMathMagic((F.y - F.x), test);
+//test = (UnpackScaleNormal(float4(test, 1),40));
+
+test = normalize(
+ test.x * poiMesh.tangent +
+ test.y * poiMesh.binormal +
+ test.z * poiMesh.normals[0]
+);
+
+//finalColor.rgb = dot(test, -poiCam.viewDir) * _GlitterBrightness;
+finalColor.rgb = normal;
+*/
+/*
+half circleGradient;
+half3 circleColor;
+inoise(poiMesh.uv[0] * _GlitterFrequency, circleGradient, circleColor);
+half circle = 1 - pow(max(0.0, abs(circleGradient) * _GlitterSpeed - 1), 2);
+float2 P = poiMesh.uv[0] * _GlitterFrequency;
+float2 Pi = mod(floor(P), 289.0);
+float2 Pf = ceil(P) * .03;
+finalColor.rgb = circle * circleColor;
+
+void inoise(float2 P, out half cirlceGradient, out half3 circleColor)
+{
+ float2 Pi = mod(floor(P), 289.0);
+ float2 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 p, ox, oy, dx, dy;
+ float2 F = 1e6;
+
+ for (int i = 0; i < 3; i ++)
+ {
+ p = Permutation(px[i] + Pi.y + oi); // pi1, pi2, pi3
+ ox = frac(p * K) - Ko;
+ oy = mod(floor(p * K), 7.0) * K - Ko;
+ dx = Pf.x - of[i] + _GlitterJitter * ox;
+ dy = Pf.y - of + _GlitterJitter * oy;
+
+ float3 d = dx * dx + dy * dy; // di1, di2 and di3, squared
+
+ //find the 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];
+ }
+ else if(d[n] < F[1])
+ {
+ F[1] = d[n];
+ }
+ }
+ }
+ circleColor = randomFloat3(Pi, 1);
+ cirlceGradient = F.x;
+}
+*/ \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc.meta
new file mode 100644
index 00000000..23d08684
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGlitter.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 5aab04a3fc6c0c147acc353ec6dd6130
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc
new file mode 100644
index 00000000..5e2c0fb2
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc
@@ -0,0 +1,109 @@
+#ifndef POI_GRAB
+ #define POI_GRAB
+
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ float _RefractionEnabled;
+ uint _SourceBlend, _DestinationBlend;
+ float _GrabBlurDistance;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RefractionOpacityMask); float4 _RefractionOpacityMask_ST;
+
+ 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));
+ //return tex2D(_PoiGrab, (projgrabPos + cameraRefraction));
+ UNITY_BRANCH
+ 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;
+ refractionColor = tex2D(_PoiGrab, (refractedGrab));
+ #ifdef CHROMATIC_ABERRATION_LOW
+ float3 offset = float3(0.0, .05, .12);
+ float3 weight = float3(0.2270270270, 0.3162162162, 0.0702702703) * .5;
+ refractionColor *= weight[0];
+
+
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+
+ #endif
+ }
+ return refractionColor;
+ }
+
+ void calculateRefraction(float2 projectedGrabPos, inout float4 finalColor)
+ {
+ float3 refraction = 1;
+ UNITY_BRANCH
+ if(_RefractionEnabled == 1)
+ {
+ refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos).rgb;
+ }
+ else
+ {
+ refraction = tex2Dproj(_PoiGrab, poiCam.grabPos);
+
+ #ifdef CHROMATIC_ABERRATION_LOW
+ float3 offset = float3(0.0, .05, .12);
+ float3 weight = float3(0.2270270270, 0.3162162162, 0.0702702703) * .5;
+ refraction *= weight[0];
+
+
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+
+ #endif
+ }
+
+ finalColor.a *= alphaMask;
+ finalColor = poiBlend(_SourceBlend, finalColor, _DestinationBlend, float4(refraction, 1));
+ finalColor.a = 1;
+ }
+
+ 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc.meta
new file mode 100644
index 00000000..56059849
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiGrab.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 805b20bfecdd38d42b11d4234fe29dd5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc
new file mode 100644
index 00000000..179a2a46
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc
@@ -0,0 +1,294 @@
+#ifndef POI_HELPER
+ #define POI_HELPER
+
+ #include "CGI_PoiColors.cginc"
+
+ #ifndef pi
+ #define pi float(3.14159265359)
+ #endif
+
+ 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
+ UNITY_BRANCH
+ 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));
+}
+
+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);
+} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc.meta
new file mode 100644
index 00000000..bd35b08d
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHelpers.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e21350293a29ca54eafcd03b2fc25bb4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc
new file mode 100644
index 00000000..c54f70d4
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc
@@ -0,0 +1,36 @@
+#ifndef POI_HOLOGRAM
+ #define POI_HOLOGRAM
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_HoloAlphaMap); float4 _HoloAlphaMap_ST;
+ uint _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;
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 0)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.worldPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if(_HoloCoordinateSpace == 1)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.localPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc.meta
new file mode 100644
index 00000000..ecb568d1
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiHologram.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ace38b63cbeedcf478b5e4ef59929a53
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc
new file mode 100644
index 00000000..47d5624f
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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;
+ uint _IridescenceNormalUV;
+ uint _IridescenceMaskUV;
+ uint _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
+ );
+ }
+
+ float3 applyIridescence(inout float4 albedo)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+
+ // Use custom normal map
+ UNITY_BRANCH
+ 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));
+
+ return saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * _IridescenceEmissionStrength;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc.meta
new file mode 100644
index 00000000..d3adc2f9
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiIridescence.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0b6492eb757fd864da77959d6807565e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc
new file mode 100644
index 00000000..37feb5cc
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc
@@ -0,0 +1,409 @@
+
+#ifndef POI_LIGHTING
+ #define POI_LIGHTING
+
+ int _LightingType;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _LightingIndirectContribution;
+ float _AttenuationMultiplier;
+ float _EnableLighting;
+ float _LightingControlledUseLightColor;
+ fixed _LightingStandardSmoothness;
+ fixed _LightingStandardControlsToon;
+ fixed _LightingMinLightBrightness;
+ float _LightingUseShadowRamp;
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ fixed _LightingMonochromatic;
+
+ uint _LightingNumRamps;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp1);
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp2);
+ half _LightingShadowStrength1;
+ half _LightingShadowStrength2;
+ half _ShadowOffset1;
+ half _ShadowOffset2;
+
+ fixed _LightingGradientStart;
+ fixed _LightingGradientEnd;
+ float3 _LightingStartColor;
+ float3 _LightingEndColor;
+ float _AOStrength;
+ fixed _LightingDetailStrength;
+ fixed _LightingAdditiveDetailStrength;
+ fixed _LightingNoIndirectMultiplier;
+ fixed _LightingNoIndirectThreshold;
+
+ uint _LightingAdditiveType;
+ fixed _LightingAdditiveGradientStart;
+ fixed _LightingAdditiveGradientEnd;
+ fixed _LightingAdditivePassthrough;
+ /*
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp3);
+ half _LightingShadowStrength3;
+ half _ShadowOffset3;
+ */
+
+ POI_TEXTURE_NOSAMPLER(_LightingDetailShadows);
+ POI_TEXTURE_NOSAMPLER(_LightingAOTex);
+ POI_TEXTURE_NOSAMPLER(_LightingShadowMask);
+
+ /*
+ * Standard stuff Start
+ */
+ UnityLight CreateLight(float3 normal)
+ {
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+ 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, _AttenuationMultiplier);
+ #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, _AttenuationMultiplier));
+
+ 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
+ }
+
+ 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 - _LightingStandardSmoothness;
+ 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;
+ UNITY_BRANCH
+ 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 = lerp(1, POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan), _AOStrength);
+
+ indirectLight.diffuse *= occlusion;
+ indirectLight.diffuse = max(indirectLight.diffuse, _LightingMinLightBrightness);
+ indirectLight.specular *= occlusion;
+ #endif
+
+ return indirectLight;
+ }
+
+ /*
+ * Standard stuff End
+ */
+
+ 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)
+ {
+ return UNITY_BRDF_PBS(1, 0, 0, _LightingStandardSmoothness,
+ poiMesh.normals[1], poiCam.viewDir, CreateLight(poiMesh.normals[1]), CreateIndirectLight(poiMesh.normals[1]));
+ }
+
+ void calculateBasePassLighting()
+ {
+ #ifdef SIMPLE
+ _LightingType = 1;
+ _LightingIndirectContribution = 0.2;
+ #endif
+ float AOMap = 1;
+ float3 lightColor = poiLight.color;
+ #ifndef OUTLINE
+ AOMap = POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan);
+
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ lightColor = saturate(magic * lerp(1, AOMap, _AOStrength) + normalLight);
+ #endif
+ #endif
+
+ float3 grayscale_vector = float3(.33333, .33333, .33333);
+ float3 ShadeSH9Plus = GetSHLength();
+ float3 ShadeSH9Minus = ShadeSH9(float4(0, 0, 0, 1));
+ poiLight.directLighting = saturate(lerp(ShadeSH9Plus, lightColor, 1 - _LightingIndirectContribution));
+ poiLight.indirectLighting = saturate(ShadeSH9Minus);
+
+ float3 directLighting = lerp(poiLight.directLighting, dot(poiLight.directLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ float3 indirectLighting = lerp(poiLight.indirectLighting, dot(poiLight.indirectLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+
+ if (max(max(indirectLighting.x, indirectLighting.y), indirectLighting.z) <= _LightingNoIndirectThreshold && max(max(directLighting.x, directLighting.y), directLighting.z) >= 0)
+ {
+ indirectLighting = directLighting * _LightingNoIndirectMultiplier;
+ }
+
+ half4 shadowStrength = 1;
+ #ifndef OUTLINE
+ #ifndef SIMPLE
+ shadowStrength = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[_LightingShadowMaskUV], _LightingShadowMaskPan);
+ #endif
+ shadowStrength *= half4(_ShadowStrength, _LightingShadowStrength1, _LightingShadowStrength2, 0);
+ #else
+ shadowStrength = _OutlineShadowStrength;
+ #endif
+
+ float bw_lightColor = dot(lightColor, grayscale_vector);
+ float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, _AttenuationMultiplier)) + 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 = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingDetailStrength).r;
+ poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting);
+ poiLight.lightMap *= detailShadow;
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset), shadowStrength.r);
+
+ UNITY_BRANCH
+ if(_LightingNumRamps >= 2)
+ {
+ poiLight.rampedLightMap *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp1, _ToonRamp, poiLight.lightMap + _ShadowOffset1), shadowStrength.g);
+ }
+ UNITY_BRANCH
+ if(_LightingNumRamps >= 3)
+ {
+ poiLight.rampedLightMap *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp2, _ToonRamp, poiLight.lightMap + _ShadowOffset2), shadowStrength.b);
+ }
+
+ UNITY_BRANCH
+ if(_LightingStandardControlsToon)
+ {
+ float3 realisticLighting = calculateRealisticLighting(1);
+ poiLight.rampedLightMap = UNITY_SAMPLE_TEX2D(_ToonRamp, (.5 + dot(realisticLighting, float3(.33333, .33333, .33333)) * .5) + _ShadowOffset);
+ return;
+ }
+
+ UNITY_BRANCH
+ if(_LightingType == 0)
+ {
+ poiLight.finalLighting = lerp(indirectLighting * lerp(1, AOMap, _AOStrength), directLighting, poiLight.rampedLightMap);
+ }
+ UNITY_BRANCH
+ if(_LightingType == 1)
+ {
+ poiLight.finalLighting = lerp(poiLight.rampedLightMap * directLighting * lerp(1, AOMap, _AOStrength), directLighting, poiLight.rampedLightMap);
+ }
+ UNITY_BRANCH
+ if(_LightingType == 3)
+ {
+ poiLight.finalLighting = lerp(saturate(directLighting * _LightingStartColor), saturate(indirectLighting * _LightingEndColor * lerp(1, AOMap, _AOStrength)), smoothstep(_LightingGradientStart, _LightingGradientEnd, 1 - poiLight.lightMap));
+ }
+ }
+
+ float3 calculateNonImportantLighting(float attenuation, float attenuationDotNL, float3 albedo, float3 lightColor, half dotNL)
+ {
+ UNITY_BRANCH
+ if(_LightingAdditiveType == 0)
+ {
+ return lightColor * attenuationDotNL;
+ }
+ else
+ {
+ fixed detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ return lerp(lightColor * attenuation, lightColor * _LightingAdditivePassthrough * attenuation, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, dotNL)) * detailShadow;
+ }
+ }
+
+ float3 calculateLighting(float3 albedo)
+ {
+ #ifdef SIMPLE
+ _LightingType = 1;
+ #endif
+ #ifdef FORWARD_BASE_PASS
+ calculateBasePassLighting();
+
+ #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
+ #else
+ #if defined(POINT) || defined(SPOT)
+ #ifndef SIMPLE
+ fixed detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ UNITY_BRANCH
+ if(_LightingAdditiveType == 0)
+ {
+ return poiLight.color * poiLight.attenuation * max(0, poiLight.nDotL) * detailShadow;
+ }
+ else
+ {
+ return lerp(poiLight.color * max(poiLight.additiveShadow, _LightingAdditivePassthrough), poiLight.color * _LightingAdditivePassthrough, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * detailShadow;
+ }
+ #else
+ poiLight.finalLighting = poiLight.color * poiLight.attenuation;
+ #endif
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if(_LightingType == 2)
+ {
+ float3 realisticLighting = calculateRealisticLighting(finalColor).rgb;
+ return lerp(realisticLighting, dot(realisticLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ }
+ else
+ {
+ return max(poiLight.finalLighting, _LightingMinLightBrightness);
+ }
+ #else
+ return max(poiLight.finalLighting, _LightingMinLightBrightness);
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc.meta
new file mode 100644
index 00000000..0cced9ff
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0e36c7fcdc698ed4daa0a2d53af5cf77
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc
new file mode 100644
index 00000000..1644edee
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc
@@ -0,0 +1,235 @@
+#ifndef POI_MSDF
+ #define POI_MSDF
+
+ sampler2D _TextGlyphs; float4 _TextGlyphs_ST; float4 _TextGlyphs_TexelSize;
+ uint _TextFPSUV, _TextTimeUV, _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled, _TextPositionEnabled, _TextTimeEnabled;
+
+
+ float4 _TextFPSColor;
+ half _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ half2 _TextFPSOffset, _TextFPSScale;
+ half _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ half _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ half2 _TextPositionOffset, _TextPositionScale;
+ half _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ half _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ half2 _TextTimeOffset, _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(_TextPositionOffset, _TextPositionRotation, _TextPositionScale, 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);
+
+ _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 = _TextPixelRange / _TextGlyphs_TexelSize.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, _TextPositionColor.rgb, opacity * _TextPositionColor.a);
+ globalTextEmission += _TextPositionColor.rgb * opacity * _TextPositionEmissionStrength;
+ }
+
+ 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(_TextTimeOffset, _TextTimeRotation, _TextTimeScale, 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);
+ _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 = _TextPixelRange / _TextGlyphs_TexelSize.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, _TextTimeColor.rgb, opacity * _TextTimeColor.a);
+ globalTextEmission += _TextTimeColor.rgb * opacity * _TextTimeEmissionStrength;
+ }
+
+ 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(_TextFPSOffset, _TextFPSRotation, _TextFPSScale, 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);
+ _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 = _TextPixelRange / _TextGlyphs_TexelSize.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, _TextFPSColor.rgb, opacity * _TextFPSColor.a);
+ globalTextEmission += _TextFPSColor.rgb * opacity * _TextFPSEmissionStrength;
+ }
+
+ void ApplyTextOverlayColor(inout float4 albedo)
+ {
+ globalTextEmission = 0;
+ half positionalOpacity = 0;
+ #ifdef EFFECT_BUMP
+ UNITY_BRANCH
+ if(_TextFPSEnabled)
+ {
+ ApplyFPSText(albedo, poiMesh.uv[_TextFPSUV]);
+ }
+ UNITY_BRANCH
+ if(_TextPositionEnabled)
+ {
+ ApplyPositionText(albedo, poiMesh.uv[_TextPositionUV]);
+ }
+ UNITY_BRANCH
+ if(_TextTimeEnabled)
+ {
+ ApplyTimeText(albedo, poiMesh.uv[_TextTimeUV]);
+ }
+ #endif
+ }
+
+ void ApplyTextOverlayEmission(inout float3 emission)
+ {
+ emission += globalTextEmission;
+ }
+
+
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc.meta
new file mode 100644
index 00000000..8a60811f
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMSDF.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 05c0700729e307d498fe48162f958f41
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc
new file mode 100644
index 00000000..50a621fd
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc
@@ -0,0 +1,29 @@
+#ifndef POI_MACROS
+ #define POI_MACROS
+
+ #define POI_TEXTURE_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV
+
+ #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)))
+
+ #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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc.meta
new file mode 100644
index 00000000..a14f6c3e
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMacros.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 615413f5f663d074297d4b5630dbefd0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc
new file mode 100644
index 00000000..3e0f0a75
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc
@@ -0,0 +1,159 @@
+#ifndef POI_MAINTEXTURE
+ #define POI_MAINTEXTURE
+
+ float2 _MainTexPan;
+ uint _MainTextureUV;
+ POI_TEXTURE_NOSAMPLER(_BumpMap);
+ POI_TEXTURE_NOSAMPLER(_AlphaMask);
+ POI_TEXTURE_NOSAMPLER(_DetailMask);
+ POI_TEXTURE_NOSAMPLER(_DetailNormalMap);
+ POI_TEXTURE_NOSAMPLER(_DetailTex);
+ POI_TEXTURE_NOSAMPLER(_MainFadeTexture);
+ POI_TEXTURE_NOSAMPLER(_MainHueShiftMask);
+ float4 _Color;
+ float _MainVertexColoring;
+ float _Saturation;
+ float _BumpScale;
+ float _DetailNormalMapScale;
+ float2 _MainDistanceFade;
+ half _MainMinAlpha;
+ half _DetailTexIntensity;
+ half3 _DetailTint;
+ float _DetailBrightness;
+ float _MainHueShiftToggle;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _MainHueShiftReplace;
+ //globals
+ float alphaMask;
+ half3 diffColor;
+
+ #include "CGI_PoiBackFace.cginc"
+
+ float3 wireframeEmission;
+
+ inline FragmentCommonData SpecularSetup(float4 i_tex)
+ {
+ 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)
+ {
+ i_tex = i_tex;
+
+ FragmentCommonData o = SpecularSetup(i_tex);
+ o.normalWorld = float4(0, 0, 0, 1);
+ o.eyeVec = poiCam.viewDir;
+ o.posWorld = i_posWorld;
+
+ // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
+ o.diffColor = PreMultiplyAlpha(o.diffColor, 1, o.oneMinusReflectivity, /*out*/ o.alpha);
+ return o;
+ }
+
+ void initTextureData()
+ {
+ mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+
+ #if (defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #ifdef POI_MIRROR
+ applyMirrorTexture();
+ #endif
+ #endif
+
+
+ #ifndef SIMPLE
+ alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiMesh.uv[_AlphaMaskUV], _AlphaMaskPan);
+ #else
+ alphaMask = 1;
+ #endif
+
+ mainTexture.a *= alphaMask;
+
+ #ifndef POI_SHADOW
+ albedo = float4(lerp(mainTexture.rgb, dot(mainTexture.rgb, float3(0.3, 0.59, 0.11)), -_Saturation) * _Color.rgb * lerp(1, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoring), mainTexture.a * _Color.a);
+
+ #ifdef POI_RGBMASK
+ albedo.rgb = calculateRGBMask(albedo.rgb);
+ #endif
+
+ albedo.a = saturate(_AlphaMod + albedo.a);
+
+ wireframeEmission = 0;
+ #ifdef POI_WIREFRAME
+ applyWireframe(wireframeEmission, albedo);
+ #endif
+
+ applyBackFaceTexture();
+
+ #ifdef POI_FUR
+ calculateFur();
+ #endif
+
+ UNITY_BRANCH
+ if(_MainHueShiftToggle)
+ {
+ float hueShiftAlpha = POI2D_SAMPLER_PAN(_MainHueShiftMask, _MainTex, poiMesh.uv[_MainHueShiftMaskUV], _MainHueShiftMaskPan).r;
+
+ if(_MainHueShiftReplace)
+ {
+ albedo.rgb = lerp(albedo.rgb, hueShift(albedo.rgb, _MainHueShift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha);
+ }
+ else
+ {
+ albedo.rgb = hueShift(albedo.rgb, frac((_MainHueShift - (1 - hueShiftAlpha) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+
+ half3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiMesh.uv[_BumpMapUV], _BumpMapPan), _BumpScale);
+ half3 detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiMesh.uv[_DetailMaskUV], _DetailMaskPan);
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiMesh.uv[_DetailNormalMapUV], _DetailNormalMapPan), _DetailNormalMapScale * detailMask.g);
+ poiMesh.tangentSpaceNormal = poiMesh.tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+
+ //float4 detailTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DetailTex, _MainTex, TRANSFORM_TEX(poiMesh.uv[_DetailTexUV], _DetailTex) + _Time.x * _DetailTexPan);
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiMesh.uv[_DetailTexUV], _DetailTexPan).rgb * _DetailTint.rgb;
+ albedo.rgb *= LerpWhiteTo(detailTexture * _DetailBrightness * unity_ColorSpaceDouble.rgb, detailMask.r * _DetailTexIntensity);
+ albedo.rgb = saturate(albedo.rgb);
+
+ 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]));
+
+ #ifdef POI_HOLOGRAM
+ ApplyHoloAlpha(albedo);
+ #endif
+
+ s = FragmentSetup(float4(poiMesh.uv[0], 1, 1), poiCam.viewDir, poiMesh.worldPos);
+ #endif
+
+ #ifdef DISTORT
+ calculateDissolve();
+ #endif
+ }
+
+ void distanceFade()
+ {
+ half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[_MainFadeTextureUV], _MainFadeTexturePan);
+ if (fadeMap)
+ {
+ half fadeValue = max(smoothstep(_MainDistanceFade.x, _MainDistanceFade.y, poiCam.distanceToVert), _MainMinAlpha);
+ albedo.a *= fadeValue;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc.meta
new file mode 100644
index 00000000..05276c30
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMainTex.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 239f19116716b0d4cb7fffbb0254f209
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc
new file mode 100644
index 00000000..a9c16f1b
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc
@@ -0,0 +1,105 @@
+#ifndef MATCAP
+ #define MATCAP
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap);
+ POI_TEXTURE_NOSAMPLER(_MatcapMask);
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ uint _MatcapNormal;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2);
+ POI_TEXTURE_NOSAMPLER(_Matcap2Mask);
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ uint _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;
+ }
+
+ float3 applyMatcap(inout float4 finalColor)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float3 matcapEmission = 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[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, matcapUV) * _MatcapColor;
+ matcap.rgb *= _MatcapIntensity;
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiMesh.uv[_MatcapMaskUV], _MatcapMaskPan);
+ blendMatcap(finalColor, _MatcapAdd, _MatcapMultiply, _MatcapReplace, matcap, matcapMask, matcapEmission, _MatcapEmissionStrength
+ #ifdef POI_LIGHTING
+ ,_MatcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ ,_BlackLightMaskMatcap
+ #endif
+ );
+
+ // Matcap 2
+ UNITY_BRANCH
+ if (_Matcap2Enable)
+ {
+ half2 matcapUV2 = half2(dot(worldViewRight, poiMesh.normals[_Matcap2Normal]), dot(worldViewUp, poiMesh.normals[_Matcap2Normal])) * _Matcap2Border + 0.5;
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, matcapUV2) * _Matcap2Color;
+ matcap2.rgb *= _Matcap2Intensity;
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiMesh.uv[_Matcap2MaskUV], _Matcap2MaskPan);
+ blendMatcap(finalColor, _Matcap2Add, _Matcap2Multiply, _Matcap2Replace, matcap2, matcap2Mask, matcapEmission, _Matcap2EmissionStrength
+ #ifdef POI_LIGHTING
+ ,_Matcap2LightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ ,_BlackLightMaskMatcap2
+ #endif
+ );
+ }
+
+ return matcapEmission;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc.meta
new file mode 100644
index 00000000..19736053
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMatcap.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 400822fcfc2960f45a004321fa06d679
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc
new file mode 100644
index 00000000..98af2364
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc
@@ -0,0 +1,78 @@
+#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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc.meta
new file mode 100644
index 00000000..1c2a41b8
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMath.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8076e22efb150f448b44b9c66821c39f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc
new file mode 100644
index 00000000..1088cdf4
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc
@@ -0,0 +1,126 @@
+#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 && !_SampleWorld;
+ }
+
+ float3 fresnelRelflection()
+ {
+ 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 ApplyMetallics(inout float4 finalColor)
+ {
+ #ifdef FORWARD_BASE_PASS
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ 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;
+ UNITY_BRANCH
+ 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[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection() * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+
+ void ApplyMetallicsFake(inout float4 finalColor)
+ {
+ #ifdef FORWARD_BASE_PASS
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ 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[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection() * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc.meta
new file mode 100644
index 00000000..0106f996
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMetal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: efbee79deb8603844a85b3268440162a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc
new file mode 100644
index 00000000..4c943baa
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc
@@ -0,0 +1,77 @@
+#ifndef POI_MIRROR
+ #define POI_MIRROR
+
+ int _Mirror;
+ float _EnableMirrorTexture;
+ POI_TEXTURE_NOSAMPLER(_MirrorTexture);
+
+
+ void applyMirrorRenderVert(inout float4 vertex)
+ {
+ UNITY_BRANCH
+ if (_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ void applyMirrorRenderFrag()
+ {
+ UNITY_BRANCH
+ if(_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ void applyMirrorTexture()
+ {
+ UNITY_BRANCH
+ if(_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ mainTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc.meta
new file mode 100644
index 00000000..22d5619b
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiMirror.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b67e74201ee1abc4092033e08aa93e9e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc
new file mode 100644
index 00000000..25d6a507
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc
@@ -0,0 +1,76 @@
+float _OutlineRimLightBlend;
+float _OutlineLit;
+float _OutlineTintMix;
+
+float4 frag(v2f i, uint facing: SV_IsFrontFace): COLOR
+{
+ 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_DATA
+ InitData(i, facing);
+ #endif
+
+ #ifdef POI_MAINTEXTURE
+ initTextureData();
+ #endif
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+ fixed4 col = mainTexture;
+ float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(i.uv0.xy, _OutlineMask) + _Time.x * _OutlineTexturePan.zw).r;
+ clip(OutlineMask * _LineWidth - 0.001);
+
+ float _alphaMask_tex_var = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiMesh.uv[_AlphaMaskUV], _AlphaMaskPan);
+
+ col = col * 0.00000000001 + tex2D(_OutlineTexture, TRANSFORM_TEX((i.uv0.xy + (_OutlineTexturePan.xy * _Time.g)), _OutlineTexture));
+ col.a *= albedo.a;
+ col.a *= alphaMultiplier;
+
+ #ifdef POI_RANDOM
+ col.a *= i.angleAlpha;
+ #endif
+
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ col.a *= _alphaMask_tex_var * _LineColor.a;
+ applyDithering(col);
+ clip(col.a - _Clip);
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ #ifdef POI_MIRROR
+ applyMirrorTexture();
+ #endif
+ col.rgb = mainTexture.rgb;
+ }
+ else if(_OutlineMode == 2)
+ {
+ col.rgb = lerp(col.rgb, poiLight.color, _OutlineRimLightBlend);
+ }
+ col.rgb *= _LineColor.rgb;
+
+ if(_OutlineMode == 1)
+ {
+ col.rgb = lerp(col.rgb, mainTexture.rgb, _OutlineTintMix);
+ }
+
+ float4 finalColor = col;
+
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if(_OutlineLit)
+ {
+ finalColor.rgb *= calculateLighting(finalColor.rgb);
+ }
+ #endif
+ finalColor.rgb += (col.rgb * _OutlineEmission);
+ return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc.meta
new file mode 100644
index 00000000..b0ad7dd8
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3b1d5b8f4ce9942459d2943f23b0ebd5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc
new file mode 100644
index 00000000..dc3fa7ef
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc
@@ -0,0 +1,90 @@
+#ifndef OutlineVert
+ #define OutlineVert
+
+ #include "CGI_PoiV2F.cginc"
+
+ uint _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+ float _OutlineFixedSize;
+
+ sampler2D _OutlineMask; float4 _OutlineMask_ST;
+ 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;
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ o.uv0.xy = v.uv0 + _OutlineGlobalPan.xy * _Time.y;
+ float outlineMask = 1;
+ #ifndef SIMPLE
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(TRANSFORM_TEX(o.uv0.xy, _OutlineMask) + _Time.x * _OutlineTexturePan.zw, 0, 0)).rgb);
+ #endif
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors == 0)
+ {
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ }
+ else
+ {
+ o.normal = UnityObjectToWorldNormal(v.color);
+ }
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ UNITY_BRANCH
+ if(_OutlineFixedSize)
+ {
+ distanceOffset *= distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, v.vertex).xyz);
+ }
+
+ float3 offset = o.normal * (_LineWidth / 100) * outlineMask * distanceOffset;
+
+ UNITY_BRANCH
+ if(_OutlineMode == 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(_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, o.normal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if(_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc.meta
new file mode 100644
index 00000000..2575d8e0
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiOutlineVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9a127201e1056cc47b2653676d4a14ab
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc
new file mode 100644
index 00000000..b0f642a8
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc
@@ -0,0 +1,70 @@
+#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 * _PanospherePan.x, latitude + _Time.y * _PanospherePan.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 calculatePanosphere()
+ {
+ panoMask = POI2D_SAMPLER_PAN(_PanoMask, _MainTex, poiMesh.uv[_PanoMaskUV], _PanoMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskPanosphere != 4)
+ {
+ panoMask *= blackLightMask[_BlackLightMaskPanosphere];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if(_PanoCubeMapToggle)
+ {
+ float3 cubeUV = mul(poiRotationMatrixFromAngles(_PanospherePan.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, _PanoInfiniteStereoToggle) - 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 * _PanosphereColor.rgb;
+ }
+ }
+
+ void applyPanosphereColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, panoColor, _PanoBlend * panoMask);
+ }
+
+ void applyPanosphereEmission(inout float3 finalEmission)
+ {
+ finalEmission += panoColor * _PanoBlend * panoMask * _PanoEmission;
+ }
+
+#endif
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc.meta
new file mode 100644
index 00000000..0d569953
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPanosphere.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 77d5438d9a3794244bd96fe1126e5a2b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc
new file mode 100644
index 00000000..9f7b27d6
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc
@@ -0,0 +1,142 @@
+#ifndef POI_PARALLAX
+ #define POI_PARALLAX
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxHeightMap); float4 _ParallaxHeightMap_ST;
+ POI_TEXTURE_NOSAMPLER(_ParallaxHeightMapMask);
+ float2 _ParallaxHeightMapPan;
+ float _ParallaxStrength;
+ float _ParallaxHeightMapEnabled;
+ uint _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 * _ParallaxHeightMapPan).g, 0, .99999);
+ }
+ /*
+ float2 ParallaxOffset(float2 viewDir)
+ {
+ float height = GetParallaxHeight();
+ height -= 0.5;
+ height *= _ParallaxStrength;
+ return viewDir * height;
+ }
+ */
+ float2 ParallaxRaymarching(float2 viewDir)
+ {
+ float2 uvOffset = 0;
+ float stepSize = 0.1;
+ float2 uvDelta = viewDir * (stepSize * _ParallaxStrength);
+
+ float stepHeight = 1;
+ float surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV]);
+
+
+ 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[_ParallaxUV] + 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[_ParallaxHeightMapMaskUV], _ParallaxHeightMapMaskPan).r;
+ }
+
+ void calculateandApplyParallax()
+ {
+ UNITY_BRANCH
+ if (_ParallaxHeightMapEnabled)
+ {
+ float2 parallaxOffset = ParallaxRaymarching(poiCam.tangentViewDir.xy);
+ UNITY_BRANCH
+ if(_ParallaxUV == 0)
+ {
+ poiMesh.uv[0] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 1)
+ {
+ poiMesh.uv[1] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 2)
+ {
+ poiMesh.uv[2] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 3)
+ {
+ poiMesh.uv[3] += parallaxOffset;
+ }
+ }
+ }
+
+ void calculateAndApplyInternalParallax(inout float4 finalColor)
+ {
+ #if defined(_PARALLAXMAP)
+ UNITY_BRANCH
+ if(_ParallaxInternalMapEnabled)
+ {
+ float3 parallax = 0;
+ for (int j = _ParallaxInternalIterations; j > 0; j --)
+ {
+ float ratio = (float)j / _ParallaxInternalIterations;
+ float2 parallaxOffset = _Time.y * (_ParallaxInternalPanSpeed + (1 - ratio) * _ParallaxInternalPanDepthSpeed);
+ float fade = lerp(_ParallaxInternalMinFade, _ParallaxInternalMaxFade, ratio);
+ float4 parallaxColor = UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxInternalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _ParallaxInternalMap) + lerp(_ParallaxInternalMinDepth, _ParallaxInternalMaxDepth, ratio) * - poiCam.tangentViewDir.xy + parallaxOffset);
+ float3 parallaxTint = lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, ratio);
+ float parallaxHeight;
+ if(_ParallaxInternalHeightFromAlpha)
+ {
+ parallaxTint *= parallaxColor.rgb;
+ parallaxHeight = parallaxColor.a;
+ }
+ else
+ {
+ parallaxHeight = parallaxColor.r;
+ }
+ //float parallaxColor *= lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, 1 - ratio);
+ UNITY_BRANCH
+ if (_ParallaxInternalHeightmapMode == 1)
+ {
+ parallax = lerp(parallax, parallaxTint * fade, parallaxHeight >= 1 - ratio);
+ }
+ else
+ {
+ parallax += parallaxTint * parallaxHeight * fade;
+ }
+ }
+ //parallax /= _ParallaxInternalIterations;
+ finalColor.rgb += parallax * POI2D_SAMPLER_PAN(_ParallaxInternalMapMask, _MainTex, poiMesh.uv[_ParallaxInternalMapMaskUV], _ParallaxInternalMapMaskPan).r;
+ }
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc.meta
new file mode 100644
index 00000000..e8b7edba
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiParallax.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 97bde44d013cc0e49869a7e8917bcf86
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc
new file mode 100644
index 00000000..91c11e47
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc
@@ -0,0 +1,263 @@
+/*
+USED---------------------------------------------
+"_PARALLAXMAP",
+"_REQUIRE_UV2",
+"_SUNDISK_NONE",
+"_DETAIL_MULX2",
+"LOD_FADE_CROSSFADE",
+"_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",
+"FXAA",
+"BLOOM_LENS_DIRT",
+"_FADING_ON",
+"CHROMATIC_ABERRATION",
+"DISTORT",
+"GEOM_TYPE_BRANCH",
+"_SPECULARHIGHLIGHTS_OFF",
+
+UNUSED-------------------------------------------
+"_ALPHAPREMULTIPLY_ON",
+"_ALPHATEST_ON",
+"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A",
+"BILLBOARD_FACE_CAMERA_POS",
+"EFFECT_HUE_VARIATION",
+"ETC1_EXTERNAL_ALPHA",
+"GEOM_TYPE_FROND",
+"GEOM_TYPE_LEAF",
+"GEOM_TYPE_MESH",
+"LOD_FADE_CROSSFADE",
+"PIXELSNAP_ON",
+"STEREO_INSTANCING_ON",
+"STEREO_MULTIVIEW_ON",
+"UNITY_HDR_ON",
+"UNITY_SINGLE_PASS_STEREO",
+"UNITY_UI_ALPHACLIP",
+"UNITY_UI_CLIP_RECT",
+// Post Processing Stack V1 and V2
+// This is mostly just safe keeping somewhere
+"FOG_OFF",
+"FOG_LINEAR",
+"FOG_EXP",
+"FOG_EXP2",
+"ANTI_FLICKER",
+"UNITY_COLORSPACE_GAMMA",
+"SOURCE_GBUFFER",
+"AUTO_KEY_VALUE",
+"DITHERING",
+"TONEMAPPING_NEUTRAL",
+"TONEMAPPING_FILMIC",
+"DEPTH_OF_FIELD_COC_VIEW",
+"COLOR_GRADING",
+"COLOR_GRADING_LOG_VIEW",
+"VIGNETTE_CLASSIC",
+"VIGNETTE_MASKED",
+"",
+"FXAA_LOW",
+"FXAA_KEEP_ALPHA",
+"STEREO_INSTANCING_ENABLED",
+"STEREO_DOUBLEWIDE_TARGET",
+"TONEMAPPING_ACES",
+"TONEMAPPING_CUSTOM",
+"APPLY_FORWARD_FOG",
+"VIGNETTE",
+"FINALPASS",
+"COLOR_GRADING_HDR_3D",
+"COLOR_GRADING_HDR",
+"AUTO_EXPOSURE"
+
+DO NOT USE-------------------------------
+DISTORT,
+TODO: _ALPHAMODULATE_ON
+*/
+
+
+#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
+
+ #ifdef CUTOUT
+ #include "CGI_PoiDithering.cginc"
+ #endif
+
+ #ifdef _PARALLAXMAP
+ #include "CGI_PoiParallax.cginc"
+ #endif
+
+ #ifdef USER_LUT
+ #include "CGI_PoiUVDistortion.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 FXAA
+ #include "CGI_PoiRGBMask.cginc"
+ #endif
+
+ #ifdef BLOOM_LENS_DIRT
+ #include "CGI_PoiIridescence.cginc"
+ #endif
+
+
+ #ifdef FUR
+ #include "CGI_PoiFur.cginc"
+ #include "CGI_PoiGeomFur.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 LOD_FADE_CROSSFADE
+ #include "CGI_PoiLighting.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
+
+ #ifdef POI_GRABS_ASS
+ #include "CGI_PoiBlending.cginc"
+ #include "CGI_PoiGrab.cginc"
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ #include "CGI_PoiGlitter.cginc"
+ #endif
+
+ #ifdef _EMISSION
+ #include "CGI_PoiEmission.cginc"
+ #endif
+
+ #ifdef _COLORCOLOR_ON
+ #include "CGI_PoiClearCoat.cginc"
+ #endif
+
+ #ifdef CUTOUT
+ #include "CGI_PoiAlphaToCoverage.cginc"
+ #endif
+
+ #ifdef _COLOROVERLAY_ON
+ #include "CGI_PoiDebug.cginc"
+ #endif
+ #include "CGI_PoiFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc.meta
new file mode 100644
index 00000000..cfac868b
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPass.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e1c44eaed2ce4174981f26daf9468e39
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc
new file mode 100644
index 00000000..75b68112
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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_PoiMainTex.cginc"
+ #include "CGI_PoiData.cginc"
+ #include "CGI_PoiDithering.cginc"
+ #include "CGI_PoiLighting.cginc"
+ #include "CGI_PoiOutlineFrag.cginc"
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc.meta
new file mode 100644
index 00000000..bf2f82b4
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassOutline.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ee861e2bca0ed96468676b24154fedcf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc
new file mode 100644
index 00000000..737a2272
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc
@@ -0,0 +1,31 @@
+#ifndef POI_PASS_SHADOW
+ #define POI_PASS_SHADOW
+
+ #pragma multi_compile_shadowcaster
+ #include "UnityCG.cginc"
+ #include "UnityShaderVariables.cginc"
+
+ #include "CGI_PoiMacros.cginc"
+ #include "CGI_PoiShadowIncludes.cginc"
+ #include "CGI_PoiHelpers.cginc"
+ #include "CGI_PoiMirror.cginc"
+ #include "CGI_PoiSpawnInFrag.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"
+ #include "CGI_PoiDissolve.cginc"
+ #include "CGI_PoiVertexManipulations.cginc"
+ #include "CGI_PoiSpawnInVert.cginc"
+ #include "CGI_PoiShadowVert.cginc"
+ #include "CGI_PoiShadowFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc.meta
new file mode 100644
index 00000000..700e7124
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiPassShadow.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9157516b20ddd5b4a822b186d52bf029
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc
new file mode 100644
index 00000000..352954d1
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc
@@ -0,0 +1,51 @@
+#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;
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+
+ float4 _RGBMaskPanning;
+ float4 _RGBRedPanning;
+ float4 _RGBGreenPanning;
+ float4 _RGBBluePanning;
+
+ float _RGBBlendMultiplicative;
+
+ uint _RGBMaskUV;
+ uint _RGBRed_UV;
+ uint _RGBGreen_UV;
+ uint _RGBBlue_UV;
+
+ float3 calculateRGBMask(float3 baseColor)
+ {
+ float3 rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[_RGBMaskUV], _RGBMaskPanning).rgb;
+ float4 red = POI2D_SAMPLER_PAN(_RedTexure, _MainTex, poiMesh.uv[_RGBRed_UV], _RGBRedPanning);
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiMesh.uv[_RGBGreen_UV], _RGBGreenPanning);
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiMesh.uv[_RGBBlue_UV], _RGBBluePanning);
+
+ UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ baseColor *= RGBColor;
+ }
+ else
+ {
+ baseColor = lerp(baseColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ baseColor = lerp(baseColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ baseColor = lerp(baseColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ }
+
+ return baseColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc.meta
new file mode 100644
index 00000000..e1ff7392
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRGBMask.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e7016982238688340bba36c0b73d76e5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc
new file mode 100644
index 00000000..3d1ace67
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc
@@ -0,0 +1,4 @@
+#ifndef POI_RNG
+ #define POI_RNG
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc.meta
new file mode 100644
index 00000000..2eb457c9
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRNG.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 07d86b07e2f0d7543b52ce43820c6a89
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc
new file mode 100644
index 00000000..6473b764
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc
@@ -0,0 +1,39 @@
+#ifndef POI_RANDOM
+ #define POI_RANDOM
+
+ float _EnableRandom;
+ float m_start_Angle;
+ uint _AngleType;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin, _CameraAngleMax;
+ float _ModelAngleMin, _ModelAngleMax;
+ float _AngleMinAlpha;
+ uint _AngleCompareTo;
+
+ float ApplyAngleBasedRendering(float3 modelPos, float3 worldPos)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? modelPos : worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection)));
+ 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 (_AngleType == 0)
+ {
+ return max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if(_AngleType == 1)
+ {
+ return max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if(_AngleType == 2)
+ {
+ return max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ return 1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc.meta
new file mode 100644
index 00000000..83ac20f9
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRandom.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8a886c36a202bf7419200b67fa5f5d88
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc
new file mode 100644
index 00000000..31692dec
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc
@@ -0,0 +1,53 @@
+#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;
+ uint _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 calculateRimLighting()
+ {
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexturePan);
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[_RimLightNormal]));
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - abs(dot(poiCam.viewDir, poiMesh.normals[_RimLightNormal]));
+ }
+ _RimWidth -= rimNoise;
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiMesh.uv[_RimMaskUV], _RimMaskPan);
+ rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiMesh.uv[_RimTexUV], _RimTexPan) * _RimLightColor;
+ _RimWidth = lerp(_RimWidth, _RimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix);
+ rim = 1 - smoothstep(min(_RimSharpness, _RimWidth), _RimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+ }
+
+ void applyRimColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, lerp(finalColor.rgb, rimColor, _RimLightColorBias) + lerp(finalColor.rgb, rimColor, _RimLightColorBias) * _RimBrighten, rim);
+ }
+ void ApplyRimEmission(inout float3 finalEmission)
+ {
+ finalEmission += rim * lerp(finalColor.rgb, rimColor, _RimLightColorBias) * _RimStrength;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc.meta
new file mode 100644
index 00000000..3527b496
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 485481cb26387c4418383cfd1355770c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc
new file mode 100644
index 00000000..c4fcb1ed
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc
@@ -0,0 +1,95 @@
+#ifndef SHADOW_FRAG
+ #define SHADOW_FRAG
+
+ float2 _MainDistanceFade;
+ float _ForceOpaque;
+ float _MainShadowClipMod;
+ float2 _AlphaMaskPan;
+ uint _AlphaMaskUV;
+ float _AlphaMod;
+
+ #ifdef TRANSPARENT
+ sampler3D _DitherMaskLOD;
+ #endif
+
+ half4 fragShadowCaster(
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ V2FShadow i
+ #endif
+ ): SV_Target
+ {
+ _Clip = clamp(_Clip + _MainShadowClipMod, - .001, 1.001);
+ float2 uv[4] = {
+ i.uv, i.uv1, i.uv2, i.uv3,
+ };
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+
+ half alpha = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)).a;
+
+
+
+ UNITY_BRANCH
+ if (_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ alpha = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(i.uv, _MirrorTexture)).a;
+ }
+ }
+
+
+ alpha *= smoothstep(_MainDistanceFade.x, _MainDistanceFade.y, distance(i.modelPos, _WorldSpaceCameraPos));
+ half alphaMask = POI2D_PAN(_AlphaMask, uv[_AlphaMaskUV], _AlphaMaskPan);
+ alpha *= alphaMask;
+ alpha *= _Color.a;
+ alpha += _AlphaMod;
+ alpha = saturate(alpha);
+
+ #ifdef OPAQUE
+ alpha = 1;
+ #endif
+
+ clip(alpha - 0.01);
+
+ #if defined(CUTOUT)
+ applyShadowDithering(alpha, calcScreenUVs(i.grabPos).xy);
+ #endif
+
+ #ifdef POI_DISSOLVE
+ alpha *= calculateShadowDissolveAlpha(i.worldPos, i.localPos, i.uv);
+ #endif
+
+ #ifdef POI_RANDOM
+ alpha *= i.angleAlpha;
+ #endif
+
+ #if defined(CUTOUT) || defined(TRANSPARENT)
+ #ifndef SIMPLE
+ applySpawnInShadow(uv[0], i.localPos);
+ #endif
+ #if defined(POI_FLIPBOOK)
+ alpha *= applyFlipbookAlphaToShadow(uv[_FlipbookTexArrayUV]);
+ #endif
+ #endif
+
+ #if defined(CUTOUT)
+ #ifndef SIMPLE
+ clip(alpha - _Clip);
+ #endif
+ #endif
+
+ #if defined(TRANSPARENT)
+ float dither = tex3D(_DitherMaskLOD, float3(i.pos.xy * .25, alpha * 0.9375)).a;
+ clip(dither - 0.01);
+ #endif
+
+ #endif
+ SHADOW_CASTER_FRAGMENT(i)
+ }
+
+ #endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc.meta
new file mode 100644
index 00000000..cac5b9ae
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 765e39634f873914e92a4b4fd2245918
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc
new file mode 100644
index 00000000..6d9df4a0
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc
@@ -0,0 +1,41 @@
+#ifndef SHADOW_INCLUDES
+ #define SHADOW_INCLUDES
+
+ #define UNITY_STANDARD_USE_SHADOW_UVS 1
+
+ float4 _Color;
+ float _Clip;
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST;
+ sampler2D _AlphaMask; float4 _AlphaMask_ST;
+
+ struct VertexInputShadow
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ 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;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc.meta
new file mode 100644
index 00000000..13c72e8d
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowIncludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8de0b71a379d0404dbb836ac220d2b2b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc
new file mode 100644
index 00000000..0b022c71
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc
@@ -0,0 +1,73 @@
+float _EnableTouchGlow, _EnableBulge;
+uint _VertexManipulationHeightUV;
+
+V2FShadow vertShadowCaster(VertexInputShadow v)
+{
+ V2FShadow o;
+ UNITY_SETUP_INSTANCE_ID(v);
+
+ applyLocalVertexTransformation(v.normal, v.vertex);
+
+ 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;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+
+ applyWorldVertexTransformation(o.worldPos, o.localPos, v.normal, uvToUse);
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ applyVertexRounding(o.worldPos, o.localPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+
+ UNITY_BRANCH
+ 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;
+} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc.meta
new file mode 100644
index 00000000..e9d33572
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiShadowVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 35014a9d0cbbe334baa88f256affa90d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc
new file mode 100644
index 00000000..1847bce5
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc
@@ -0,0 +1,54 @@
+#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)
+ {
+ UNITY_BRANCH
+ 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 defined(TRANSPARENT) || defined(CUTOUT)
+ clip(ceil(alpha) - 0.001);
+ #endif
+ }
+ }
+
+ void applySpawnInShadow(float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ 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 defined(TRANSPARENT) || defined(CUTOUT)
+ clip(ceil(alpha) - 0.001);
+ #endif
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc.meta
new file mode 100644
index 00000000..7b320fbe
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4c5a4e92900ae7042b1a0d9d35c01fb5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc
new file mode 100644
index 00000000..15044889
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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)
+ {
+ UNITY_BRANCH
+ 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc.meta
new file mode 100644
index 00000000..10431999
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpawnInVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f18abe0c9ba0dfc448a7bc85c5ad58d6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc
new file mode 100644
index 00000000..77261c33
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc
@@ -0,0 +1,478 @@
+#ifndef POI_SPECULAR
+ #define POI_SPECULAR
+ int _SpecWhatTangent;
+ int _SpecularType;
+ int _SmoothnessFrom;
+ 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;
+ uint _SpecularNormal;
+ uint _SpecularNormal1;
+ float _SpecularAttenuation;
+ float _SpecularAttenuation1;
+ // Toon
+ fixed _SpecularToonStart, _SpecularToonEnd;
+ half4 _SpecularToonInnerOuter;
+
+ float _EnableSpecular1;
+ int _SpecWhatTangent1;
+ int _SpecularType1;
+ int _SmoothnessFrom1;
+ 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, _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;
+
+ UNITY_BRANCH
+ if (_SmoothnessFrom == 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) * lerp(1, attenuation, _SpecularAttenuation)) * specularLight;
+ UNITY_BRANCH
+ 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)
+ {
+ #if defined(POINT) || defined(SPOT)
+ 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)
+ {
+ 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[_SpecularNormal], 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 += _Spec1Offset +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[_SpecularNormal], 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);
+
+ /*
+ UNITY_BRANCH
+ if(_CenterOutSpecColor)
+ {
+ specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, clamp(float2(specular, specular), 0.01, .99), _SpecularMapPan);
+ }
+ */
+
+ #if defined(POINT) || defined(SPOT)
+ 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 specularColor * lightColor * attenuation * specularTint * SpecularHQ(perceptualRoughness, dotNH, dotLH);
+ }
+
+ 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[_SpecularMapUV], _SpecularMapPan);
+ half specularMask = POI2D_SAMPLER_PAN(_SpecularMask, _MainTex, poiMesh.uv[_SpecularMaskUV], _SpecularMaskPan).r;
+ float attenuation = poiLight.attenuation;
+
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ if (_SmoothnessFrom == 1)
+ {
+ specularMap.a = specularMap.r;
+ specularMap.rgb = 1;
+ }
+
+ if(_SpecularInvertSmoothness)
+ {
+ specularMap.a = 1 - specularMap.a;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, _SpecularMetallic, _SpecularSmoothness * specularMap.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, saturate(poiLight.nDotL) * lerp(1, attenuation, _SpecularAttenuation));
+ #else
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, _SpecularMetallic, _SpecularSmoothness * specularMap.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, lerp(1, attenuation, _SpecularAttenuation));
+ #endif
+ }
+
+ UNITY_BRANCH
+ if(_SpecularType == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += toonAnisoSpecular(_SpecWhatTangent, _AnisoUseTangentMap, poiLight.direction, poiLight.halfDir, specularMap, poiLight.nDotL, _SpecularToonStart, _SpecularToonEnd, _SpecularTint, albedo, _SpecularMetallic, jitter, _SpecularAnisoJitterMirrored, packedTangentMap);
+ finalSpecular *= lerp(1, poiLight.attenuation, _SpecularAttenuation);
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if(_SpecularType == 2) // Toon
+ {
+ finalSpecular += calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter, _SpecularMetallic, _SmoothnessFrom, specularMap, poiLight.color, poiMesh.normals[_SpecularNormal], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular *= _SpecularTint;
+ }
+ UNITY_BRANCH
+ if (_SpecularType == 3) // anisotropic
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += AnisotropicSpecular(_SpecWhatTangent, _AnisoUseTangentMap, _SpecularSmoothness, _Spec2Smoothness, _AnisoSpec1Alpha, _AnisoSpec2Alpha, _SpecularTint, _SpecularMetallic, specularMap, poiLight.color, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap);
+ finalSpecular *= _SpecularTint;
+ finalSpecular *= lerp(1, poiLight.attenuation, _SpecularAttenuation);
+ }
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ for (int index = 0; index < 4; index ++)
+ {
+ attenuation = poiLight.vAttenuationDotNL[index];
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, _SpecularMetallic, _SpecularSmoothness * specularMap.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+
+ finalSpecular *= _SpecularTint.a;
+ finalSpecular = finalSpecular.rgb;
+ finalSpecular *= specularMask;
+
+ UNITY_BRANCH
+ if (_EnableSpecular1)
+ {
+ float4 specularMap1 = POI2D_SAMPLER_PAN(_SpecularMap1, _MainTex, poiMesh.uv[_SpecularMap1UV], _SpecularMap1Pan);
+ half specularMask1 = POI2D_SAMPLER_PAN(_SpecularMask1, _MainTex, poiMesh.uv[_SpecularMask1UV], _SpecularMask1Pan).r;
+ float attenuation = poiLight.attenuation;
+ UNITY_BRANCH
+ if(_SpecularType1 == 1) // Realistic
+ {
+ UNITY_BRANCH
+ if (_SmoothnessFrom1 == 1)
+ {
+ specularMap1.a = specularMap1.r;
+ specularMap1.rgb = 1;
+ }
+ else
+ {
+ realisticAlbedo1.rgb = specularMap1.rgb;
+ }
+
+ UNITY_BRANCH
+ if(_SpecularInvertSmoothness1)
+ {
+ specularMap1.a = 1 - specularMap1.a;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ finalSpecular1 = calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, _SpecularMetallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, saturate(poiLight.nDotL) * lerp(1, attenuation, _SpecularAttenuation1));
+ #else
+ finalSpecular1 = calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, _SpecularMetallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, lerp(1, attenuation, _SpecularAttenuation1));
+ #endif
+ }
+
+ UNITY_BRANCH
+ if(_SpecularType1 == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 += toonAnisoSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, poiLight.direction, poiLight.halfDir, specularMap1, poiLight.nDotL, _SpecularToonStart1, _SpecularToonEnd1, _SpecularTint1, albedo, _SpecularMetallic1, jitter, _SpecularAnisoJitterMirrored1, packedTangentMap);
+ finalSpecular1 *= lerp(1, poiLight.attenuation, _SpecularAttenuation1);
+ }
+
+ UNITY_BRANCH
+ if(_SpecularType1 == 2) // Toon
+ {
+ finalSpecular1 = calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter1, _SpecularMetallic1, _SmoothnessFrom1, specularMap1, poiLight.color, poiMesh.normals[_SpecularNormal1], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular1 *= _SpecularTint1;
+ }
+ UNITY_BRANCH
+ if (_SpecularType1 == 3) // anisotropic
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 = AnisotropicSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, _SpecularSmoothness1, _Spec2Smoothness1, _AnisoSpec1Alpha1, _AnisoSpec2Alpha1, _SpecularTint1, _SpecularMetallic1, specularMap1, poiLight.color, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap);
+ finalSpecular1 *= _SpecularTint1;
+ finalSpecular1 *= lerp(1, poiLight.attenuation, _SpecularAttenuation1);
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ // Non Important Lights
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index ++)
+ {
+ attenuation = poiLight.vAttenuationDotNL[index];
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ finalSpecular1 += calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, _SpecularMetallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+ #endif
+
+ finalSpecular1 *= _SpecularTint1.a;
+ finalSpecular1 = finalSpecular1.rgb;
+ finalSpecular1 *= specularMask1;
+ }
+ return finalSpecular + finalSpecular1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc.meta
new file mode 100644
index 00000000..3644c1ea
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSpecular.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0b4e6cd954964f744a6d8f3110065276
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc
new file mode 100644
index 00000000..baba1bd9
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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[_SSSThicknessMapUV], _SSSThicknessMapPan);
+
+ half3 vLTLight = poiLight.direction + poiMesh.normals[0] * _SSSDistortion;
+ half flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSPower) * _SSSSCale;
+ #ifdef FORWARD_BASE_PASS
+ half3 fLT = (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #else
+ half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #endif
+
+ return fLT * poiLight.color * _SSSColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
new file mode 100644
index 00000000..cdc51853
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c069b0b0fa3d8f541a70acaee373e479
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc
new file mode 100644
index 00000000..a35f940f
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc.meta
new file mode 100644
index 00000000..47732023
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiTessellation.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 043e5afe2fc90c44bbd9e01944cafa1a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc
new file mode 100644
index 00000000..5615695a
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc
@@ -0,0 +1,22 @@
+#ifndef POI_UV_DISTORTION
+ #define POI_UV_DISTORTION
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture); float4 _DistortionFlowTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture1); float4 _DistortionFlowTexture1_ST;
+
+ float _DistortionStrength;
+ float _DistortionStrength1;
+ float2 _DistortionSpeed;
+ float2 _DistortionSpeed1;
+
+ float2 calculateDistortionUV(float2 uv)
+ {
+ _DistortionStrength *= .1;
+ float4 flowVector = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture) + _Time.x * _DistortionSpeed) * 2 - 1;
+ float4 flowVector1 = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture1, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture1) + _Time.x * _DistortionSpeed1) * 2 - 1;
+ flowVector *= _DistortionStrength;
+ flowVector1 *= _DistortionStrength1;
+ return uv + (flowVector.xy + flowVector1.xy) / 2;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc.meta
new file mode 100644
index 00000000..ec29b511
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiUVDistortion.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c9b4d7ab88c2e8d4b8f84f0a57b9ca97
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc
new file mode 100644
index 00000000..075a64d4
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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 screenPos: 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc.meta
new file mode 100644
index 00000000..d931361d
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiV2F.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6eafb5dcd4b16844cbc2af812d50c74f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc
new file mode 100644
index 00000000..2b2aaf90
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc
@@ -0,0 +1,107 @@
+#ifndef POI_VERT
+ #define POI_VERT
+
+ uint _VertexManipulationHeightUV;
+ float _VertexUnwrap;
+ 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), _VertexUnwrap);
+ #endif
+ applyLocalVertexTransformation(v.normal, v.tangent, v.vertex);
+
+
+ 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;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+
+ applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse);
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ applyVertexRounding(o.worldPos, o.localPos);
+ 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
+
+ #if defined(GRAIN)
+ o.screenPos = ComputeScreenPos(o.pos);
+ #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
+
+ return o;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc.meta
new file mode 100644
index 00000000..81ea7bac
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d894e5c87ba80eb4697485aac0e68da3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc
new file mode 100644
index 00000000..7d7e15f0
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc
@@ -0,0 +1,97 @@
+#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)
+ {
+ #ifndef SIMPLE
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation);
+ tangent.xyz = rotate_with_quaternion(tangent.xyz, _VertexManipulationLocalRotation);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //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);
+ #endif
+ }
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 vertex)
+ {
+ #ifndef SIMPLE
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //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);
+ #endif
+ }
+
+ void applyWorldVertexTransformation(inout float4 worldPos, inout float4 localPos, inout float3 worldNormal, float2 uv)
+ {
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz * _VertexManipulationWorldTranslation.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) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz * _VertexManipulationWorldTranslation.w + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos);
+ }
+
+ void applyVertexRounding(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ worldPos.xyz = (ceil(worldPos * _VertexRoundingDivision) / _VertexRoundingDivision) - 1 / _VertexRoundingDivision * .5;
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+ void applyVertexGlitching(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ 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
+// \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc.meta
new file mode 100644
index 00000000..8058cad2
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVertexManipulations.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2cc3aabeafa10fb40b40ce6bcbcffcd2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc
new file mode 100644
index 00000000..ad0b465c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc
@@ -0,0 +1,267 @@
+#ifndef POI_VIDEO
+ #define POI_VIDEO
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoPixelTexture); float4 _VideoPixelTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoMaskTexture); float4 _VideoMaskTexture_ST;
+
+ uint _VideoUVNumber;
+ uint _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 globalVideoEmission;
+
+ float3 applyBacklight(float3 finalColor, half backlightStrength)
+ {
+ return max(backlightStrength, finalColor.rgb);
+ }
+
+ float3 applyViewAngleTN(float3 finalColor)
+ {
+ 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
+ finalColor = LinearToGammaSpace(finalColor);
+ #endif
+ finalColor = saturate(lerp(half3(0.5, 0.5, 0.5), finalColor, upwardShift + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ finalColor = GammaToLinearSpace(finalColor);
+ #endif
+ finalColor = (lerp(finalColor, finalColor.gbr, sideShift));
+ return finalColor;
+ }
+
+ 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 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight;
+ }
+ void calculateTN(inout float4 finalColor)
+ {
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ globalColorToDisplayOnScreen = applyViewAngleTN(globalColorToDisplayOnScreen);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight;
+ }
+ void calculateCRT(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ float brightness = calculateCRTPixelBrightness();
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * brightness * _VideoBacklight;
+ }
+ void calculateOLED(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight;
+ }
+ void calculateGameboy(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ half brightness = saturate((globalColorToDisplayOnScreen.r + globalColorToDisplayOnScreen.g + globalColorToDisplayOnScreen.b) * .3333333);
+ finalColor.rgb = tex2D(_VideoGameboyRamp, brightness);
+ }
+ void calculateProjector(inout float4 finalColor, float4 finalColorBeforeLighting)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+
+ float3 projectorColor = finalColorBeforeLighting * globalColorToDisplayOnScreen * _VideoBacklight;
+ finalColor.r = clamp(projectorColor.r, finalColor.r, 1000);
+ finalColor.g = clamp(projectorColor.g, finalColor.g, 1000);
+ finalColor.b = clamp(projectorColor.b, finalColor.b, 1000);
+ }
+
+ void applyScreenEffect(inout float4 finalColor, float4 finalColorBeforeLighting)
+ {
+ float4 finalColorBeforeScreen = finalColor;
+
+ pixels = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoPixelTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoPixelTexture) * _VideoResolution);
+ globalVideoOn = 0;
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 1)
+ {
+ float4 videoTexture = 0;
+ UNITY_BRANCH
+ if(_VideoPixelateToResolution)
+ {
+ UNITY_BRANCH
+ 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
+ {
+ UNITY_BRANCH
+ 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;
+ }
+ }
+
+ UNITY_BRANCH
+ 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(finalColor);
+ break;
+ }
+ case 1: // TN
+ {
+ calculateTN(finalColor);
+ break;
+ }
+ case 2: // CRT
+ {
+ calculateCRT(finalColor);
+ break;
+ }
+ case 3: // OLED
+ {
+ calculateOLED(finalColor);
+ break;
+ }
+ case 4: // Gameboy
+ {
+ calculateGameboy(finalColor);
+ break;
+ }
+ case 5: // Projector
+ {
+ calculateProjector(finalColor, finalColorBeforeLighting);
+ break;
+ }
+ }
+
+ float screenMask = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoMaskTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoMaskTexture) + _Time.x * _VideoMaskPanning);
+ finalColor = lerp(finalColorBeforeScreen, finalColor, screenMask);
+ globalVideoEmission = finalColor.rgb;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc.meta
new file mode 100644
index 00000000..c0049aae
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVideo.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 73d432c3d16bb244eb0b695b3603923e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc
new file mode 100644
index 00000000..095c1c5c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc
@@ -0,0 +1,294 @@
+#ifndef POI_VORONOI
+ #define POI_VORONOI
+
+ #include "CGI_PoiRNG.cginc"
+
+ uint _VoronoiSpace;
+ uint _VoronoiBlend;
+ uint _VoronoiType;
+ float4 _VoronoiColor0;
+ float _VoronoiEmission0;
+ float4 _VoronoiColor1;
+ float _VoronoiEmission1;
+ float2 _VoronoiGradient;
+ float _VoronoiScale;
+ float3 _VoronoiSpeed;
+ int _VoronoiOctaveNumber;
+ float _VoronoiOctaveScale;
+ float _VoronoiOctaveAttenuation;
+ float _VoronoiEnableRandomCellColor;
+ float2 _VoronoiRandomMinMaxSaturation;
+ float2 _VoronoiRandomMinMaxBrightness;
+ float3 randomPoint;
+
+ 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)
+ {
+ _VoronoiOctaveNumber = 1;
+ _VoronoiOctaveScale = 1;
+ _VoronoiOctaveAttenuation = 1;
+ randomPoint = 0;
+
+ float voronoi = 0;
+
+ float3 position = 0;
+
+ UNITY_BRANCH
+ if (_VoronoiSpace == 0)
+ {
+ position = poiMesh.localPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 1)
+ {
+ position = poiMesh.worldPos;
+ }
+ UNITY_BRANCH
+ 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;
+
+ UNITY_BRANCH
+ if(_VoronoiType == 0) // Basic
+ {
+ voronoi = voronoi2D(position.xy, _VoronoiScale, _VoronoiSpeed);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 1) // Diff
+ {
+ voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, _VoronoiSpeed, _VoronoiOctaveNumber, _VoronoiOctaveScale, _VoronoiOctaveAttenuation, 1, _Time.x);
+ }
+ UNITY_BRANCH
+ 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);
+ }
+ _VoronoiGradient.xy += edgeNoise;
+ float ramp = smoothstep(_VoronoiGradient.x, _VoronoiGradient.y, voronoi);
+
+ UNITY_BRANCH
+ if(_VoronoiBlend == 0)
+ {
+ float4 voronoiColor = lerp(_VoronoiColor0, _VoronoiColor1, ramp);
+ finalColor.rgb = lerp(finalColor.rgb, voronoiColor, mask * voronoiColor.a);
+ }
+ float4 voronoiEmissionColor = lerp(_VoronoiColor0 * _VoronoiEmission0, _VoronoiColor1 * _VoronoiEmission1, ramp);
+ VoronoiEmission = voronoiEmissionColor.rgb * mask * voronoiEmissionColor.a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc.meta
new file mode 100644
index 00000000..c735683f
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiVoronoi.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 212232d5f3d506248b1bde8125d54656
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc
new file mode 100644
index 00000000..f8c75c53
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/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;
+ uint _WireframeUV;
+
+ #ifndef POI_SHADOW
+ void applyWireframe(inout float3 wireframeEmission, inout float4 albedo)
+ {
+ UNITY_BRANCH
+ 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)
+ {
+ UNITY_BRANCH
+ 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)
+ {
+ UNITY_BRANCH
+ 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 \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc.meta
new file mode 100644
index 00000000..854dfb4c
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiWireframe.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1dd724a69f3cb564587366df31afbda8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc
new file mode 100644
index 00000000..f6128639
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc
@@ -0,0 +1,176 @@
+#ifndef POICLUDES
+ #define POICLUDES
+
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST; float4 _MainTex_TexelSize;
+ sampler2D _PoiGrab;
+ float _Clip;
+ 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;
+ float4 _OutlineTexturePan;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ #endif
+
+ struct PoiLighting
+ {
+ half3 direction;
+ half3 color;
+ fixed attenuation;
+ #if defined(POINT) || defined(SPOT)
+ 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 screenPos;
+ #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;
+ float4 finalColor;
+ float3 finalEmission;
+ float4 mainTexture;
+ float4 albedo;
+
+#endif
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc.meta
new file mode 100644
index 00000000..96bf58e2
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_Poicludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a1ffb78a8d1d0534ead09d64e4ba14d1
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt
new file mode 100644
index 00000000..32633192
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt
@@ -0,0 +1,7 @@
+// Transforms 2D UV by scale/bias property
+#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw)
+
+[HideInInspector][Vector2]Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] UV ("UV", Int) = 0
+
+:=--{reference_properties:[Pan, UV]} \ No newline at end of file
diff --git a/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt.meta b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt.meta
new file mode 100644
index 00000000..e76b626e
--- /dev/null
+++ b/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/Notes.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: e59bb8ae731c3d54fae2036a14f9ee8e
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: