Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/Watercol"
- {
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {}
- _PaintTex ("Texture", 2D) = "white" {}
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
- LOD 100
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- //#pragma multi_compile_fog
- #include "UnityCG.cginc"
- #include "UnityLightingCommon.cginc"
- struct v2f
- {
- float2 uv : TEXCOORD0;
- float2 uvpaint : TEXCOORD1;
- fixed4 diff : COLOR0;
- float4 vertex : SV_POSITION;
- //UNITY_FOG_COORDS(1)
- };
- sampler2D _MainTex;
- float4 _MainTex_ST;
- sampler2D _PaintTex;
- v2f vert (appdata_base v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
- o.uvpaint = v.vertex.xy + v.vertex.zz;
- half3 worldNormal = UnityObjectToWorldNormal(-v.normal);
- half nl = max(0, dot(worldNormal, _WorldSpaceLightPos0.xyz));
- o.diff = nl * _LightColor0;
- o.diff.rgb += ShadeSH9(half4(worldNormal,1));
- //UNITY_TRANSFER_FOG(o,o.vertex);
- return o;
- }
- fixed4 frag (v2f i) : SV_Target
- {
- // sample the texture
- fixed4 col = tex2D(_MainTex, i.uv);
- fixed paint = tex2D(_PaintTex, i.uvpaint * 0.2 + col.xy * 0.35).r;
- float f = 2.5;
- i.diff *= f;
- i.diff = round(i.diff);
- i.diff /= f;
- i.diff = max(i.diff, 0.675);
- col *= i.diff;
- col.rgb += col.rgb * (paint - 0.5) * 0.8;
- //UNITY_APPLY_FOG(i.fogCoord, col);
- return col;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement