summaryrefslogtreecommitdiff
path: root/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc
diff options
context:
space:
mode:
Diffstat (limited to 'VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc')
-rw-r--r--VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiFur.cginc40
1 files changed, 40 insertions, 0 deletions
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