You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
774 B
31 lines
774 B
Shader "Example/Rim" { |
|
Properties{ |
|
_MainTex("Texture", 2D) = "white" {} |
|
_BumpMap("Bumpmap", 2D) = "bump" {} |
|
_RimColor("Rim Color", Color) = (0.26,0.19,0.16,0.0) |
|
_RimPower("Rim Power", Range(0.5,8.0)) =0.5 |
|
} |
|
SubShader{ |
|
Tags{ "RenderType" = "Opaque" } |
|
CGPROGRAM |
|
#pragma surface surf Lambert |
|
struct Input { |
|
float2 uv_MainTex; |
|
float2 uv_BumpMap; |
|
float3 viewDir; |
|
}; |
|
sampler2D _MainTex; |
|
sampler2D _BumpMap; |
|
float4 _RimColor; |
|
float _RimPower; |
|
void surf(Input IN, inout SurfaceOutput o) { |
|
o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb; |
|
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap)); |
|
half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal)); |
|
o.Emission = _RimColor.rgb * pow(rim, _RimPower); |
|
} |
|
ENDCG |
|
} |
|
Fallback "Diffuse" |
|
|
|
} |