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 dansav · Mar 23, 2012 at 03:47 AM · iosiphonetextureformat

which TextureFormat should I use for new Texture2D on iphone

Which texture format should I use for a new Texture2D on iphone.

var screenShot = new Texture2D(320,480, TextureFormat.RGB24, false);

file:///Applications/Unity/Documentation/ScriptReference/TextureFormat.html Should I use the ios ones? or the standard ones like RGB24.

TextureFormat.RGB24

PVRTC_RGB2

PowerVR (iOS) 2 bits/pixel compressed color texture format. PVRTC_RGBA2

PowerVR (iOS) 2 bits/pixel compressed with alpha channel texture format PVRTC_RGB4

PowerVR (iOS) 4 bits/pixel compressed color texture format. PVRTC_RGBA4

PowerVR (iOS) 4 bits/pixel compressed with alpha channel texture format

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
0

Answer by KvanteTore · Mar 23, 2012 at 07:42 AM

Generally, you should use a compressed texture if you can get away with it, as they are both smaller in download size and faster to render. Compressing the textures introduces some artifacts though, and really it depends on your quality requirements if it's acceptable.

If the 2bits per pixel ones look ok for your game, then that's good, otherwise try the 4bpp. Use RGB24 or ARGB32 only if the compressed textures look unacceptable.

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 dansav · Mar 23, 2012 at 08:38 AM 0
Share

I'm trying to use EncodeToPNG after I grab the pixels. The docs say EncodeToPNG works only on RGB24 texture formats. I'm trying to grab screenshots as fast as possible using RenderTexture. So far on the iphone I get about 3 per second using the RGB24 code. Is there someway to use EncodeToPNG with the ios textures? OR maybe is there another encoding function that could use them?

rt = new RenderTexture(320, 480, 16);

in the update loop... var screenShot = new Texture2D(320,480, TextureFormat.PVRTC_RGB2, false);

         RenderTexture.active = rt;
         screenShot.ReadPixels(new Rect(0, 0, 320, 480), 0, 0);
         var bytes:byte[] = screenShot.EncodeToPNG();

avatar image dansav · Mar 23, 2012 at 08:51 AM 0
Share

actually this line is bugging out as bad thread access. Am I missing some other setting before using this texture type on iphone?

  var screenShot = new Texture2D(320,480, TextureFormat.PVRTC_RGB2, false);
avatar image luisanton · Oct 21, 2012 at 01:51 PM 0
Share

I'm also getting a bat thread access with PVRTC_RGB2. Did you solve this issue?

avatar image KvanteTore · Oct 22, 2012 at 10:13 AM 0
Share

Unity changed the behaviour of reading pixels from the screen lately (last paragraph of http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.ReadPixels.html). Try yielding and reading the pixels the next frame.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Simultaneous Android and iOS development 1 Answer

Ran out of trampolines of type 2 - iOS 2 Answers

ex2D performance 1 Answer

show video frame on texture in ios 1 Answer

What do i need to run my built application for iphone using unity to be run on android devices 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