Properties {
[Header(Simple StandardShader)]
[Space(20)]
_Color ("Color", Color) = (1,1,1,1)
[Space(20)]
_MainTex ("Albedo (RGB), Alpha(A)", 2D) = "white" {}
[Space(10)]
[Normal][NoScaleOffset]_BumpMap("Normal Map", 2D) = "bump" {}
_BumpScale("Normal Intensity", Float) = 1.0
[NoScaleOffset]_MetallicGlossMap("Meatllic(R), Occlusion(G), Smoothness(A)", 2D) = "white" {}
[Space(20)]
_Metallic ("Metallic", Range(0,1)) = 0.5
_Glossiness ("Smoothness", Range(0,1)) = 0.5
[MaterialToggle(_Ocu_ON)] _Ocu("Occlusion Toggle", float) = 0
_OccInten("Occlusion", Range(0,1)) = 1
[Space(30)]
[Header(Emissive Parameter)]
[MaterialToggle(_Emi_ON)] _Emi("Emissive Toggle", float) = 0
_EmissiveColor("Emissive Color", Color) = (1,1,1,1)
_EmissiveTex ("Emissive Texture(RGB)", 2D) = "white" {}
_EmissiveInten("Emissive Inten", Range(0, 5)) = 1
[Space(30)]
[Header(AlphaTest Setup)]
_Cutoff ("Cut Off", Range(0,1)) = 0.5
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Off : 2side", Float) = 2
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Cull [_Cull]
CGPROGRAM
#pragma surface surf Standard alphatest:_Cutoff keepalpha interpolateview noforwardadd exclude_path:deferred noforwardadd nodirlightmap nodynlightmap nolightmap
// Forward render only, only one light applied, not supported lightmaps
// Physically based Standard lighting model, and enable shadows on all light types to fullforwardshadows
#pragma target 3.0
#pragma shader_feature _Emi_ON
#pragma shader_feature _Ocu_ON
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _MetallicGlossMap;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
half _BumpScale;
half _OccInten;
fixed4 _Color;
#if _Emi_ON
sampler2D _EmissiveTex;
fixed4 _EmissiveColor;
half _EmissiveInten;
#endif
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed3 nm = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
fixed4 sg = tex2D(_MetallicGlossMap, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Normal = nm * fixed3(1, _BumpScale, 1);
o.Metallic = sg.r * _Metallic;
o.Smoothness = sg.a * _Glossiness;
#if _Ocu_ON
o.Occlusion = sg.g * _OccInten;
#endif
#if _Emi_ON
fixed3 em = tex2D(_EmissiveTex, IN.uv_MainTex);
o.Emission = em * _EmissiveColor * _EmissiveInten;
#endif
o.Alpha = c.a;
}
ENDCG
}
FallBack "VertexLit"
//if Shadows not supported VertexLit change to Diffuse
}
'Technical Report > Unity Shader' 카테고리의 다른 글
Unity StandardRoughnessDemoSBShift (0) | 2018.01.25 |
---|---|
StandardRoughnessDemo (0) | 2018.01.25 |
[번역]Unity Labs: AutoLOD – Experimenting with automatic performance improvements (0) | 2018.01.14 |
Unity output value 'vert' is not completely initialized (0) | 2017.09.25 |
Blend Complex values (0) | 2017.09.18 |