Hello Guest

Author Topic: Flashing white - inconsistent with Android  (Read 3401 times)

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Flashing white - inconsistent with Android
« on: December 06, 2013, 07:55:11 pm »
Hi there, I wanted to know if you had an explaination why this happens on certain android devices (only on several devices), and if you know of an effective fix to this:




All my materials using a shader I've made to flash white, tweaked from your basic shader, appear black and messed up.

Here is the shader
Code: [Select]
// unlit, vertex colour, alpha blended
// cull off

Shader "tk2d/BlendVertexColorWhite"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}

SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off Lighting Off Cull Off Fog { Mode Off } Blend SrcAlpha OneMinusSrcAlpha
LOD 110

Pass
{
CGPROGRAM
#pragma vertex vert_vct
#pragma fragment frag_mult
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"

sampler2D _MainTex;
float4 _MainTex_ST;

struct vin_vct
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};

struct v2f_vct
{
float4 vertex : POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};

v2f_vct vert_vct(vin_vct v)
{
v2f_vct o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
o.texcoord = v.texcoord;
return o;
}

fixed4 frag_mult(v2f_vct i) : COLOR
{
fixed4 col = tex2D(_MainTex, i.texcoord);
col.rgb += i.color.rgb;
col.a *= i.color.a;
return col;
}

ENDCG
}
}
 
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off Blend SrcAlpha OneMinusSrcAlpha Cull Off Fog { Mode Off }
LOD 100

BindChannels
{
Bind "Vertex", vertex
Bind "TexCoord", texcoord
Bind "Color", color
}

Pass
{
Lighting Off
SetTexture [_MainTex] { combine texture * primary }
}
}
}

If you don't find what could be wrong at first sight, please don't bother with this problem, as I know this problem has nothing to do with your product.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Flashing white - inconsistent with Android
« Reply #1 on: December 07, 2013, 03:12:27 pm »
I can't see anything that would cause this. My guess its a bug specific to the GLES implementation on the device. Both the texture & colour must not be bound properly for it to appear black if it is indeed drawing with this shader.

If you can reproduce it I recommend filing a bug report to Unity...