2017-12-22 11 views
1

맞춤 셰이더가 있는데 내 휴대 기기에서는 작동하지 않지만 PC에서는 작동합니다. 모바일 장치에서 작동하도록 변환하려면 어떻게합니까?휴대 전화에서 맞춤 셰이더가 작동하지 않습니다 (Unity)

enter image description here

이는 모습입니다 :

이 내 PC에 모습입니다 : 셰이더에 대한

Shader "vertexPainter/DiffuseNormalSpec_2tex_mask" { 
    Properties { 
    _Color ("Main Color", Color) = (1,1,1,1) 
    _MainTex1 ("Base 1 (RGBA)", 2D) = "white" {} 
    _BumpMap1 ("Bumpmap 1 (RGB)", 2D) = "bump" {} 

    _MainTex2 ("Base 2 (RGB)", 2D) ="black" {} 
    _BumpMap2 ("Bumpmap 2 (RGB)", 2D) = "bump" {} 
    _BlendMask ("Blend Mask", 2D) = "white" {} 

    _Shininess("shininess", Range(0,0.8)) = 0.1 
    _SpecColor("spec color", Color) = (0,0,0,0) 
    _BlendSoft("Blend Softness", Range(0,0.8)) = 0.1 
    _B_Normal("B Normal", Range(0,0.8)) = 0.1 
    } 
    SubShader { 
    Tags { "RenderType"="Opaque" } 
    LOD 600 

    CGPROGRAM 
    #pragma surface surf BlinnPhong vertex:vert 
    #pragma target 3.0 
    struct Input { 
    float2 uv_MainTex1 : TEXCOORD0; 
    float2 uv2_BlendMask : TEXCOORD1; 
    float4 color : COLOR; 
    }; 
    void vert (inout appdata_full v, out Input o) { 
    UNITY_INITIALIZE_OUTPUT(Input,o); 
    o.color = (v.color); 
    } 
    uniform sampler2D _MainTex1, _MainTex2, _BlendMask; 
    uniform sampler2D _BumpMap1, _BumpMap2; 
    half3 _SelfIllum; 
    half _BlendSoft, _B_Normal; 
    fixed _Shininess; 
    void surf (Input IN, inout SurfaceOutput o) { 

    half4 base = tex2D(_MainTex1, IN.uv_MainTex1); 
    half4 blend1 = tex2D(_MainTex2, IN.uv_MainTex1); 

    half4 blendmask = tex2D(_BlendMask, IN.uv2_BlendMask); 
    half transformed = ((1 - IN.color.g) - blendmask.r)/_BlendSoft; 

    half mask = saturate(transformed); 
    half4 finresult = lerp(blend1, base, mask); 
    half specresultg = lerp(blend1.a, base.a, mask); 

    half3 g_normal = UnpackNormal(tex2D(_BumpMap2, IN.uv_MainTex1)); 
    g_normal *= 1-(blendmask.b * _B_Normal); 
    half3 r_normal = UnpackNormal(tex2D(_BumpMap1, IN.uv_MainTex1)); 
    half3 norresultg = lerp(g_normal, r_normal, mask); 

    o.Albedo = finresult.rgb; 
    o.Normal = norresultg; 
    o.Alpha = 1; 
    o.Specular = _Shininess; 
    o.Gloss = specresultg * _SpecColor; 
    } 
    ENDCG 
    } 

    FallBack "Diffuse" 
} 

스크린 샷 :

다음

내 코드입니다 내 휴대 전화에서보기 :

enter image description here

사양

PC : OS : 윈도우 10 프로 64 비트 프로세서 : 인텔 (R) 코어 (TM) 3.40 GHz의 (8CPUs) @ i7-6700 CPU, ~ 3.4GHz로 메모리 : 16,384 MB RAM 그래픽 카드 : NVIDIA 지포스 GTX 960

전화 : 삼성 갤럭시 S7하지만 지금 내가 에뮬레이터 (Bluestack)

+0

당신의 장치에 몇 가지 오류를주고 있는지 확인하기 위해 ADB 로그 캣으로 확인할 수 있습니다 도움이되기를 바랍니다 : https://answers.unity.com/questions/492681/how-to-use-adb-logcat .html – mgear

답변

0

이동 설정을 사용하고 -> 그래픽, 및 그늘을 추가 당신은 "항상 포함 된 셰이더"목록에 필요합니다.

그것이

관련 문제