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.
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:
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 )
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).