Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by macs_yums · Jul 05, 2011 at 02:46 AM · androidshaderiphonegalaxy

Can not be compiled when running on Android for each texture shader 8 Galaxy Tab

Galaxy Tab shader work that follows. SnapDragon QSD8650 (1GHz) I work on Android, the I do not know why.

Why do not compile? Kindly let me know.

Shader "Unlit/MixTextures" { Properties { _MainTex ("Main Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex2 ("Main2 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex3 ("Main3 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex4 ("Main4 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex5 ("Main5 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex6 ("Main6 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex7 ("Main7 Base(RGB) Alpha(A)", 2D) = "white" {} // _MainTex8 ("Main8 Base(RGB) Alpha(A)", 2D) = "white" {}

   _TextureOffsetAndSize ("textureOffsetAndSize", Vector) = (0, 0, 0, 0)
   _TextureOffsetAndSize2 ("textureOffsetAndSize2", Vector) = (0, 0, 0, 0)
   _TextureOffsetAndSize3 ("textureOffsetAndSize3", Vector) = (0, 0, 0, 0)
   _TextureOffsetAndSize4 ("textureOffsetAndSize4", Vector) = (0, 0, 0, 0)
   _TextureOffsetAndSize5 ("textureOffsetAndSize5", Vector) = (0, 0, 0, 0)
   _TextureOffsetAndSize6 ("textureOffsetAndSize6", Vector) = (0, 0, 0, 0)
   _TextureOffsetAndSize7 ("textureOffsetAndSize7", Vector) = (0, 0, 0, 0)

// _TextureOffsetAndSize8 ("textureOffsetAndSize8", Vector) = (0, 0, 0, 0)

 }
 SubShader {
     Tags{"Queue"="Transparent"}
     Pass{
         // 顔ベース        
         CGPROGRAM
         //#pragma only_renderers gles
         //#pragma target 3.0
         #pragma vertex vert
         #pragma fragment frag
         #include "UnityCG.cginc"
         
         sampler2D _MainTex;
         sampler2D _MainTex2;
         sampler2D _MainTex3;
         sampler2D _MainTex4;
         sampler2D _MainTex5;
         sampler2D _MainTex6;
         sampler2D _MainTex7;
         sampler2D _MainTex8;
         
         float4 _TextureOffsetAndSize;
         float4 _TextureOffsetAndSize2;
         float4 _TextureOffsetAndSize3;
         float4 _TextureOffsetAndSize4;
         float4 _TextureOffsetAndSize5;
         float4 _TextureOffsetAndSize6;
         float4 _TextureOffsetAndSize7;
         float4 _TextureOffsetAndSize8;

                    
         struct v2f{
             float4 pos : SV_POSITION;
             float2 uv : TEXCOORD0;
         };
         
         float4 _MainTex_ST;
         
         v2f vert(appdata_base v)
         {
             v2f o;
             o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
             o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
             return o;
         }


         float4 frag( v2f i ) : COLOR {

             float2 defUV = i.uv;
             float2 maskUV = defUV;
             

             // 2
                maskUV.x += _TextureOffsetAndSize.x;
             maskUV.y += _TextureOffsetAndSize.y;
             maskUV.x /= _TextureOffsetAndSize.z;
             maskUV.y /= _TextureOffsetAndSize.w;
             
             float4 addTex = tex2D(_MainTex2, maskUV);
             float4 result = (tex2D(_MainTex, i.uv)*(1-addTex.w) + tex2D(_MainTex2, maskUV)*addTex.w);

             // 3                
                maskUV.x = (defUV.x + _TextureOffsetAndSize2.x)/_TextureOffsetAndSize2.z;
             maskUV.y = (defUV.y + _TextureOffsetAndSize2.y)/_TextureOffsetAndSize2.w;

             addTex = tex2D(_MainTex3, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;

             // 4
                maskUV.x = (defUV.x + _TextureOffsetAndSize3.x)/_TextureOffsetAndSize3.z;
             maskUV.y = (defUV.y + _TextureOffsetAndSize3.y)/_TextureOffsetAndSize3.w;

             addTex = tex2D(_MainTex4, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
             
             // 5
                maskUV.x = (defUV.x + _TextureOffsetAndSize4.x)/_TextureOffsetAndSize4.z;
             maskUV.y = (defUV.y + _TextureOffsetAndSize4.y)/_TextureOffsetAndSize4.w;

             addTex = tex2D(_MainTex5, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
             
             // 6
                maskUV.x = (defUV.x + _TextureOffsetAndSize5.x)/_TextureOffsetAndSize5.z;
             maskUV.y = (defUV.y + _TextureOffsetAndSize5.y)/_TextureOffsetAndSize5.w;

             addTex = tex2D(_MainTex6, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
             
             // 7
                maskUV.x = (defUV.x + _TextureOffsetAndSize6.x)/_TextureOffsetAndSize6.z;
             maskUV.y = (defUV.y + _TextureOffsetAndSize6.y)/_TextureOffsetAndSize6.w;

             addTex = tex2D(_MainTex7, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
             
             // 8
                maskUV.x = (defUV.x + _TextureOffsetAndSize7.x)/_TextureOffsetAndSize7.z;
             maskUV.y = (defUV.y + _TextureOffsetAndSize7.y)/_TextureOffsetAndSize7.w;

             addTex = tex2D(_MainTex8, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
             

             return result;
             
             //return (tex2D(_MainTex, i.uv)*(1-addTex.w) + tex2D(_MainTex2, maskUV)*addTex.w);
             // 
             //return half4(_TextureOffsetAndSize.x, _TextureOffsetAndSize.y, _TextureOffsetAndSize.z, 1);                // _TextureOffsetAndSize Output
             //return half4(i.uv.x, i.uv.y, 0, 1);                // uv Output
             //return half4(1, 0, 0, 0);
         }
                     
         ENDCG
     }
 } 
 //Fallback "Diffuse"

}

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Graham-Dunnett ♦♦ · Jul 05, 2011 at 09:27 AM 0
Share

Do you get any kind of error when you try to compile this shader?

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by macs_yums · Jul 05, 2011 at 12:26 PM

Has been successfully compiled and turn off the near the end. What will be compiled with Galaxy You can write a little more short shaders? I move that Xperia, which is purple and it appears in the Galaxy. Toka what I have restrictions on the number of fragment length or texture shaders? That's right texture, but it reduces the shader is shorter than think of it.

Shader "MixTextures" { Properties { _MainTex ("Main Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex2 ("Main2 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex3 ("Main3 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex4 ("Main4 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex5 ("Main5 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex6 ("Main6 Base(RGB) Alpha(A)", 2D) = "white" {} _MainTex7 ("Main7 Base(RGB) Alpha(A)", 2D) = "white" {}

   _TextureOffsetAndSize ("textureOffsetAndSize", Vector) = (0, 0, 0, 0)    _TextureOffsetAndSize2 ("textureOffsetAndSize2", Vector) = (0, 0, 0, 0)    _TextureOffsetAndSize3 ("textureOffsetAndSize3", Vector) = (0, 0, 0, 0)    _TextureOffsetAndSize4 ("textureOffsetAndSize4", Vector) = (0, 0, 0, 0)    _TextureOffsetAndSize5 ("textureOffsetAndSize5", Vector) = (0, 0, 0, 0)    _TextureOffsetAndSize6 ("textureOffsetAndSize6", Vector) = (0, 0, 0, 0)    _TextureOffsetAndSize7 ("textureOffsetAndSize7", Vector) = (0, 0, 0, 0) } SubShader { Tags{"Queue"="Transparent"} Pass{ CGPROGRAM //#pragma only_renderers gles //#pragma target 3.0 #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc"

         sampler2D _MainTex;
         sampler2D _MainTex2;
         sampler2D _MainTex3;
         sampler2D _MainTex4;
         sampler2D _MainTex5;
         sampler2D _MainTex6;
         sampler2D _MainTex7;
         sampler2D _MainTex8;
         
         float4 _TextureOffsetAndSize;
         float4 _TextureOffsetAndSize2;
         float4 _TextureOffsetAndSize3;
         float4 _TextureOffsetAndSize4;
         float4 _TextureOffsetAndSize5;
         float4 _TextureOffsetAndSize6;
         float4 _TextureOffsetAndSize7;
         float4 _TextureOffsetAndSize8;
                 
         struct v2f{
             float4 pos : SV_POSITION;
             float2 uv : TEXCOORD0;
         };
         
         float4 _MainTex_ST;
         
         v2f vert(appdata_base v)
         {
             v2f o;
             o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
             o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
             return o;
         }


         float4 frag( v2f i ) : COLOR {
         float2 defUV = i.uv;
         float2 maskUV = defUV;
             
             // 2
                maskUV = (defUV + _TextureOffsetAndSize.xy)/_TextureOffsetAndSize.zw;
             float4 addTex = tex2D(_MainTex2, maskUV);
             float4 result = (float4(1.0f, 0.84f, 0.72f, 1.0f)*(1-addTex.w) + addTex * addTex.w);
             // 3                
                maskUV = (defUV + _TextureOffsetAndSize2.xy)/_TextureOffsetAndSize2.zw;
             addTex = tex2D(_MainTex3, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
         // 4
                maskUV = (defUV + _TextureOffsetAndSize3.xy)/_TextureOffsetAndSize3.zw;
             addTex = tex2D(_MainTex4, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
         // 5
                maskUV = (defUV + _TextureOffsetAndSize4.xy)/_TextureOffsetAndSize4.zw;
             addTex = tex2D(_MainTex5, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
         // 6
                maskUV = (defUV + _TextureOffsetAndSize5.xy)/_TextureOffsetAndSize5.zw;
             addTex = tex2D(_MainTex6, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
         // 7
                maskUV = (defUV + _TextureOffsetAndSize6.xy)/_TextureOffsetAndSize6.zw;
             addTex = tex2D(_MainTex7, maskUV);
             result = result*(1-addTex.w)+ addTex*addTex.w;
         // 8

// maskUV = (defUV + _TextureOffsetAndSize7.xy)/_TextureOffsetAndSize7.zw; //     addTex = tex2D(_MainTex8, maskUV); // result = result*(1-addTex.w)+ addTex*addTex.w; return result; }

         ENDCG
     }
 } 
 //Fallback "Diffuse"

}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by macs_yums · Jul 05, 2011 at 12:29 PM

Sorry, miss type.

Has been successfully compiled and turn off the near the end. What will be compiled with Galaxy You can write a little more short shaders? Appear normal but that Xperia, which is purple and it appears in the Galaxy. Why not have a limit on the number of fragment length or texture shaders? That's right texture, but it reduces the shader is shorter than think of it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by macs_yums · Jul 05, 2011 at 03:30 PM

This happened because that is not the first set of eight texture. I think the behavior is different when it happens to fetch a texture that is not set in the Galaxy and the Xperia. Was rude.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Transparent material on iPhone Android 3 Answers

Deploying to Android or iPhone device - track public variables in inspector? 1 Answer

Specular Materials on iPhone or Android? 1 Answer

Wand Magic Tool 0 Answers

Simultaneous Android and iOS development 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges