I'm trying to set up a shader that will do all three of these, but I'm new to shaders and haven't found very many resources that explain why they are doing what they are doing. I would LOVE pointers to improve every part of this, and help getting the shadows working, I haven't been able to figure out how to get it working with all sorts of variety of methods. I have the Texture Blending and Fog working (to an extent, texture blending isn't working how I hoped it would) but I am struggling to put the lighting in to the shader (I think? It's not getting shadows at least) So what I am trying to do: I was going for was blending based on steepness with additional weight given to heights. So for example, at low altitude it will be a dirt texture, at mid altitudes it will be a grass texture, and at high altitudes it will be stone, however, in the dirt section I want to replace steep areas with stone and in the grass area replace steep areas with stone or dirt depending on steepness. I also want to have fog to help fade the terrain into the distance (helps hide deformations and junk) and lastly I want it to have shadows casted (if possible) but at least lighting since I don't think any applies at all at the moment. I have exactly 1 directional light in my scene. First: here is what my terrain looks like - the texture blending works a bit, used tangents and heights to do some really ugly math. Second: here's what is happening/not happening. At the base of the tree in the bottom right you will see a small shadow, it works fine on the speed tree objects but not on the terrain as you can see. Third: here's that ugly shader of mine. Code (CSharp): Shader "Lonely Vale/Terrain Shader" { Properties { _RedTex ("Texture@Red Coords", 2D) = "white" {} _GreenTex ("Texture@Green Coords", 2D) = "white" {} _BlueTex ("Texture@Blue Coords", 2D) = "white" {} _MaxHeight ("Max Height", Float) = 50 _MinHeight ("Min Height", Float) = 0 _MidHeight ("Mid Height", Float) = 25 } SubShader { Tags { "LightMode" = "ForwardBase" } Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma target 4.0 #include "UnityCG.cginc" #pragma multi_compile_fwdbase #include "AutoLight.cginc" uniform sampler2D _RedTex; uniform sampler2D _GreenTex; uniform sampler2D _BlueTex; uniform float _MaxHeight; uniform float _MinHeight; uniform float _MidHeight; uniform half unity_FogDensity; //uniform half unity_FogColor; struct inputVert { float4 pos : POSITION; float4 col : COLOR; float4 tangent : TANGENT; float3 normal : NORMAL; float2 coord : TEXCOORD0; }; struct outputVert { float4 pos : SV_POSITION; float4 col :COLOR; float4 tan : TANGET; float4 unPos : NORMAL; float2 uv : TEXCOORD0; half2 fogDepth : TEXCOORD1; LIGHTING_COORDS(2, 3) }; outputVert vert(inputVert v) { outputVert o; o.pos = mul(UNITY_MATRIX_MVP, v.pos); o.uv = v.coord; o.col = v.col; o.tan = v.tangent; o.unPos = v.pos; o.fogDepth.x = length(mul (UNITY_MATRIX_MV, v.pos).xyz); o.fogDepth.y = o.fogDepth.x * unity_FogDensity; TRANSFER_VERTEX_TO_FRAGMENT(o); return o; } float4 frag(outputVert v) : COLOR { float4 redCol = tex2D(_RedTex, v.uv); float4 greenCol = tex2D(_GreenTex, v.uv); float4 blueCol = tex2D(_BlueTex, v.uv); if (v.tan.x < 0) { v.tan.x = -v.tan.x; } if (v.tan.y < 0) { v.tan.y = -v.tan.y; } if (v.tan.z < 0) { v.tan.z = -v.tan.z; } float lerpMagic = (v.unPos.y - (_MidHeight - (0.3 * (_MaxHeight - _MinHeight)))); if (lerpMagic < 0) { lerpMagic = 0; } lerpMagic = lerpMagic / (_MaxHeight - _MidHeight); float magicalSteepColorR = lerp(greenCol.r, blueCol.r, lerpMagic); float magicalSteepColorG = lerp(greenCol.g, blueCol.g, lerpMagic); float magicalSteepColorB = lerp(greenCol.b, blueCol.b, lerpMagic); float tangentRed = v.tan.x * redCol.r + v.tan.y * magicalSteepColorR + v.tan.z * blueCol.r; float tangentGreen = v.tan.x * redCol.g + v.tan.y * magicalSteepColorG + v.tan.z * blueCol.g; float tangentBlue = v.tan.x * redCol.b + v.tan.y * magicalSteepColorB + v.tan.z * blueCol.b; float fogAmt = v.fogDepth.y * v.fogDepth.y; fogAmt = exp(-fogAmt); float attenuation = LIGHT_ATTENUATION(i); return lerp(float4(tangentRed, tangentGreen, tangentBlue, 0.0), unity_FogColor, 1-fogAmt) * attenuation; } ENDCG } } FallBack "Diffuse" }