So I got this shader off of AngryBots and it’s doing exactly what I expected, but the problem is that no lights are affecting it. Directional lights, point lights and spot lights. I can modify some shader code but I have no shader knowledge of making lighting work with this. Can anyone help me? It would be much appreciated
By the way, I’m a C# programmer, not a shader programmer, so I don’t know any of these complicated stuff.
Shader "Darkraze/FX/Wet Surface" {
Properties {
_MainColor ("Main Color", Color) = (1, 1, 1, 1)
_ReflColor ("Reflection Color", Color) = (1, 1, 1, 1)
_MainTex ("Base Texture", 2D) = "white" {}
_Normal ("Normal-map", 2D) = "bump" {}
_ReflectionTex ("Reflection Texture", 2D) = "black" {}
_ReflectionMask ("Reflection Mask", 2D) = "black" {}
_DirectionUv("Wave Direction/Speed", Vector) = (1, 1, -0.2, -0.2)
_BumpMapTiling("Wave Tiling", Vector) = (8, 8, 4, 4)
_WaveStrength("Wave Strength", Range(0.05, 0.5)) = 0.05
}
CGINCLUDE
struct v2f_full {
half4 pos : SV_POSITION;
half2 uv : TEXCOORD0;
half4 normalScrollUv : TEXCOORD1;
half4 screen : TEXCOORD2;
half2 fakeRefl : TEXCOORD3;
};
#include "Darkraze.cginc"
half4 _MainColor;
half4 _ReflColor;
half4 _DirectionUv;
half4 _BumpMapTiling;
half _WaveStrength;
sampler2D _MainTex;
sampler2D _Normal;
sampler2D _ReflectionTex;
sampler2D _ReflectionMask;
ENDCG
SubShader {
Tags {"RenderType" = "Opaque"}
LOD 300
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
float4 _MainTex_ST;
v2f_full vert(appdata_full v) {
v2f_full o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.normalScrollUv.xyzw = v.texcoord.xyxy * _BumpMapTiling + _Time.xxxx * _DirectionUv;
o.fakeRefl = EthansFakeReflection(v.vertex);
return o;
}
fixed4 frag(v2f_full i) : COLOR0 {
half3 nrml = UnpackNormal(tex2D(_Normal, i.normalScrollUv.xy));
nrml += UnpackNormal(tex2D(_Normal, i.normalScrollUv.zw));
nrml.xy *= 0.025;
fixed4 rtRefl = tex2D(_ReflectionTex, nrml.xy);
rtRefl += tex2D(_ReflectionMask, i.fakeRefl + nrml.xy * 2.0);
fixed4 tex = tex2D(_MainTex, i.uv.xy + nrml.xy * _WaveStrength);
tex = (tex * _MainColor) + (tex.a * rtRefl * _ReflColor);
return tex;
}
ENDCG
}
}
Fallback "VertexLit"
}