Shader "Custom/15-3-MaskMap"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_BumpMap("NormalMap (RGB)", 2D) = "white" {}
_MaskMap("MaskMap", 2D) = "white"{}
_Cube("Cubemap", CUBE) = "" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert noambient
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
float2 uv_MaskMap;
float3 worldRefl;
// 노멀맵에 반사처리르 할때
INTERNAL_DATA
};
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _MaskMap;
samplerCUBE _Cube;
void surf(Input IN, inout SurfaceOutput o)
{
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
float4 re = texCUBE(_Cube, WorldReflectionVector(IN, o.Normal));
float4 m = tex2D(_MaskMap, IN.uv_MaskMap);
o.Albedo = c.rgb *(1 - m.r);
o.Emission = re.rgb * m.r;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
'Shader > Shader - SurfaceShader' 카테고리의 다른 글
16-3-알파블렌딩 (0) | 2020.04.08 |
---|---|
16-2-1깊이버퍼 출력 (0) | 2020.04.08 |
Custom/15-1-Reflection (0) | 2020.04.07 |
14-5 (0) | 2020.04.06 |
13-4 rim (0) | 2020.04.06 |