Hi,
i’m currently on port our first Unity game to iPad and i have some problems with my cg shader. On mac or pc all works fine, but iPad shows me all objects in black. Alpha works. Here is my shader:
Shader "Astroslugs/Custom Slugball" {
Properties {
_Color ("Main Color", Color) = (0.5,0.5,0.5,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_SlugColor ("Slugball Color", Color) = (1.0,0.0,0.0,1)
_SlugMask ("Slugball mask (A)", 2D) = "white" {}
_GlibberColor ("Glibber Color", Color) = (1.0,1.0,1.0,1)
_Glibber ("Glibber (RGB) Trans (A)", 2D) = "white" {}
_MaskRange ("Range", Range(0.0, 1.0)) = 1.0
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off
Alphatest Greater 0
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf BlinnPhong alpha
struct Input {
float4 color : COLOR;
float2 uv_MainTex;
float2 uv_SlugMask;
float2 uv_Glibber;
};
sampler2D _MainTex;
sampler2D _SlugMask;
sampler2D _Glibber;
float4 _Color;
float4 _Emission;
float4 _SlugColor;
float4 _GlibberColor;
float _MaskRange;
void surf (Input IN, inout SurfaceOutput o) {
o.Alpha = 1.0;
// MainTex
float4 MainTex = tex2D(_MainTex, IN.uv_MainTex).rgba;
float4 primary = (255,255,255,1)*3;
MainTex *= primary;
MainTex *= (_Color)*2;
float MainAlpha = tex2D(_MainTex, IN.uv_MainTex).a;
// SlugMask
float4 SlugTex = tex2D(_SlugMask, IN.uv_SlugMask).rgba;
_SlugColor *= primary*1.75;
SlugTex *= _SlugColor;
float SlugAlpha = tex2D(_SlugMask, IN.uv_SlugMask).a;
//Glitter
float4 GlitterTex = tex2D(_Glibber, IN.uv_Glibber).rgba;
GlitterTex *= primary * 2;
float GlitterAlpha = tex2D(_Glibber, IN.uv_Glibber).a;
//Output
float4 pass1 = lerp(MainTex, SlugTex, SlugAlpha * _MaskRange);
//float4 pass2 = lerp(pass1, GlitterTex, GlitterAlpha * _MaskRange);
o.Albedo = lerp(pass1, GlitterTex, GlitterAlpha * _MaskRange);
o.Alpha = MainTex.a + (SlugAlpha * _MaskRange) *_Color.w;
}
ENDCG
}
}
I have no idea what i’m doing wrong here. Can it be, iPad can’t handle #pragma surface surf stuff?
I hope you have any ideas, i’m stuck here.