Shader 
  "VPaint/Lit/Blend 5 Bumped Textures" {
    Properties {
        _BaseTexture ("Base Texture (RGB: Diffuse) (A: Spec)", 2D) = "white" {}
        _BaseTextureBump ("Base Texture Bump", 2D) = "bump" {}
       
        _Texture1 ("Texture 1 (RGB: Red Channel) (A: Spec)", 2D) = "white" {}
        _Texture1Bump ("Texture 1 Bump", 2D) = "bump" {}
       
        _Texture2 ("Texture 2 (RGB: Blue Channel) (A: Spec)", 2D) = "white" {}
        _Texture2Bump ("Texture 2 Bump", 2D) = "bump" {}
       
        _Texture3 ("Texture 3 (RGB: Green Channel) (A: Spec)", 2D) = "white" {}
        _Texture3Bump ("Texture 3 Bump", 2D) = "bump" {}
       
        _Texture4 ("Texture 4 (RGB: Alpha Channel) (A: Spec)", 2D) = "white" {}
        _Texture4Bump ("Texture 4 Bump", 2D) = "bump" {}
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200
       
        CGPROGRAM
        #pragma surface surf Lambert
        #pragma target 3.0

        sampler2D _BaseTexture;
        sampler2D _BaseTextureBump;
       
        sampler2D _Texture1;
        sampler2D _Texture1Bump;
       
        sampler2D _Texture2;
        sampler2D _Texture2Bump;

        sampler2D _Texture3;
        sampler2D _Texture3Bump;
       
        sampler2D _Texture4;
        sampler2D _Texture4Bump;

        struct Input {
            half2 uv_BaseTexture;
            half2 uv_Texture1;         
            half2 uv_Texture2;         
            half2 uv_Texture3;         
            half2 uv_Texture4;
           
            float4 color : COLOR;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            float4 color = IN.color;
           
            half4 t0 = tex2D (_BaseTexture, IN.uv_BaseTexture);
            half4 t0b = tex2D (_BaseTextureBump, IN.uv_BaseTexture);
           
            half4 t1 = tex2D (_Texture1, IN.uv_Texture1);
            half4 t2 = tex2D (_Texture2, IN.uv_Texture2);
            half4 t3 = tex2D (_Texture3, IN.uv_Texture3);
            half4 t4 = tex2D (_Texture4, IN.uv_Texture4);
           
            half4 t1b = tex2D (_Texture1Bump, IN.uv_Texture1);
            half4 t2b = tex2D (_Texture2Bump, IN.uv_Texture2);
            half4 t3b = tex2D (_Texture3Bump, IN.uv_Texture3);
            half4 t4b = tex2D (_Texture4Bump, IN.uv_Texture4);
           
            half4 cum = t1 * color.r + t2 * color.g + t3 * color.b + t4 * color.a;
            half4 nrm = t1b * color.r + t2b * color.g + t3b * color.b + t4b * color.a;
            fixed fac = color.r + color.g + color.b + color.a;
           
            if(fac != 0)
            {
                cum /= fac;
                nrm /= fac;
            }
            cum = lerp(t0, cum, fac);
           
            o.Albedo = cum.rgb;
            o.Specular = cum.a;
            o.Normal = lerp(UnpackNormal(t0b), UnpackNormal(nrm), fac);
        }
        ENDCG
    }
    FallBack "Diffuse"
} 
 5 texture blend + normal and spec

add vertex color empty

