Which part of this shader is incompatible with 1st Gen IPod?

I have a shader which works fine in the editor, but returns pure black on a 1st generation iPod Touch.

It’s not an intricate shader, and I’m curious if anyone knows which parts are incompatible.

Shader " Vertex Colored" {

Properties {
	_AlphaTest ("Alpha Test", Range (0.0, 1)) = 0.2
    _Color ("Main Color", Color) = (1,1,1,1)
    _Emission ("Emmisive Color", Color) = (0,0,0,0)
    _MainTex ("Base (RGB)", 2D) = "white" {}
}

Category {
    Lighting On
    Cull Back
	Alphatest Greater [_AlphaTest]
    Blend SrcAlpha OneMinusSrcAlpha
	Tags {"Queue"="Transparent-1"}
	SubShader {
		Pass {
			Material {
				Emission [_Emission]   
			}
			ColorMaterial AmbientAndDiffuse
			Lighting On
			SeperateSpecular On
			SetTexture [_MainTex] {
				Combine texture * primary, texture * primary
			}
			SetTexture [_MainTex] {
				constantColor [_Color]
				Combine previous * constant DOUBLE, previous * constant
			}
		}
    }
}
}

Also if anyone has a good shader for Single Sided Depth tested unlit Sprites I would be interested as well, as this is somewhat of a frankenstein of multiple shaders on the Unify Wiki and could probably be greatly improved.

So I’ve ruled out the AlphaTesting, and I am checking to see if loading it through the resources folder could be the issue.

It’s odd because I thought I had it working earlier and I only changed the AlphaTesting.

I have no problem with the cleaned-up version of the shader you can find in the .unitypackage below. All you need to do is supply an RGBA texture onto the sphere in the scene; I’d like to hear your result with that.

SeperateSpecular On does not work on any iDevice. (Not that it matters. It’s worthless in the shader you posted.)

Clutter:
You used “Lighting On” twice.
Category is unecessary unless you have multiple subshaders.
Cull Back works, but is the default, and therefore unecessary.
You don’t need to write the same thing (texture * primary) for the alpha channel calculation as for the RGB channels. If you don’t specify something for alpha, the texture combiner calculation is for all four channels.
You don’t need to use the name of a texture in a SetTexture command. However, you need something in the brackets. I use an underscore, but do what you like. I just find it helpful to see at a glance that no texture is being used in the stage.

Also, is there any reason you really need “Main Color”? If you just use vertex colors, you can save a texture stage, making it slightly more efficient. If there’s a possibility of batching happening, it could be worth your while to do this (as long as all the meshes could share “Emissive Color”). I included this “Faster” shader in the .unitypackage.

Please ignore the poor formatting for now and let us know if this is what you’re talking about:

Shader "Sprite" {
    
Properties {_MainTex ("Texture, (A = Transparency)", 2D) = ""}

SubShader {
Tags {Queue = Transparent}
Blend SrcAlpha OneMinusSrcAlpha
Pass {
SetTexture[_MainTex]
} 
}

}

345423–12056–$vertex_color_lit_938.unitypackage (123 KB)

I gutted a number of pieces from my shader previously, but your version is much cleaner.

I also added in Alpha Testing as I can’t seem to guarantee draw order of multiple SpriteManagers.

But that new shader works wonders compared to the old one. I still don’t quite know how that old shader turned into such a horrid mess :sweat_smile:

Thank you.

Except I seem to have lost the use of Vertex Colour. Although I think I have a solution for that.

Shader "Sprite" {
   
Properties {_MainTex ("Texture, (A = Transparency)", 2D) = ""}

SubShader {
Tags {Queue = Transparent}
Blend SrcAlpha OneMinusSrcAlpha
Alphatest Greater 0.2 
    BindChannels {
        Bind "Color", color
        Bind "Vertex", vertex
        Bind "TexCoord", texcoord
    }
       Pass {
           SetTexture [_MainTex] {
                Combine texture * primary
           }
        }
    }
}

Bind Channels and adding a combine seems to fix that. Although I’m not sure that’s the most optimized route. (I got that off http://www.unifycommunity.com/wiki/index.php?title=VertexColorUnlit)

I’ve coded in HLSL before, but never too intricately and never really tinkering with fixed function calls.

Apparently you didn’t download the .unitypackage. :?
Okay, in fact, it says that it wasn’t downloaded.

Still, I had no idea that you were only asking for one shader here. The shader you posted doesn’t at all match the description you gave of what you need. So what do you actually need?

Yeah sorry,
I realized that most of that original shader was useless to me after I posted, and so I began gutting it and replaced it with VertexColorUnlit (linked above)

I saw your post and decided to try out the commented section and it seemed to mostly function, and I knew what I was missing (alpha testing to help alleviate draw order issues) so I didn’t download the sample (i assumed it was the same thing as the sample code :sweat_smile: )

I also posted quickly and forgot about Vertex Colours.

I realized that before I was only using lighting because it was breaking other parts of that frankenstein shader when I disabled it. I preferred to have no lighting.

What I needed was a shader that
Ignores Lighting
Uses Transparencies
Is as non specific on draw order as can be managed (z Depth is used to draw over top of other objects and Alpha testing removes large transparency ordering issues)
Uses Vertex Colours

This material is being placed on a version of the Sprite manager and I have multiple Managers running in one scene.

I apologize as I wrote it quickly and was pretty unclear. The version I last posted does seem to work, and I’m relying much more on defaults(I’m going to try to blame it on me multitasking on multiple issues).