Looking for examples of performance improvements for Open GL ES 2 (iOS) in Unity 3.2

Unity 3.2 is supposed to have better performance for OpenGL ES 2 on iOS, but I’m having trouble finding example projects that demonstrate how to get good performance. Some example projects run very fast using OpenGL ES 1.1 and have much worse performance using OpenGL ES 2.

For example, In the the OcclusionCulling example from this page, I get much better performance on an iPad using Open GL ES 1.1 instead of Open GL ES 2.

When I set USE_OPENGLES20_IF_AVAILABLE to 0 in AppController.mm, the OpenGL ES Driver instrument in Instruments reports that device utilization is 67%, renderer utilization is 56%, tiler utilization is 10%, and the framerate is 60.

When I set USE_OPENGLES20_IF_AVAILABLE to 1, Instruments reports that device utilization is 99%, renderer utilization is 97%, tiler utilization is 27%, and the framerate is 48.

Note: I also set the following values in AppController.mm in order to get 60 frames per second:
#define USE_DISPLAY_LINK_IF_AVAILABLE 1
#define kFPS 60.0

I would like to get the same performance using OpenGL ES 2 that I get with ES 1.1, so that I could write my own shaders for additional effects. Are there any example projects that demonstrate how to get good performance with ES 2?

if you use mobile shaders you get rather good performance.
But writting good, optimized mobile shaders is pretty complex, relying on node shader editors or surface shader will not get you there for example.

the mobile group in the shaders dropdown shows what is offered in the form of UT handoptimized mobile shaders

My Tessts showed: using a Standard bumb shader Even in 3.2 filling all the Scene results in Average 6 FPS.
The New mobile shader you can Import from the Standard Assets, sorry i Don,t know the exact Name, Shows 20 FPS. While that is a Big improvement, this shader is also quite Limited. It only reacts to Direct lights, i couldn,'t get it to work with a lightmap at all, and it Produces an Overall too Dark Look.
So, well, unless you can Write Shaders yourself i Would say, you are still out in the Dark.

Hi marjan,

The new Bumped Specular and Bumped Specular (1 direct) are designed to work with lightmapping. You might have luck baking lightmap data into the diffuse texture outside of Unity. I’ve used this technique several times and it worked pretty good.

-wes

Well its a mobile and limited platform.
Its to expect that if you can’t write shaders, you either have to hire someone who can create such shaders (in a mobile optimized manner) or should potentially consider to not use them as you do neither you nor your users any good.

There are enough FFP things you can do if you aren’t in the position to fund pure shader development (keep in mind OpenGL ES 2.0 devices are either completely on shaders or not on shaders at all, they can not only use shaders for advanced features while the rest is FFP like you could on the desktop)

In my experience, the SGX driver is much better at emulating OpenGL ES 1.1 than Unity is. If you don’t need features from 2.0, the best thing you can do is just use 1.1.

I think we had no time to update our example projects yet - they use old shaders and are not updated for proper GLES2.0 support. Sorry for that.

I would start taking a look at our (updated) documentation on performance optimization for iOS, it contains important details about GLES2.0 and shaders:
http://unity3d.com/support/documentation/Manual/Optimizing%20Graphics%20Performance.html#iPhoneOptimizingGraphicsPerformance

There is one line currently missing in the “Simple Checklist to make Your Game Faster” list:

  • if you’re using built-in shaders, peek ones from Mobile category. Keep in mind that Mobile/VertexLit is currently the fastest shader.

There are important differences which you need to keep in mind when you switch from ES1.1 (VertexLit rendering path) to ES2.0 (Forward rendering path). Following sections explain them in detail:
http://unity3d.com/support/documentation/Components/RenderTech-VertexLit.html
http://unity3d.com/support/documentation/Components/RenderTech-ForwardRendering.html

Then we have some useful tips for writing performant shaders (applies to iOS):
http://unity3d.com/support/documentation/Components/SL-ShaderPerformance.html

If you’re planning to write custom shaders it is important to take a look at Apple Performance Guides too:
http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/BestPracticesforShaders/BestPracticesforShaders.html

And take a look at update documentation on iOS hardware too:
http://unity3d.com/support/documentation/Manual/iphone-Hardware.html

All built-in shaders should work with lightmaps (unless it is a particle, FX or some special shader of course). If you see otherwise, please submit a bug report with a small scene showing the problem.

Make sure you always use Single Lightmaps (not Dual) for iOS / Android projects. If you have old lightmaps and they look bad, try rebaking them - we have changed internal format for lightmaps in iOS/Android to get better performance.

Thanks for all of that information Rej!

My mistake! I meant the bumped specular mobile shader doesn’t work with lightmapping. I believe the Bumped Specular (1 Direct) does work with lightmapping. The color from the lightmap is used instead of actual color. Sorry for confusion.