- Home /
grayscale shader on iOS turns black
hey everyone,
i've got a bit of a shader problem. Since i have no experience with shader-coding (or programing in general), i hope someone will be able to help me here.
It's a simple grayscale shader, I got the code somewhere off the internet. Nothing special.It's applied to a material and everything's regular. The material is applied to a sprite.
<- with default sprite shader <- on PC <- on iOS
Now on mac, or win, everythings normal and how it should be. Grayscaled. On my iPad otherwise, it's just black. pure evil. I have no idea why. Here's the shader-code.
Shader "GrayscaleLolTransparent" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_EffectAmount ("Effect Amount", Range (0, 1)) = 1.0
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
uniform float _EffectAmount;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = lerp(c.rgb, dot(c.rgb, float3(0.3, 0.6, 0.2)), _EffectAmount);
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
I haven't found anything in the search function. Just hints, that it may be because of some GLES shader stuff... I don't know.
Any help?
Thanks in advance!
cheers
Thanks! I've ended up writing a similar shader, it is not as hard as I thought :)
Answer by shellyalon · Apr 22, 2014 at 01:42 PM
yes. i used this code. http://forum.unity3d.com/threads/222693-Sprite-Shader-with-GreyScale
Your answer
Follow this Question
Related Questions
Sprite Grayscale Shader Filter Overlap 0 Answers
Graphics.DrawTexture with Shader not working on iOS? 1 Answer
GrayScale shader with Lightning support and Transparency support, iOS 0 Answers
Help with broken UI on export 1 Answer
Multiple tex2D commands in fragment shader needed, is there a workaround? 0 Answers