카테고리 없음
0504 normal texture + occlusion
피주빈
2021. 5. 4. 13:23
Normal 매핑 : 로우 폴리곤의 그래픽 환경에서 하이 폴리곤의 입체감/질감을 구현하는 방법
노멀맵은 보통 텍스쳐가 따로 있다.
Shader "Custom/sphere"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
sampler2D _MainTex;
sampler2D _BumpMap;
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
};
half _Glossiness;
half _Metallic;
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
fixed3 n = UnpackNormal(tex2D(_BumpMap, IN. uv_BumpMap));
o.Normal = n;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Ambient Occlusion
주변광을 가리거나 차단해서 더 어둡게 해 명도를 높힌다.
구석진 부분을 더 어둡게 한다.
Shader "Custom/sphere"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Occlusion ("Occlusion",2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _Occlusion;
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
};
half _Glossiness;
half _Metallic;
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
fixed3 n = UnpackNormal(tex2D(_BumpMap, IN. uv_BumpMap));
o.Occlusion = tex2D(_Occlusion, IN.uv_MainTex);
o.Normal = n;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}