41 lines
1.0 KiB
Plaintext
41 lines
1.0 KiB
Plaintext
Shader "Terrain"
|
|
{
|
|
Properties
|
|
{
|
|
_TerrainColor ("Terrain Color", 2D) = "white" {}
|
|
_TerrainNormal ("Terrain Normal", 2D) = "white" {}
|
|
_WallColor ("Wall Color", 2D) = "white" {}
|
|
_WallNormal ("Wall Normal", 2D) = "white" {}
|
|
}
|
|
|
|
SubShader {
|
|
Tags { "RenderType" = "Opaque" }
|
|
|
|
CGPROGRAM
|
|
#pragma surface surf Standard
|
|
|
|
struct Input {
|
|
float4 color: COLOR;
|
|
float3 worldPos;
|
|
float2 uv_TerrainColor;
|
|
};
|
|
|
|
sampler2D _TerrainColor;
|
|
sampler2D _TerrainNormal;
|
|
sampler2D _WallColor;
|
|
sampler2D _WallNormal;
|
|
|
|
void surf (Input IN, inout SurfaceOutputStandard o) {
|
|
float t = saturate(IN.color.r * 4 - 3);
|
|
|
|
o.Albedo = lerp(tex2D(_TerrainColor, IN.worldPos.xz).rgb, tex2D(_WallColor, IN.uv_TerrainColor).rgb, t);
|
|
o.Normal = UnpackNormal(lerp(tex2D(_TerrainNormal, IN.worldPos.xz), tex2D(_WallNormal, IN.uv_TerrainColor), t));
|
|
}
|
|
|
|
ENDCG
|
|
}
|
|
|
|
Fallback "Diffuse"
|
|
}
|
|
|