셰이더 'VPaint/Lit/Blend 5 Bumped Textures' {
    속성 {
        _BaseTexture ("기본 텍스처(RGB: 확산) (A: 사양)", 2D) = "흰색"{}
        _BaseTextureBump ("기본 텍스처 범프", 2D) = "범프" {}
       
        _Texture1 ("텍스처 1 (RGB: 빨간색 채널) (A: 사양)", 2D) = "흰색"{}
        _Texture1Bump ("텍스처 1 범프", 2D) = "범프" {}
       
        _Texture2 ("텍스처 2 (RGB: 파란색 채널) (A: 사양)", 2D) = "흰색"{}
        _Texture2Bump ("텍스처 2 범프", 2D) = "범프" {}
       
        _Texture3 ("텍스처 3(RGB: 녹색 채널) (A: 사양)", 2D) = "흰색"{}
        _Texture3Bump ("텍스처 3 범프", 2D) = "범프" {}
       
        _Texture4 ("텍스처 4 (RGB: 알파 채널) (A: 사양)", 2D) = "흰색"{}
        _Texture4Bump ("텍스처 4 범프", 2D) = "범프" {}
     }
    서브셰이더 {
        태그 { "RenderType"="Opaque" }
        LOD 200
       
        CGPROGRAM
         #프라그마 서피스 서프 램버트
         #pragma 타겟 3.0

        Sampler2D _BaseTexture;
        Sampler2D _BaseTextureBump;
       
        샘플러2D _Texture1;
        Sampler2D _Texture1Bump;
       
        샘플러2D _Texture2;
        Sampler2D _Texture2Bump;

        샘플러2D _Texture3;
        Sampler2D _Texture3Bump;
       
        샘플러2D _Texture4;
        Sampler2D _Texture4Bump;

         구조체 입력 {
            half2 uv_BaseTexture;
            half2 uv_Texture1;         
            half2 uv_Texture2;         
            half2 uv_Texture3;         
            half2 uv_Texture4;
           
            float4 색상 : 색상;
         };

         void surf (입력 IN, inout SurfaceOutput o) {
            float4 색상 = IN.color;
           
            half4 t0 = tex2D (_BaseTexture, IN.uv_BaseTexture);
            half4 t0b = tex2D (_BaseTextureBump, IN.uv_BaseTexture);
           
            half4 t1 = tex2D (_Texture1, IN.uv_Texture1);
            half4 t2 = tex2D (_Texture2, IN.uv_Texture2);
            half4 t3 = tex2D (_Texture3, IN.uv_Texture3);
            half4 t4 = tex2D (_Texture4, IN.uv_Texture4);
           
            half4 t1b = tex2D (_Texture1Bump, IN.uv_Texture1);
            half4 t2b = tex2D (_Texture2Bump, IN.uv_Texture2);
            half4 t3b = tex2D (_Texture3Bump, IN.uv_Texture3);
            half4 t4b = tex2D (_Texture4Bump, IN.uv_Texture4);
           
            half4 cum = t1 * color.r + t2 * color.g + t3 * color.b + t4 * color.a;
            half4 nrm = t1b * color.r + t2b * color.g + t3b * color.b + t4b * color.a;
             고정 fac = color.r + color.g + color.b + color.a;
           
             if(fac != 0)
             {
                정액 /= fac;
                nmm /= fac;
             }
            정액 = lerp(t0, 정액, fac);
           
            o.알베도==cum.rgb;
            o.Specular==cum.a;
            o.Normal = lerp(UnpackNormal(t0b), UnpackNormal(nrm), fac);
         }
        ENDCG
     }
    대체 '확산'
} 
//5가지 텍스처 혼합 + 일반 및 사양
//정점 색상을 비워 추가하세요.

