열차 목업의 내부 확인용 프로젝트
smchoi
2024-06-14 23cbbc76b6204691dd06f93f2108993f9ca79020
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Shader "Custom/MirrorBumpMap"
{
    Properties
    {
         _MainTex ("Emissive Texture", 2D) = "black" {}
        _DetailTex ("Detail Texture", 2D) = "white" {}
        _BumpMap ("Bump Map Texture", 2D) = "bumpmap" {}
        _Color ("Detail Tint Color", Color) = (1,1,1,1)
        _SpecColor ("Specular Color", Color) = (1,1,1,1)
        _SpecularArea ("Specular Area", Range (0, 0.99)) = 0.1
        _SpecularIntensity ("Specular Intensity", Range (0, 1)) = 0.75
        _ReflectionColor ("Reflection Tint Color", Color) = (1,1,1,1)
    }
    SubShader
    { 
        Tags { "RenderType"="Opaque"}
        LOD 300
     
        CGPROGRAM
 
        #pragma surface surf BlinnPhong
        #pragma multi_compile __ MIRROR_RECURSION
        #include "UnityCG.cginc"
  
        fixed4 _Color;
        fixed4 _ReflectionColor;
        half _SpecularArea;
        half _SpecularIntensity;
        sampler2D _MainTex;
        sampler2D _DetailTex;
        sampler2D _BumpMap;
  
        struct Input
        {
            float2 uv_DetailTex;
            float2 uv_BumpMap;
            float4 screenPos;
        };
 
        void surf (Input IN, inout SurfaceOutput o)
        {
            fixed4 detail = tex2D(_DetailTex, IN.uv_DetailTex);
 
            #if MIRROR_RECURSION
 
            fixed4 refl = tex2D(_MainTex, IN.uv_DetailTex);
 
            #else
 
            IN.screenPos.w = max(0.001, IN.screenPos.w);
            fixed4 refl = tex2Dproj(_MainTex, UNITY_PROJ_COORD(IN.screenPos));
 
            #endif
 
            o.Albedo = detail.rgb * _Color.rgb;
            o.Alpha = 1;
            o.Specular = 1.0f - _SpecularArea;
            o.Gloss = _SpecularIntensity;
            o.Emission = refl.rgb * _ReflectionColor.rgb;
            o.Normal = UnpackNormal(tex2D (_BumpMap, IN.uv_BumpMap));
        }
 
        ENDCG
    }
 
    FallBack "Reflective/Specular"
}