Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by wreckostudios · Aug 26, 2016 at 07:09 PM · iosmobilegraphicsmobileoptimization

Cutout shaders for 2D IOS game performance

Hello everyone,

I've read elsewhere that shaders that use cutout will degrade performance on IOS devices, because it prevents some GPU optimizations from happening.

However, according to a post by Apple, these optimizations (Tile Based Deferred Rendering) are prevented by blending, alpha tests, and cutout shaders (using discard in fragment code). Therefore, even the Unity default sprite shader would prevent these hardware optimizations, since it necessarily uses blending to layer overlapping sprites.

Here is the post by Apple (See - Use Hidden Surface Removal Effectively): https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Performance/Performance.html

I've also done some profiling in Xcode, and as far as I can tell, using the discard operation in a shader does dramatically decrease performance (30FPS in my app with discard, 40FPS without).

I'm pretty new to shaders, any help would be much appreciated!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image wreckostudios · Aug 27, 2016 at 06:30 AM 0
Share

Sorry I did not state a question clearly there. $$anonymous$$y question is: For a 2D game on IOS mobile devices, do cutout shaders harm performance?

I have read that cutout shaders harm performance, and as I mentioned in my original post, I found the supposed reason for that on Apple's website. Is Tile Based Deferred Rendering being shutoff the reason people say to use alpha blending shaders rather than cutout shaders?

I did a bunch more tests today, and actually found that in a scene with a lot of overdraw, cutout shaders perform $$anonymous$$UCH better. $$anonymous$$y previous tests in the original post were invalid, because I forgot to remove the framerate cap on the app. With cutout shaders (and no alpha blending), this test hit ~45FPS, and with alpha blending shaders the test hit ~17FPS. The shaders were setup to draw the meshes front to back by z position, so that in the cutout shading test almost no pixel would run more than one fragment shader, whereas in the alpha blending test each pixel would run ~12 fragment shaders. Of course the scene arrangement and textures were kept constant, and just shaders were adjusted.

Does anyone have any thoughts on this? Am I missing something?

Here are screen caps of my tests in Xcode instruments: (Cutout) alt text

... (Alpha blending) alt text

P.S.: I am testing on an iPad Air 2; sorry for the long post!

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

80 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to manage images in good resolution in Mobile App 0 Answers

Anti Aliasing on Mobile 3 Answers

3D performance on mobile platforms? 1 Answer

Help me to optimize my mobile game 1 Answer

Bloom/Neon effect Mobile 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges