Shader "Custom/FadeShader" {
Properties{
_Color("Color", Color) = (1,1,1,1)
[Toggle] _LightOn("Light On", float) = 0
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump"{}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Opacity("Opacity",range(0,1))= 1
}
SubShader {
Tags { "RenderType"="Transparent" "Queue" = "Transparent" }
LOD 200
Cull Off
Pass{
ZWrite On
ColorMask 0
}
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows alpha:fade
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _BumpMap;
fixed _Opacity;
fixed _LightOn;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb * _LightOn;
o.Emission = c.rgb * (1 - _LightOn);
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic * _LightOn;
o.Smoothness = _Glossiness * _LightOn;
o.Alpha = c.a * _Opacity;
}
ENDCG
}
FallBack "Diffuse"
}
Shader
猜你喜欢
转载自blog.csdn.net/qq_36848370/article/details/80188161
今日推荐
周排行