셰이더 (Shader)/유니티 쉐이더 스타트업 - 정종필
[Unity/Shader] 파트9-2 : Lambert 라이팅
Minkyu Lee
2023. 8. 9. 21:24

매우 전통적이고 가벼운 라이팅 공식이다.
코드
Shader "Custom/NewSurfaceShader 1"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Lambert // * 여기를 Lambert로 바꿨다.
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
};
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutput o) // * 여기를 SurfaceOutput으로 바꿨다.
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
기본 코드에서 두 줄 바꾼게 전부다.