Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Bovine · Oct 26, 2010 at 07:54 AM · ioslightingshaderspixelper

Per Pixel Lighting on iOS

Hi All

I've just purchased an iPad and built and run our concept game on the iPad. While I was hitting 30fps on 3G S the framerate crumbled on the iPad. I understand that this could be insurmountable as I am presuming that the fill limit is being hit because of the drastically increased screen size. Basically I have one directional light and one point light. Everything is set to diffuse fast bar one object which I have set to diffuse and one point light on the player set as important for per-pixel lighting. It feels like a simple setup, but it seems to be crippling performance - 30fps everywhere else, but when the one large object fills the screen I drop to 20fps. Scene is relatively low poly with 4.2K tris in view at the time I get 30 fps. I've reduced the entire scene to one material just to see if it is hammering to swap materials.

I've recently seen the Epic Citadel demo from Unreal, which I think is running native res, and probably massively simplified lighting, but they appear to be getting some nice per pixel effects with normal mapping, so I'm surprised that with just one object affected by per pixel lighting, that the performance drops so dramatically.

Is it worth me writing some simple shaders to improve performance?

Thanks Ian H

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by robert · Oct 26, 2010 at 10:27 AM

It looks like indeed you're fill-rate bound if there are too many pixels running with an expensive shader on the screen. I'd make some more experiments to confirm this and as a solution maybe try to simplify the lighting, use lightmaps or try to achieve the effect in a different way.

As far as I know Epic Citadel doesn't have any dynamic lights - it's lightmaps only. Because these are UE3-style lightmaps, you see some specular highlights. Also in the demo they avoid drawing anything that might consume the fill-rate excessively, so for instance there are no particles and almost no foliage and the demo is already running on the edge. Adding anything more to it (a dynamic light, a particle effect, an animated character) would also probably put the framerate under acceptable levels.

Comment
Add comment · Share
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
1
Best Answer

Answer by runonthespot · Nov 02, 2010 at 04:56 PM

Pay close attention to the size and compression settings on your textures too. I found by reducing texture sizes and acquiescing to using PVRTC compression as much as acceptable, significantly improved performance on ipad and iphone4 (ipad being the worst of the bunch, performance wise). Test this by setting all textures to the worst quality possible, PVRTC 2bit, 256x256 and see how it performs.

Drawcalls are apparently less of an issue than they were. Also look at baking in light, and occlusion culling.

Finally, can I recommend going into your xcode project application delegate and removing the 30fps limit when testing and always running your code with fps meter on, and then aim for >50fps on 3gs or iphone 4. I find I then get relatively acceptable performance on ipad. You generally don't want to go less than around 25fps (I consider this passable for very complex scenes, given that a Hollywood film does 24fps as standard)

Comment
Add comment · Show 4 · Share
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 Bovine · Nov 03, 2010 at 08:59 AM 0
Share

Yes, I have been thinking about removing the limit and ensuring that the game flies on 3G S, so that sounds good. True blu-rays are 24P, but each frame is a snapshot of real action, so will include motion blur, naturally captured at that frame, which I understand helps keep things looking fluid and of course, unless you add motion blur, a game will always be a crisp snapshot of time at that frame.

avatar image runonthespot · Nov 03, 2010 at 10:19 AM 0
Share

A good point re motion blur- explains why I never feel comfortable under 30fps :) I remove the limit only for testing purposes, as it's too onerous to test on multiple devices the whole time. That way I can mostly ensure that it'll perform okay on ipad without tying up my wife's ipad ;-)

avatar image runonthespot · Nov 03, 2010 at 10:22 AM 0
Share

Also, I recommend using the Simply Lit shaders from the unify community wiki.

http://www.unifycommunity.com/wiki/index.php?title=Simply_Lit

avatar image Bovine · Dec 02, 2010 at 05:12 PM 0
Share

I've been simplifying the per pixel lighting shaders to do things like ignore alpha and assume the diffuse is always white.

avatar image
1

Answer by noradninja · Oct 27, 2010 at 11:11 PM

If you want to keep the same visuals as your game on the 3GS and dont mind the lower resolution, you can force your game to run in standard resolution on the iPad/iPhone4/iPod4G by setting Target Resolution to Standard in the Player settings in Unity before you build. This will keep your framerate acceptable at the expense of resolution and is what I do for the games that I require pixel lighting in (mostly for normal mapping).

Comment
Add comment · Show 1 · Share
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 Bovine · Dec 02, 2010 at 05:12 PM 0
Share

I don't know if was doing something wrong here, but this didn't seem to make any difference for me at all.

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

No one has followed this question yet.

Related Questions

Lighting works for iPad but not iPhone? 0 Answers

Alternatives for using vertex colors + vertex lighting, IOS 1 Answer

How to create 2D pixel water shader ? 0 Answers

In a shader designed for Forward rendering, unity_Lightmap seems to be correct in the base pass and incorrect in the add pass. Am I doing something wrong or is this a bug? 0 Answers

Unity URP black outline on my mesh polygons 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