Shader "Custom/Wet" { Properties { } SubShader { Tags { "Queue"="Transparent" } // LOD 100 Blend One One ZWrite Off // Cull Off Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma multi_compile_instancing #pragma target 3.5 // #include "UnityCG.cginc" #include "UnityStandardBRDF.cginc" struct appdata { float4 vertex : POSITION; UNITY_VERTEX_INPUT_INSTANCE_ID fixed3 normal : NORMAL; }; struct v2f { float4 vertex : SV_POSITION; fixed3 normal : TEXCOORD1; fixed4 color : COLOR; }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; UNITY_SETUP_INSTANCE_ID(v); o.vertex = UnityObjectToClipPos(v.vertex); o.normal = UnityObjectToWorldNormal(v.normal); fixed4 base = fixed4(1, 1, 1, 1); fixed3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; fixed3 viewDir = normalize(UnityWorldSpaceViewDir(worldPos)); // o.color = base * clamp(dot(o.normal, -viewDir), 0, 0.2); // Rim lighting fixed rim = 1.0 - saturate(dot (normalize(viewDir), o.normal)); o.color = base * rim * rim * 0.2; return o; } fixed4 frag (v2f i) : SV_Target { return i.color; } ENDCG } } }