- Home /
Shader works differently on Android (OpenGL) and Editor (DX11)
I wrote circular cutout sprite shader which works ok in editor & standalone version but behaves incorrectly on Android devices.
In essence it's simple pixel shader:
fixed4 frag(pixelData IN) : SV_Target
{
const float PI = 3.1415;
float angle = -atan2(IN.texcoord.x - 0.5, -IN.texcoord.y + 0.5) + PI;
if (angle < _Percent * 2 * PI) //_Percent is in range from 0 to 1
return tex2D(_MainTex, IN.texcoord) * IN.color;
else
return float4(1,1,1,0);
}
Rendering in editor (DX11 on DX9 GPU)
Screenshot from Android (OpenGL - Nexus 4)
As you can see in the middle there are pixels which should be red
I'm using Unity 5.0.0f4. Attaching zipped test project: ShaderTest.zip (30kB)
editor.png
(31.3 kB)
android.png
(49.6 kB)
Comment