셰이더 "VPaint/Lit/Blend 5 범프 텍스처" { 속성 { _BaseTexture("기본 텍스처(RGB: 확산)(A: 사양)", 2D) = "흰색" {} _BaseTextureBump("기본 텍스처 범프", 2D) = "범프" {} _Texture1 ("텍스처 1 (RGB: 빨간색 채널) (A: 사양)", 2D) = "흰색" {} _Texture1Bump("텍스처 1 범프", 2D) = "범프" {} _Texture2("텍스처 2(RGB: 파란색 채널)(A: 사양)", 2D) = "흰색" {} _Texture2Bump("텍스처 2 범프", 2D) = "범프" {} _Texture3 ("텍스처 3 (RGB: 녹색 채널) (A: 사양)", 2D) = "흰색" {} _Texture3Bump("텍스처 3 범프", 2D) = "범프" {} _Texture4("텍스처 4(RGB: 알파 채널)(A: 사양)", 2D) = "흰색" {} _Texture4Bump("텍스처 4 범프", 2D) = "범프" {} } 서브셰이더 { 태그 { "RenderType"="불투명" } LOD 200 CGPROGRAM #프라그마 서피스 서프 램버트 #pragma 타겟 3.0 Sampler2D _BaseTexture; Sampler2D _BaseTextureBump; 샘플러2D _Texture1; Sampler2D _Texture1Bump; 샘플러2D _Texture2; Sampler2D _Texture2Bump; 샘플러2D _Texture3; Sampler2D _Texture3Bump; 샘플러2D _Texture4; Sampler2D _Texture4Bump; 구조체 입력 { half2 uv_BaseTexture; half2 uv_Texture1; half2 uv_Texture2; half2 uv_Texture3; half2 uv_Texture4; float4 색상 : 색상; }; void Surf (입력 IN, inout SurfaceOutput o) { float4 color = IN.color; half4 t0 = tex2D (_BaseTexture, IN.uv_BaseTexture); half4 t0b = tex2D (_BaseTextureBump, IN.uv_BaseTexture); half4 t1 = tex2D (_Texture1, IN.uv_Texture1); half4 t2 = tex2D (_Texture2, IN.uv_Texture2); half4 t3 = tex2D (_Texture3, IN.uv_Texture3); half4 t4 = tex2D (_Texture4, IN.uv_Texture4); half4 t1b = tex2D (_Texture1Bump, IN.uv_Texture1); half4 t2b = tex2D (_Texture2Bump, IN.uv_Texture2); half4 t3b = tex2D (_Texture3Bump, IN.uv_Texture3); half4 t4b = tex2D (_Texture4Bump, IN.uv_Texture4); half4 cum = t1 * color.r + t2 * color.g + t3 * color.b + t4 * color.a; half4 nrm = t1b * color.r + t2b * color.g + t3b * color.b + t4b * color.a; 고정 fac = color.r + color.g + color.b + color.a; if(fac != 0) { 정액 /= 팩; nrm /= fac; } 정액 = lerp(t0, 정액, fac); o.알베도 = cum.rgb; o.Specular = cum.a; o.Normal = lerp(UnpackNormal(t0b), UnpackNormal(nrm), fac); } ENDCG } 대체 "확산" } 5가지 텍스처 블렌드 + 노멀 및 스펙 정점 색상을 비워 추가하세요. 셰이더 'VPaint/Lit/Blend 5 Bumped Textures' { 속성 { _BaseTexture ("기본 분할(RGB: 확장) (A: 부품)", 2D) = "흰색"{} _BaseTextureBump ("기본 범프", 2D) = "범프" {} _Texture1 ("텍스처 1 (RGB: 그림 채널) (A: 부품)", 2D) = "흰색"{} _Texture1Bump ("텍스처 1 범프", 2D) = "범프" {} _Texture2 ("텍스처 2 (RGB: 블루 채널) (A: 부품)", 2D) = "흰색"{} _Texture2Bump ("텍스처 2 범프", 2D) = "범프" {} _Texture3 ("텍스처 3(RGB: 녹색 채널) (A: 부품)", 2D) = "흰색"{} _Texture3Bump ("텍스처 3 범프", 2D) = "범프" {} _Texture4 ("텍스처 4 (RGB: 알파 채널) (A: 부품)", 2D) = "흰색"{} _Texture4Bump ("텍스처 4 범프", 2D) = "범프" {} } 서브셰이더 { 태그 { "RenderType"="불투명" } LOD 200 CGPROGRAM #프라그마 서피스 서프 램버트 #pragma 뻐 3.0 Sampler2D _BaseTexture; Sampler2D _BaseTextureBump; 샘플러2D _Texture1; Sampler2D _Texture1Bump; 샘플러2D _Texture2; Sampler2D _Texture2Bump; 샘플러2D _Texture3; Sampler2D _Texture3Bump; 샘플러2D _Texture4; Sampler2D _Texture4Bump; 내장 { half2 uv_BaseTexture; half2 uv_Texture1; half2 uv_Texture2; half2 uv_Texture3; half2 uv_Texture4; float4 색상 : 색상; }; void Surf (입력 IN, inout SurfaceOutput o) { float4 색상 = IN.color; half4 t0 = tex2D (_BaseTexture, IN.uv_BaseTexture); half4 t0b = tex2D (_BaseTextureBump, IN.uv_BaseTexture); half4 t1 = tex2D (_Texture1, IN.uv_Texture1); half4 t2 = tex2D (_Texture2, IN.uv_Texture2); half4 t3 = tex2D (_Texture3, IN.uv_Texture3); half4 t4 = tex2D (_Texture4, IN.uv_Texture4); half4 t1b = tex2D (_Texture1Bump, IN.uv_Texture1); half4 t2b = tex2D (_Texture2Bump, IN.uv_Texture2); half4 t3b = tex2D (_Texture3Bump, IN.uv_Texture3); half4 t4b = tex2D (_Texture4Bump, IN.uv_Texture4); half4 cum = t1 * color.r + t2 * color.g + t3 * color.b + t4 * color.a; half4 nrm = t1b * color.r + t2b * color.g + t3b * color.b + t4b * color.a; 고정 fac = color.r + color.g + color.b + color.a; if(fac != 0) { 정액 /= fac; nmm /= fac; } 정액 = lerp(t0, 정액, fac); o.알베도==cum.rgb; o.Specular==cum.a; o.Normal = lerp(UnpackNormal(t0b), UnpackNormal(nrm), fac); } ENDCG } 대체 '확산' } //5가지 부품 구성 + 일반 및 구성 //정점 색상을 비워 추가하세요.
 

'Shader > Surface' 카테고리의 다른 글

Surface Shader Custom Lighting 언릿 설정  (0) 2014.07.31
Blend 4 Bumped Textures  (0) 2014.07.29
Blend 5 Textures  (0) 2014.07.29

다른 카테고리의 글 목록