Shader/Shader - SurfaceShader
12-1 프리넬 공식
소나무꼴
2020. 4. 4. 20:18
Shader "Custom/12-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
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
float3 viewDir;
};
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
//o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
o.Alpha = c.a;
float rim = dot(o.Normal, -IN.viewDir);
o.Emission = pow(1 - rim, 4);
}
ENDCG
}
FallBack "Diffuse"
}
구조체 Input
float3 viewDir
float4 oclor:COLOR
float4 screePos
float3 worldPos
float3 worldRef1
float3 worldNormal
float3 worldRef; INTERNAL_DATA
float3 worldNormal; INTERNAL_DATA