Shader "Custom/NormalMap" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_BumpTex ("Bump Tex", 2D) = "bump" {}
_NormalMapIntensity("Normal intensity",Range(0,1))=1
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _BumpTex;
struct Input {
float2 uv_BumpTex;
};
fixed4 _Color;
float _NormalMapIntensity;
void surf (Input IN, inout SurfaceOutputStandard o) {
float3 normalMap = UnpackNormal(tex2D(_BumpTex,IN.uv_BumpTex)).rgb;
normalMap.x*=_NormalMapIntensity;
normalMap.y*=_NormalMapIntensity;
normalMap = normalize(normalMap);
o.Normal = normalMap.rgb;
fixed4 c = tex2D(_BumpTex,IN.uv_BumpTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
法线贴图
最新推荐文章于 2021-09-05 23:01:25 发布