- Home /
Why Sprites-Default shader hasn't any fallback?
I downloaded source code for standard shaders and discovered that Sprites-Default has no fallback. (Also Sprites-Diffuse has fallback to Alpha-VertexLit.)
You probably think why would I want it. That's because I recently read about shaders in Manual, and it states that if you code has CGPROGRAM in it, then it's surface (or vertex) shader. And when you have surface (or vertex) shader then:
"You will probably want to write fixed function shaders as an n-th fallback to your fancy fragment or surface shaders, to make sure your game still renders something sensible when run on old hardware or simpler mobile platforms."
So, if my game is running on such mobile platform that Sprites-Diffuse will fallback, will Sprites-Default still work properly? If yes, why? If no, what should I do?
If you're running a platform that can't handle the Sprites-Default shader, I doubt you'd be able to make anything in Unity that would run on it anyway.
Answer by Bunny83 · May 07, 2014 at 03:33 AM
Like Eric said, the "Sprites-Diffuse" is one of the simplest shaders in Unity, it doesn't cull, it doesn't use lighting, it just uses alpha-blending. In the rare case that your target platform / device doesn't support alpha blending, to what kind of shader should it "fall-back" to? You can't display a sprite without alpha blending or every sprite would be a rectangle with solid background color.
Since it's so simple, why is it even CG shader? Why not just fixed function shader?
dog_funtom - because fixed function shaders are not supported on some platforms