12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- Shader "Custom/FaceShader"
- {
- Properties
- {
- _MainTex("Main", 2D) = "white" {}
- _Eyes("Eyes", 2D) = "white" {}
- _EyesTint("EyesTint", Color) = (1.0, 1.0, 1.0, 1.0)
- _Eyelines("Eyelines", 2D) = "white" {}
- _EyelinesTint("EyelinesTint", Color) = (1.0, 1.0, 1.0, 1.0)
- _EyeShadows("EyeShadows", 2D) = "white" {}
- _EyeShadowsTint("EyeShadowsTint", Color) = (1.0, 1.0, 1.0, 1.0)
- _Lips("Lips", 2D) = "white" {}
- _LipsTint("LipsTint", Color) = (1.0, 1.0, 1.0, 1.0)
- }
-
- SubShader
- {
- Tags{ "RenderType" = "Opaque" }
- LOD 100
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_fog
- #include "UnityCG.cginc"
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
- struct v2f
- {
- float2 uv : TEXCOORD0;
- UNITY_FOG_COORDS(1)
- float4 vertex : SV_POSITION;
- };
- sampler2D _MainTex;
- float4 _MainTex_ST;
- sampler2D _Eyes;
- float4 _Eyes_ST;
- float4 _EyesTint;
- sampler2D _Eyelines;
- float4 _Eyelines_ST;
- float4 _EyelinesTint;
- sampler2D _EyeShadows;
- float4 _EyeShadows_ST;
- float4 _EyeShadowsTint;
- sampler2D _Lips;
- float4 _Lips_ST;
- float4 _LipsTint;
- v2f vert(appdata v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = TRANSFORM_TEX(v.uv, _MainTex);
- UNITY_TRANSFER_FOG(o,o.vertex);
- return o;
- }
- fixed4 getColor(half4 overlay)
- {
- return (1 - overlay.a) + (overlay.rgba * overlay.a);
- }
- fixed4 frag(v2f i) : SV_Target
- {
- half4 eyesColor = tex2D(_Eyes, i.uv) * _EyesTint;
- half4 eyelinesColor = tex2D(_Eyelines, i.uv) * _EyelinesTint;
- half4 eyeShadowsColor = tex2D(_EyeShadows, i.uv) * _EyeShadowsTint;
- half4 lipsColor = tex2D(_Lips, i.uv) * _LipsTint;
- fixed4 col = tex2D(_MainTex, i.uv);
- UNITY_APPLY_FOG(i.fogCoord, col);
- fixed4 result = col.rgba * (getColor(eyesColor) * getColor(eyeShadowsColor) * getColor(eyelinesColor) * getColor(lipsColor));
- result.a = 1;
- return result;
- }
- ENDCG
- }
- }
- }
|