외부 라이트맵 사용을 위한 shader
Properties {
_TintColor ("TintColor", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_LightMap ("Lightmap (RGB)", 2D) = "black" {}
_LightIntensity ("Light Intensity", Range(0,2)) = 1
}
SubShader {
Tags { "RenderType"="Opaque" }
Lighting off
LOD 200
CGPROGRAM
#pragma surface surf Unlit nolightmap nodirlightmap noforwardadd approxview halfasview noambient
fixed4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
return fixed4(s.Albedo,1);
}
sampler2D _MainTex;
sampler2D _LightMap;
float _LightIntensity;
fixed4 _TintColor;
struct Input {
float2 uv_MainTex;
float2 uv2_LightMap;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
half4 lm = tex2D (_LightMap, IN.uv2_LightMap);
o.Albedo = c.rgb * lm.rgb * _TintColor.rgb * _LightIntensity;
}
ENDCG
}
fallback "mobile/Diffuse"
}
'Technical Report > Unity Shader' 카테고리의 다른 글
Unity 셰이더 Variants 최적화 (0) | 2015.09.08 |
---|---|
Unity Surface shader Lighting model (0) | 2015.08.05 |
Unity PostProcessing (0) | 2015.07.14 |
Unity5 compressed option (0) | 2015.07.05 |
UV scrolling shader (0) | 2015.07.03 |