Shader "Yee/AnisotropicSpec" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
[Normal]_Normal("Normal", 2D) = "bump"{}
_NormalPow("NormalPow", Range(0, 3)) = 1
_AnisoAngleX("AnisoAngle", float) = 0
_AnisoAngleY("AnisoAngle", float) = 0
_AnisoAngleZ("AnisoAngle", float) = 0
_AnisoOffset("AnisoOffset", Range(-1, 1)) = -0.2
[powslide(100)]_AnisoPow("AnisoPow", Range(1, 100)) = 1
[HDR]_SpecColor2("SpecColor2", Color) = (1, 1, 1, 1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
cull off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf NoLighting fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _Normal;
struct Input {
float2 uv_MainTex;
float2 uv_Normal;
};
fixed4 _Color;
half _NormalPow;
half _AnisoAngleX;
half _AnisoAngleY;
half _AnisoAngleZ;
half _AnisoOffset;
half _AnisoPow;
half3 _SpecColor2;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutput o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Normal = lerp(o.Normal, UnpackNormal(tex2D(_Normal, IN.uv_Normal)), _NormalPow);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
//์ด๋ฐฉ์ฑ ํ์ด๋ผ์ดํธ ๊ณ์ฐ
fixed4 LightingNoLighting(SurfaceOutput s, fixed3 lightDir, fixed3 viewDir, fixed atten)
{
fixed4 c;
fixed3 h = normalize(normalize(lightDir) + normalize(viewDir)); //๋ผ์ดํธ๊ฐ๋, ๋ทฐ๊ฐ๋ ๋ ธ๋ฉ๋ผ์ด์ฆ
//half NdotL = saturate(dot(s.Normal, lightDir)); //S๋ ธ๋ฉ, ๋ผ์ดํธ ๊ฐ๋ ๋ด์
half HdotA = dot(normalize(s.Normal + half3(_AnisoAngleX, _AnisoAngleY, _AnisoAngleZ)), h); //๋ ธ๋ฉ + ์ปค์คํ ์ต๊ธ์ ๋ผ์ดํธ, ๋ทฐ๊ฐ๋๋ ธ๋ฉ๋ผ์ด์ฆ์ ๋ด์
half aniso = max(0, sin(radians(HdotA + _AnisoOffset) * 180));
c.rgb = saturate(pow(aniso, _AnisoPow)) * _SpecColor2;
//c.rgb = s.Albedo;
c.a = s.Alpha;
return c;
}
ENDCG
}
FallBack "Diffuse"
}
๋จธ๋ฆฌ์นด๋ฝ์์ ๋ง์ด ์ฌ์ฉ๋๋ ์ด๋ฐฉ์ฑ ์คํํ๋ฌ ์์ด๋์ ๋๋ค.
์ฐธ๊ณ ํ์ค๋ถ์ ์ฐธ๊ณ ํ์๊ธธ.....
๋ถ๊ดด3๋ ๋จธ๋ฆฌ์นด๋ฝ ํ์ด๋ผ์ดํธ ์ด๋ ๊ฒ ์ฒ๋ฆฌํ์ต๋๋ค.
์ํ ๊ณ์ฐ์์ ๊ท์ฐฎ์์ ์๋ฃ์๋๋ฐ ์ถ๊ฐํด์ ๋ฃ์ผ์๋ฉด ๋ ๊ฒ ๊ฐ๋ค์ =_=a
(์ํ ํ ์ค์ณ๊ฐ ์์์.... ์ฟจ๋ญ)
์ฐธ๊ณ ๋ก ์ ๋ํฐ HDRP์์๋ถํฐ๋ ๊ธฐ๋ณธ ์ ๊ณต์ธ๊ฑด ํจ์ ..... ใ
NdotL์ ์ด๋ฐ์ฐ๋๊ฑฐ ๊ณ์ฐํด๋๊ณ ์์ฐ๋๋ฐ
์ ๊ทธ๋ฌ๋ค์. ๋ํจ์ฆ ๊ณ์ฐ ํ ๋ ค๊ณ ๋ฃ์ด๋์๊ฑด๋ฐ ๊น๋ฐํ๋ฏ....
๋จธ๋ฆฌ์นด๋ฝ ์กธ๋ผ ์ด์๋ค...
์ด์ด๋ ๋ชจ๋ธ๋ง์ ์ด์ผ๋ฐฐ์ฐ์ จ๋์ ๋๋ฌด ์ค๊ณ ์ดํ์ญ๋๋ค ๊ธฐ์ ๊ณผ ์์ ์ ๊ฒธํ์ ง๋ค - dc App