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
0
Question by David 19 · Jan 05, 2011 at 05:59 PM · iphoneoptimizationmaterialstexturescallback

How to do iPhone Optimization with materials, textures and callbacks?

Ok, I recently new to Unity and have been searching around for a straight answer. I have 26 textures representing the alphabet. Each letter pops on the screen for a few seconds. The platform is for the iPhone so optimization is needed. What is the best way to achieve this? Here's what I've come across?

  1. Create 26 materials for 26 textures.
  2. Create 1 Material for 26 textures which are stored in an array and swapped.
  3. Put all letters into one texture (atlas) and create 26 materials.
  4. Put all letters into one texture and create 1 material and use script to offset the texture to get that letter. (is this possible?)

In terms of reducing draw calls and memory what is the most efficient way to handle this. What increases DrawCalls the number of materials or the number textures that need to be drawn? I was going to attempt option 3 as I can use the unity editor but I'm not sure if this is the best way? Thanks for any replies that will help to clarify this.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by chief1234 · Jan 05, 2011 at 06:51 PM

Every material you use is at least 1 drawcall. Lights, shadows and fancy shaders increase this number - per material.

So your best option is number 4 - make an atlas of all 26 textures and offset through script. This is a good start:

var letterOffset : float = 0.1; //the width of each letter function GoToLetter(letter : int) {

 renderer.material.SetTextureOffset ("_MainTex", Vector2(letterOffset * letter, 0));

}

This solution gets a bit trickier if your atlas has multiple rows (which it will need to for a power of 2 texture on iPhone) - you'll have to develop a formula for going to the correct row for the y offset, but it's the most efficient.

The second-best option would be option 2.

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

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

Dynamic batching 6 Answers

set minimum texture resolution? 2 Answers

Optimizing bump map or luminous textures on spheres for mobile 1 Answer

Textures/Materials and Cinema4D 1 Answer

Motion Blur/Burn in on specific material 1 Answer


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