Fastest shader for iPhone?

Do you guys know what the fastest shader for the iPhone is? I have been using the iPhone lightmap and vertex lit shaders, as well the alpha selfillum shader from the wiki… but is there anything faster (not even reading the alpha, or just 1bit transparency)?

thanks!

Faster for which purpose?

For drawing textured objects.

thx

The normal diffuse shader that comes with Unity iPhone likely if you just want to draw a textured object

but that is still lit… wouldn’t it be faster to use a barebones shader that just reads the color of the texture, no shading, transparency check etc? Or are those minimal?

I’m pretty sure you’ll get better performance if you turn off lighting. Very often you can just burn lighting into your texturemap, and use a straight “combine texture” shader. I’d say it’s defenitely worth it to not just blindly take a shader “out of the box” when you deploy to iphone. Really see what the shader is doing and what parts of that you could live without.

Bye, Lucas

Diffuse fast is way faster than diffuse. Works great, watch the stats window with the draw calls to see the difference.

when using the decal shader it results in less drawcalls and way less tris, wouldn´t that be a good alternative?

to add to that i noticed this behavior when importing a fbx and when dragging it into the scene in unity i noticed its almost twice the tris count than what i see in the 3d app and also more drawcalls needed than i´d have guessed. So after some testing around i noticed that its the shader and when i use decal shader instead of diffuse or diffuse fast i get less drawcalls needed and almost only half the tris count.
Dunno why that happens still nice though :slight_smile:

Did you use lights?

dunno if you meant me, if so i have one directional light in the scene

Hi Martin!

I’m trying to squeeze whatever performance I can out of our snowboarding game for the next release and I tried your suggestion of the ‘Diffuse Fast’ shader. For our model (a skinned single-mesh character), I’m not seeing any difference in draw calls or tris in the stats window when switching between ‘Diffuse’, ‘Diffuse Fast’, or ‘Decal’.

I’m using ‘Edit > Graphics Emulation > iPhone’ when viewing the stats window, so I wonder if that makes a difference?

BTW, your performance tips in this thread were great:

http://forum.unity3d.com/viewtopic.php?p=107234&highlight=#107234

yeah,great tips there :slight_smile:
to ezone: have you tried using the decal shader instead?

Yup, tried the decal shader, and for our model the stats window shows the same draw calls and tris as ‘Diffuse’ and ‘Diffuse Fast’. Strange…

hm, yeah, that´s really weird, i had that reducation in drawcalls and big reducation in tris count with all models i tried. When discussing it on the irc channel someone else tried it in his project too and said he saved 5k polies. So yeah, dunno why i doesn´t bring anything in your case, sorry.

In my project, the draw calls are apparently the same for Diffuse vs. Diffuse Fast. However, if I set my Edit | Graphics Emulation to iPhone, then my draw calls drops significantly, for both shaders.

A related question. So Draw Calls is like this mysterious number. Am I correct in understanding the basic equation is more or less:
draw calls = meshes * textures

Thanks

Weird, yeah, had a massive draw call reduction here with the Diffuse Fast shader. Wonder why it does not work for you. Weird!

Aren’t diffuse and diffuse fast two pixel shaders that requires 1 draw call + 1 draw call per light that affects the mesh?

I tought it’s better for performance to use vertexlit shaders on the iPhone. I’m actually using vertexlit shaders and get 1 draw call per mesh and good performance with one directional light. :slight_smile:

mesh_draw_calls = visible_meshes * mesh_subsets * number_of_passes_per_material;

Since you can attach different materials to subsets of the mesh, it requires 1 draw call per subset. It doesn’t matter if you have or don’t have texture assigned to material, but it matters how many passes you have in material.

On top of that you can have more draw calls in the scene if you have skybox (+6), gui, particles, trails, projectors etc.

Sorry to bring this dead thread by I have a similar question.

In our game we don’t really have any use for lighting (it’s a 2D game).
For the moment we use a directional light and all object shaders are “Diffuse Fast”.
I’m don’t know much about how shaders work but I find that I can have a similar result for our scenes by using the “Self-Illumin/Diffuse” shader and by turning our directional light off.

What’s the more efficient solution?