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 /
  • Help Room /
avatar image
0
Question by xuwen123kuan · Jul 12, 2017 at 03:16 AM · surface shader

(NGUI) display a charactor with a surface shader , on Android platform some mobile phone will shake the screen

there is a part of the surface shader,please help me find issue in this shader that create this question !!

Shader "ActionX/Actor" { Properties { //主纹理 _MainTex ("Base (RGB)", 2D) = "white" {} //主颜色(用于发色) _MainColor ("Main Color", Color) = (1,1,1,1) //纹理颜色置灰 [MaterialToggle] _ToGray ("ToGray", Float) = 0 //开启纹理叠加 [MaterialToggle] _OpenTO ("OpenTO", Float) = 0 //叠加的纹理 _TextureOverlay ("Texture Overlay", 2D) = "black" {} //开启颜色叠加(用于虚化) [MaterialToggle] _OpenCO ("OpenCO", Float) = 0 //叠加的颜色(用于虚化) _ColorOverlay ("Color Overlay", Color) = (1,1,1,1) //叠加的百分比值(用于虚化) _OverlayValue ("Overlay Value", Range(0,1)) = 0 //开启发光 [MaterialToggle] _OpenRI ("OpenRI", Float) = 0 //外发光颜色 _RimColor ("Rim Color", Color) = (0.5,0.5,0.5,0.5) //内发光颜色 _InnerColor ("Inner Color", Color) = (0.5,0.5,0.5,0.5) //发光强度 _Power ("Power(0-10)", Range(0,2)) = 2 //环境光颜色 _AmbientColor ("Ambient Color", Color) = (0.509,0.509,0.509,1) [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 } SubShader { Tags { "RenderType"="Opaque" "LightMode"="Always" } LOD 200

 CGPROGRAM
 #pragma surface surf Lambert

 sampler2D _MainTex;
 fixed4 _MainColor;

 half _ToGray;

 half _OpenTO;
 uniform sampler2D _TextureOverlay;uniform fixed4 _TextureOverlay_ST;

 half _OpenCO;
 fixed4 _ColorOverlay;
 half _OverlayValue;

 half _OpenRI;
 fixed4 _RimColor;
 fixed4 _InnerColor;
 half _Power;

 fixed4 _AmbientColor;

 struct Input {
     half3 viewDir;
     half2 uv_MainTex;
 };

 void surf (Input IN, inout SurfaceOutput o) {
     fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
     if (_ToGray > 0.6)
     {
         c.rgb = c.r * 0.299 + c.g * 0.587 + c.b * 0.114;
     }
     o.Albedo = c.rgb * _MainColor * (1 - c.a) + c.rgb * c.a;
     if (_OpenTO > 0.6)
     {
         fixed4 t = tex2D(_TextureOverlay, TRANSFORM_TEX(IN.uv_MainTex, _TextureOverlay));
         o.Albedo = saturate(max(c.rgb, t.rgb));
     }
     o.Albedo = o.Albedo * _AmbientColor * 2;
     if (_OpenCO > 0.6)
     {
         o.Albedo = o.Albedo + (_ColorOverlay * _OverlayValue);
     }
     else
     {
         if (_OpenRI > 0.6)
         {
             half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
             half power = pow (rim, _Power);
             o.Emission = (_RimColor.rgb + _InnerColor.rgb * 2) * power;
         }
     }
 }
 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 xuwen123kuan · Jul 12, 2017 at 03:23 AM 0
Share

Shake the screen : when I Open a UI with a charator the screen will repeat open /close ui , only some moblie phone will show this

0 Replies

· Add your reply
  • Sort: 

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

109 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

color array in Unity Surface Shader causing weird aliasing 0 Answers

How to add correct shadows in vertex deforming shader 0 Answers

Need help with Lightmapping and Surface shader 0 Answers

Realtime GI per vertex in surface shader 0 Answers

Fragment shader shows alpha, surface shader doesn't 0 Answers


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